Skip to content
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

fix: ensure key node style in FieldSetter.Filter #4948

Closed
wants to merge 2 commits into from

Conversation

ephesused
Copy link
Contributor

@ephesused ephesused commented Dec 26, 2022

When FieldSetter.Filter creates a new field, check the key node's value and apply an appropriate style when needed.

Fixes #4928

When FieldSetter.Filter creates a new field, check the key node's
value and apply an appropriate style when needed.
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ephesused
Once this PR has been reviewed and has the lgtm label, please assign natasha41575 for approval by writing /assign @natasha41575 in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 26, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @ephesused. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 26, 2022
@KnVerey
Copy link
Contributor

KnVerey commented Jan 3, 2023

Related to #3446 , though only addresses the specific case of integer keys that come from an SMP (if the resource being patched has an integer key, even that still does not work). Please fix the test failures and re-ping.

@k8s-ci-robot
Copy link
Contributor

@ephesused: This PR has multiple commits, and the default merge method is: merge.
You can request commits to be squashed using the label: tide/merge-method-squash

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ephesused
Copy link
Contributor Author

Please fix the test failures and re-ping.

Apologies - I'm still struggling to set up a kustomize development environment where I can run all the tests cleanly. That makes it hard to catch "honest" test failures. I'm hopeful that the second commit will address the problems.

@ephesused
Copy link
Contributor Author

@KnVerey, after seeing https://istio.io/latest/docs/reference/config/security/peer_authentication/ (mentioned in #3446), I'm concerned about using this change since it effectively forces stringification of patch-added keys. I fear that probably is a stronger assumption than is appropriate. The test cases altered in ffd9a18 look like the changes are appropriate (label and annotation keys are supposed to be strings), but the PeerAuthentication reference points to resources where certain keys are supposed to be uint32.

To quote myself from the discussion in #4928:

Perhaps a better (and more involved) fix would be to have walkMap pass not only field names of the keys, but a slice of field name / style pairs. That way FieldSetter.Filter's field creation could honor whatever style came from the key's source node.

I'm willing to give that approach a try if you'd like to see it. Let me know what you think.

@Hammond95
Copy link

@ephesused Did you manage to take a look at this?

@ephesused
Copy link
Contributor Author

@Hammond95, sorry, I have not. I have been focused on other things and forgot about this issue. I'll try to take a look within the next few days.

@Hammond95
Copy link

amazing! thank you @ephesused!

@ephesused
Copy link
Contributor Author

ephesused commented Jan 28, 2023

From the discussion in #4928:

Perhaps a better (and more involved) fix would be to have walkMap pass not only field names of the keys, but a slice of field name / style pairs. That way FieldSetter.Filter's field creation could honor whatever style came from the key's source node.

This now is #5005.

Edited to add: I believe #5005 is the better approach. I'm leaving this here as an alternative if there's a meaningful concern uncovered with #5005.

@Hammond95
Copy link

amazing @ephesused!! Great job!

@KnVerey
Copy link
Contributor

KnVerey commented Apr 3, 2023

I believe #5005 is the better approach.

I had a look at that PR today and I agree that that seems like the better place to fix this issue. I also agree with the concerns you expressed above about forcing stringification of patch-added keys. I'm going to close this PR in favour of that one.

/close

@k8s-ci-robot
Copy link
Contributor

@KnVerey: Closed this PR.

In response to this:

I believe #5005 is the better approach.

I had a look at that PR today and I agree that that seems like the better place to fix this issue. I also agree with the concerns you expressed above about forcing stringification of patch-added keys. I'm going to close this PR in favour of that one.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kustomize fails to apply overlay if key in base yaml is numeric and missing
4 participants