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
tail
command to properly cut the generatedrole.yaml
file and avoid deleteng therules
section.Context:
Recently we bumped
controller-tools
version tov0.9.2
to supportbuilding controller with go1.19. This change sneakily impacted the
build-controller-release.sh
script, which caused our prow testing jobsto fail.
To summarize the bug we can generate the
role.yaml
file usingcontroller-gen
0.7.0
and0.9.2
and 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 +8
in 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.