kustomize
kustomize copied to clipboard
Annotation `kustomize.config.k8s.io/needs-hash` not working on static resources
Describe the bug
Setting annotation kustomize.config.k8s.io/needs-hash: "true" on static resources doesn't add hash suffix to the name. Setting the annotation internal.config.kubernetes.io/needsHashSuffix: "enabled" instead gets the expected result.
Files that can reproduce the issue
kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: foo
annotations:
kustomize.config.k8s.io/needs-hash: "true"
data:
foo: bar
Expected output
apiVersion: v1
data:
foo: bar
kind: ConfigMap
metadata:
name: foo-798k5k7g9f
Actual output
apiVersion: v1
data:
foo: bar
kind: ConfigMap
metadata:
annotations:
kustomize.config.k8s.io/needs-hash: "true"
name: foo
Kustomize version
4.5.7
@LittleChimera: This issue is currently awaiting triage.
SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
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.
Reproduced. (note to self: this is documented at https://kubectl.docs.kubernetes.io/guides/extending_kustomize/#generator-options) /triage accepted
FWIW I noticed this summer that the use of this annotation with external transformers isn't well tested, and potentially also broken. I had a WIP branch started that might be a useful reference if someone wants to look into this.
I figured out why hash suffixing stops working with merge/replace behaviour set by kustomize.config.k8s.io/behavior?
So I'd like to make a PR about it.
/assign
This issue has not been updated in over 1 year, and should be re-triaged.
You can:
- Confirm that this issue is still relevant with
/triage accepted(org members only) - Close this issue with
/close
For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/
/remove-triage accepted
Action Item: We would need to revisit and verify the functionality of both the annotations.
@yutaroyamanaka Thanks for figuring out the cause. Does this also occur in the latest (v5.0.0+) versions of kustomize? If so, could you elaborate on what the fix is. Thank you!
@varshaprasad96 I am able to reproduce it with v5.4.2
/triage accepted /lifecycle frozen
@varshaprasad96 I am able to reproduce it with v5.4.2 too