-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Description
What happened?
When using:
kustomize --stack-trace edit add label --without-selector test1:a test2:b
On a kustomization.yaml without pre-existing
labels:
- pairs:
environment: dev
causes the following error:
Error: label test2 already in kustomization file. Use --force to override.
IMPORTANT:
The following permutations allow it to work:
- Use the
--forceflag - Omit the
--without-selectorflag - Have pre-existing labels in the kustomization.yaml (see above)
What did you expect to happen?
The labels should be added like so:
labels:
- pairs:
test1: a
test2: bHow can we reproduce it (as minimally and precisely as possible)?
# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml# resources.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: test-object
data:
placeholder: dataYou can omit resources.yaml the error happens on an empty kustomization file too.
Expected output
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- resources.yaml
labels:
- pairs:
test1: a
test2: bActual output
Error: label test2 already in kustomization file. Use --force to override.
Kustomize version
5.7.1
Operating system
Linux
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.