-
Notifications
You must be signed in to change notification settings - Fork 39.3k
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 bug where using kubectl patch with $deleteFromPrimitiveList on an empty or nonexistent list adds the item to be removed #105421
Conversation
… an empty or nonexistent list incorrectly adds the item to be removed.
/retest |
/assign @apelisse |
Thanks! |
cc @mengqiy |
Hmm, I guess I forgot to do /assign @pwittrock |
original[k] = patchV | ||
if !isDeleteList { | ||
original[k] = patchV | ||
} |
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.
missing test case for this
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.
IIUC https://github.com/kubernetes/kubernetes/pull/105421/files#diff-0f579f8292053ed842e08773b87393bb70de697fdcd32779c9ce820562e0c546R707 is to cover this case. The originalType
is string and the patchType
is int.
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
/approve
Thanks for fixing this!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: apelisse, brianpursley, mengqiy The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@brianpursley thanks for fixing this! I think, this deserves a backport, WDYT? |
@timebertt Agreed. It is a bug that affects previous versions, so it should be backported. I'll see if I can follow the cherry pick process to do that. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes bug where using kubectl patch with $deleteFromPrimitiveList on a nonexistent or empty list would add the item to the list
Here is a command that illustrates the problem:
Current output with the bug. Notice the finalizer is added:
Output after this PR fixes the bug:
Which issue(s) this PR fixes:
Fixes #105146
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: