-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🛠️ Refactor metadata flattener #2345
Conversation
I had a quick look and obviously don't have full context, but one thing I looked for but couldn't find was unit tests for the |
183e9fa
to
fc196ce
Compare
I have added a unit test for the |
2ac29fb
to
f45e73f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@SarahFrench I have added a unit test for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding those unit tests - they help me to understand the difference between the two functions. I'm glad that the two behaviours have been split apart!
Approving because the acceptance tests have passed and the unit tests look good and pass 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
// | ||
// More information: https://kubernetes.io/docs/reference/labels-annotations-taints/ | ||
generatedLabels := []string{ | ||
"batch.kubernetes.io/controller-uid", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These first two are new. Could this be a breaking change if any existing configuration is depending on them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually discovered these two labels when switched Job and CronJob from flattenMetadata
to flattenMetadataFields
. Once I did it, tests were failing due to batch.kubernetes.io
labels.
I think that should not cause a breaking change. In the original flattenMetadata
function, we only made a conditional exception on annotations when a prefix was passed and kept cutting labels. These two labels were cut anyway.
0f0aed8
to
9c99cab
Compare
Description
This PR has the following changes:
flattenMetadata
function into 2 independent ones:flattenMetadataFields
-- to flatten all metadata fields, this one is used to flatten metadata of the datasources and template specsflattenMetadata
-- to cut some labels and annotations and then flatten metadataannotations
andlabels
, in spite ofignore_annotations
andignore_labels
settingsremoveGeneratedLabels
to remove job controller server-generated labels.Acceptance tests
Output from acceptance testing:
Release Note
Release note for CHANGELOG:
References
Fix: #2336
Fix: #2340
Community Note