-
Notifications
You must be signed in to change notification settings - Fork 90
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
ssa: object normalization improvements #658
Merged
Merged
Conversation
This file contains 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
hiddeco
force-pushed
the
ssa-normalize
branch
4 times, most recently
from
October 5, 2023 19:11
d593324
to
c7d0acb
Compare
hiddeco
changed the title
ssa: normalize improvements
ssa: object normalization improvements
Oct 5, 2023
hiddeco
added
enhancement
New feature or request
area/server-side-apply
SSA related issues and pull requests
labels
Oct 5, 2023
hiddeco
force-pushed
the
ssa-normalize
branch
3 times, most recently
from
October 5, 2023 21:09
044a995
to
9ad1309
Compare
hiddeco
commented
Oct 5, 2023
hiddeco
commented
Oct 5, 2023
hiddeco
force-pushed
the
ssa-normalize
branch
2 times, most recently
from
October 6, 2023 15:04
98b1888
to
9cb0840
Compare
stefanprodan
approved these changes
Oct 7, 2023
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.
LGTM
Great refactoring, thanks @hiddeco 🥇
This allows for a single Unstructured object to be normalized, as was already possible for a slice of objects using `SetNativeKindsDefaults`. In addition, the further logic around normalization has be rewritten to improve maintainability and address certain edge-case issues. More specifically: - Any default Kubernetes resource is normalized by converting it to a typed resource, and back to an Unstructured. - Protocol default fixes have been added for Job and CronJob resources, which can hypothetically include port definitions. - Instead of removing the `creationTimestamp` field, it is written to `nil`, to equal the default set for Unstructured objects returned by the converter. - Test coverage has been added. Signed-off-by: Hidde Beydals <[email protected]>
To facilitate fixing issues to Kubernetes resources as returned by a server-side dry-run apply. The behavior of the function itself equals to the previous behavior of `fixHorizontalPodAutoscaler`. However, this is now exposed to allow other consumers (e.g. the to be introduced `jsondiff` sub-library) to make use of the same patches without further code duplication. Signed-off-by: Hidde Beydals <[email protected]>
In favor of the newly added `NormalizeUnstructuredList`. Signed-off-by: Hidde Beydals <[email protected]>
This enriches the options a consumer has to debug the error, as it now provides access to the Unstructured which produced the error. While also allowing the upcoming `jsondiff` sub-package to reuse and emit the error. Signed-off-by: Hidde Beydals <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
No description provided.