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

"annotations: {}" in the input is removed by kustomize while "labels: {}" isn't #5647

Open
JordanGoasdoue opened this issue Apr 5, 2024 · 1 comment
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/under-consideration

Comments

@JordanGoasdoue
Copy link

What happened?

I've used kustomize successfully to add some changes to my helm, but i've seen that annotations: {} are being removed, while labels: {} or even a fake field i've added for testing purpose fake: {} are kept

What did you expect to happen?

I expect annotations: {} to stay and not being removed if it's present on the input

How can we reproduce it (as minimally and precisely as possible)?

# kustomization.yaml
resources:
  - resources.yaml
# resources.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: sa
  labels: {}
  annotations: {}
  fake: {}

Expected output

apiVersion: v1
kind: ServiceAccount
metadata:
  fake: {}
  labels: {}
  annotations: {}
  name: sa

Actual output

apiVersion: v1
kind: ServiceAccount
metadata:
  fake: {}
  labels: {}
  name: sa

Kustomize version

v5.4.1

Operating system

Linux

@JordanGoasdoue JordanGoasdoue added the kind/bug Categorizes issue or PR as related to a bug. label Apr 5, 2024
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Apr 5, 2024
@JordanGoasdoue JordanGoasdoue changed the title "annotations: {}" in the input is removed by kustomize while "labels: {}" doesn't "annotations: {}" in the input is removed by kustomize while "labels: {}" isn't Apr 5, 2024
@koba1t
Copy link
Member

koba1t commented Apr 7, 2024

I expect annotations: {} to stay and not being removed if it's present on the input

I think this behavior was made deliberately to avoid the problem of kptdev/kpt#541.
#2595

/triage under-consideration

@k8s-ci-robot k8s-ci-robot added triage/under-consideration and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 7, 2024
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. triage/under-consideration
Projects
None yet
Development

No branches or pull requests

3 participants