GoogleContainerTools / kpt-config-sync

Config Sync - used to sync Git, OCI and Helm charts to your clusters.
Apache License 2.0
229 stars 40 forks source link

Kustomize version 5.3.0 causes unpredictable patches with null values #1198

Open frits-v opened 2 months ago

frits-v commented 2 months ago

A bug (https://github.com/kubernetes-sigs/kustomize/issues/5031) in the currently included kustomize version (5.3.0) causes patched manifests with null values have their values replaced by strings "null". This makes it hard to for example change a DeploymentStrategy from RollingUpdate to Recreate. The bug is fixed upstream (https://github.com/kubernetes-sigs/kustomize/pull/5519), it is included in Kustomize 5.4.1.

Working example patch with kubectl:

kubectl patch deployments/example-deployment -p '{"spec":{"strategy":{"type":"Recreate","rollingUpdate":null}}}' --dry-run=server
deployment.apps/example-deployment patched

It's not possible to achieve the same results using the current nomos / config-sync versions, it will result in the following error:

[3] KNV1067: failed to encode declared fields: .spec.strategy.rollingUpdate: expected map, got &{null}

If you run nomos with --no-api-server-check it is clear why, the manifest excerpt in question:

[...]
  strategy:
    rollingUpdate: "null"

Please consider bumping the included Kustomize version to the latest stable.

mikebz commented 2 months ago

Thank you! We will keep this in mind and will try to update to the latest version when it's time to release the next minor version of Config Sync (currently end of summer).