Skip to content
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

Annotation kustomize.config.k8s.io/needs-hash not working on static resources #4833

Open
LittleChimera opened this issue Oct 14, 2022 · 7 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@LittleChimera
Copy link

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 LittleChimera added the kind/bug Categorizes issue or PR as related to a bug. label Oct 14, 2022
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 14, 2022
@KnVerey
Copy link
Contributor

KnVerey commented Dec 7, 2022

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.

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 7, 2022
@yutaroyamanaka
Copy link
Contributor

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

@k8s-triage-robot
Copy link

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

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels Apr 7, 2024
@varshaprasad96
Copy link
Member

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!

@tcurdt
Copy link

tcurdt commented Jun 3, 2024

@varshaprasad96 I am able to reproduce it with v5.4.2

@stormqueen1990
Copy link
Member

/triage accepted
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jun 5, 2024
@tanguyantoine
Copy link

@varshaprasad96 I am able to reproduce it with v5.4.2 too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

9 participants