-
Notifications
You must be signed in to change notification settings - Fork 115
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
Prune read-only fields from resource inputs #2571
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov Report
@@ Coverage Diff @@
## master #2571 +/- ##
==========================================
- Coverage 18.64% 18.61% -0.04%
==========================================
Files 47 47
Lines 9434 9440 +6
==========================================
- Hits 1759 1757 -2
- Misses 7576 7584 +8
Partials 99 99
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
provider/pkg/clients/unstructured.go
Outdated
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 moved the pruning logic to normalizeInputs
in provider.go for two reasons:
- Pruning of read-only fields makes sense only for inputs, not for outputs, but the
clients.Normalize
function seems general-purpose in nature. That is, general-purpose normalization is independent of input pruning. - It is desirable to prune the read-only fields even for custom resources, where a scheme isn't available (and
shouldNormalize
would be false).
I renamed normalize
to normalizeInputs
in provider.go for clarity, and double-checked that it is not used with outputs.
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.
Changes look good to me, but I'll defer to Ramon for a closer look.
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.
It looks like auto-merge didn't block until an approval was given. Regardless, the new changes LGTM.
Proposed changes
This PR improves the handling of the read-only metadata fields of Kubernetes objects, such as
creationTimestamp
andresourceVersion
. The provider now ignores these fields when they appear as resource inputs, to address a few quirks:__inputs
property.An integration test is provided to show that such fields are ignored as inputs, and are still available as outputs. Manual tests confirmed identical behavior for custom resource objects.
The resultant state shows that the read-only fields are not present in
"inputs"
nor in"__inputs"
, and are present in"outputs"
:Related issues (optional)
Closes #2351
Related: