-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.
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
--force
flag - Omit the
--without-selector
flag - 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: b
How 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: data
You 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: b
Actual 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.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.Indicates an issue or PR lacks a `triage/foo` label and requires one.