kustomize icon indicating copy to clipboard operation
kustomize copied to clipboard

`kustomize edit add label` generates deprecated config

Open mhutter opened this issue 1 year ago • 4 comments

What happened?

How to reproduce:

kustomize edit add label environment:dev

This will set commonLabels.env in the kustomization file, triggering a deprecation warning.

What did you expect to happen?

Kustomize commands to not generate deprecated configs.

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

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

Expected output

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
labels:
- includeSelectors: true
  pairs:
    environment: dev

Actual output

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
  environment: dev

Kustomize version

5.4.2

Operating system

Linux

mhutter avatar Jun 27 '24 08:06 mhutter

This is not exactly a bug, but I agree that since Kustomize is deprecating commonLabels, it should either provide a new command that creates configuration in the new, non-deprecated format, or update the existing command to do so. In the meantime, kustomize edit fix can be used to transform the previous format of label configuration into the new format.

/triage accepted /remove-kind bug /kind deprecation /kind cleanup

stormqueen1990 avatar Jul 09 '24 01:07 stormqueen1990

/lifecycle frozen

stormqueen1990 avatar Jul 09 '24 01:07 stormqueen1990

Hello, @stormqueen1990.

Is there any plan or guidance for implementing a CLI command for the new options?

Thanks!

daengdaengLee avatar May 21 '25 00:05 daengdaengLee

Hello, @stormqueen1990.

Is there any plan or guidance for implementing a CLI command for the new options?

Thanks!

Hi there, @daengdaengLee! We currently have PR #5741 in the works that will enable creation of labels under the labels section once merged.

stormqueen1990 avatar May 24 '25 21:05 stormqueen1990