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
strategic patch doesn't keep order of duplicated elements in the list #65106
Comments
If name is the key, it is invalid to have the item twice in the list |
there is a testcase which explicitly allows it https://github.com/redbaron/kubernetes/blob/971c1b20e51dd2090a9fd585bafa18282c2984f5/staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/patch_test.go#L4155-L4226 in our case duplicates where in a list of environment variables in container definition. I'll check tomorrow, but I think that pod was running with duplicates in env list just fine. |
confirmed, there are pods with duplicated env variable names, kubernetes is happy to run them, so I'd guess strategic patch should support this case |
They run, but are currently undefined with respect to ordering of the duplicate items on patch. |
hence this issue :) If k8s allows pod template to be accepted it should allow pod template to be updated on |
The likely outcome is to tighten validation to not accept those templates. See #64907 |
/cc @jennybuckley |
Whats the conclusion? Is it NOTABUG? |
It is a bug, but the bug is that duplicate keys are allowed in the first place. Fixing that validation in the least disruptive way possible would likely be the best solution |
strategic patch and resource validation are on a different levels, each should do best to ensure correctness. Validating PODs for keys duplications is a good thing of course, but strategic patch should do it's part too: either detect unsupported case and return error or start supporting it, silently |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
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. |
/reopen |
@strmdvr: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
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. |
/reopen |
@redbaron: Reopened this issue. In response to this:
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. |
We can keep this open, but I don't think it's anyone's priority to fix this. I'm not optimistic. Also, if you want to keep it open, we should rename the title, maybe something like:
My understanding is that we can only have duplicates within the patch, which means that we only have to verify that there aren't duplicates when we generate the patch. I don't know how much we would see this as a backward incompatible change or as a bug fix too. |
If we make if fail on duplicates, wouldn't it stop apply to work for containers with duplicated elements? If so, when users try to remove duplicates they wont be able to do so. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. In response to this:
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. |
/reopen |
@redbaron: Reopened this issue. In response to this:
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. |
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /close |
@k8s-triage-robot: Closing this issue. In response to this:
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. |
/reopen |
@deepflame: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
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. |
/reopen Is it possible to freeze it? this reopen dance is pointless, bug is confirmed and just waits for resolution one way or another, closing issue doesn't make problem go away. |
@redbaron: Reopened this issue. In response to this:
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. |
what will be the final outcome here - it will be fixed or duplicated environment variables will not be accepted? |
I'd say it's fairly unlikely that we'll fix this in strategic-merge-patch, but at least we're addressing this in server-side apply right now. |
/kind bug
What happened:
given list with duplicated keys D1
and a patch updating non-duplicated key A:
it reorders keys:
What you expected to happen:
Order of duplicated keys stays the same
How to reproduce it (as minimally and precisely as possible):
I created test-case which fails on release-1.10 and master: redbaron@971c1b2
Anything else we need to know?:
I am trying to find out why kubectl creates incorrect patch on apply. Although I can't reproduce it with a simple test case like in this ticket, it look related to it. On a real resource kubectl apply it reorders keys in generated patch, so it generates something like:
which makes it an invalid patch as order of keys differs from order of values. This reordering might or might not be result of the same underneath bug.
/sig api-machinery
The text was updated successfully, but these errors were encountered: