[Feature] Set labels conditional spec selector#1064
Open
kemv wants to merge 7 commits intokptdev:mainfrom
Open
[Feature] Set labels conditional spec selector#1064kemv wants to merge 7 commits intokptdev:mainfrom
kemv wants to merge 7 commits intokptdev:mainfrom
Conversation
added 7 commits
September 13, 2023 13:43
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
Signed-off-by: kemv <kemv@tv2.dk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The problem
I am facing a use-case where i would like to set common labels to all resources in my Kpt pipeline. To do this, i have tried using set-labels.
One of the common labels I want to set on all resources is app.kubernetes.io/version.
The problem is, set-labels also sets .spec.selector labels on deployments, and this field is immutable. This means, that when the version changes, all deployments have to be deleted and created again.
I propose some changes to have a switch to tell set-labels that it shouldn't set
.spec.selectors. I have achieved this through theSetLabelskind already defined:Considerations
I think that keeping backwards compatibility is very important. Therefore the option always defaults to true. Meaning if you change nothing, the functaionality doesn't change, even with this new feature. I haven't added this new functionality to the
ConfigMapapproach. This is because it would be harder to make this approach backwards compatible. The same with the imperative approach.I have added a new e2e test for this functionality. I don't think this small functionality merits a new example page, but i have expanded the main README.md for the function.