Skip to content

Commit

Permalink
fix: strategic merge patch delete for map keys
Browse files Browse the repository at this point in the history
When a map key is deleted, it should be deleted as a whole.
Before the fix it was zeroing out map value by key.

Fixes siderolabs#9325

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Sep 16, 2024
1 parent f337052 commit 18daedb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func deleteForPath(val reflect.Value, path []string, key, value string) error {

if idx := val.MapIndex(searchForVal); idx.IsValid() {
if len(path) == 0 {
val.SetMapIndex(searchForVal, reflect.Zero(valType.Elem()))
val.SetMapIndex(searchForVal, reflect.Value{})

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ machine:
hostDNS:
enabled: true
forwardKubeDNSToHost: true
nodeLabels:
node.kubernetes.io/exclude-from-external-load-balancers: ""
cluster:
id: 0raF93qnkMvF-FZNuvyGozXNdLiT2FOWSlyBaW4PR-w=
secret: pofHbABZq7VXuObsdLdy/bHmz6hlMHZ3p8+6WKrv1ic=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ cluster:
admissionControl:
- name: PodSecurity
$patch: delete
machine:
nodeLabels:
node.kubernetes.io/exclude-from-external-load-balancers:
$patch: delete

0 comments on commit 18daedb

Please sign in to comment.