Fix controller ClusterRole file generation
#363
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch fixes the
tailcommand to properly cut the generatedrole.yamlfile and avoid deleteng therulessection.Context:
Recently we bumped
controller-toolsversion tov0.9.2to supportbuilding controller with go1.19. This change sneakily impacted the
build-controller-release.shscript, which caused our prow testing jobsto fail.
To summarize the bug we can generate the
role.yamlfile usingcontroller-gen
0.7.0and0.9.2and inspect the differences:diff role-controller-gen0.9.2.yaml role-controller-gen0.7.0.yaml 0a1 >We can observe that the new line that used it be generated at the top of
each file is no longer there, due to the fix introduced in 0.8.0 more
precisely in kubernetes-sigs/controller-tools#626
This change combined with the command
tail -n +8in the buildcontroller release script causes the script to cut an extra line which
happens to be declaration of rules section in a controller ClusterRole
manifest. Hence the error observed in the prow logs:
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.