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

kustomize edit add configmap does not support specifying namespace #5366

Closed
stormqueen1990 opened this issue Oct 9, 2023 · 2 comments · Fixed by #5367
Closed

kustomize edit add configmap does not support specifying namespace #5366

stormqueen1990 opened this issue Oct 9, 2023 · 2 comments · Fixed by #5367
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@stormqueen1990
Copy link
Member

What happened?

When trying to create a configMapGenerator via kustomize edit add configmap, it is not possible to specify a namespace for that resource. Running the following command:

kustomize edit add configmap test-cm --namespace test-ns --from-literal=testkey=testvalue

will output

Error: unknown flag: --namespace

However, editing the kustomization file to add a namespace, like so:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- literals:
  - testkey=testvalue
  name: test-cm
  namespace: test-ns

then running kustomize build results in a ConfigMap configuration containing a namespace:

kustomize build .
apiVersion: v1
data:
  testkey: testvalue
kind: ConfigMap
metadata:
  name: test-cm-bgk86k8k5t
  namespace: test-ns

What did you expect to happen?

A namespace gets added to the configMapGenerator.

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

Just running

kustomize edit add configmap test-cm --namespace test-ns --from-literal=testkey=testvalue

will demonstrate the issue.

Expected output

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- literals:
  - testkey=test-value
  name: test-cm
  namespace: test-ns

Actual output

Error: unknown flag: --namespace

Kustomize version

v5.1.1

Operating system

MacOS

@stormqueen1990 stormqueen1990 added the kind/bug Categorizes issue or PR as related to a bug. label Oct 9, 2023
@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 9, 2023
@stormqueen1990
Copy link
Member Author

/assign

I've marked this as a bug since I believe --namespace should be available for code parity purposes with edit add secret.

@stormqueen1990 stormqueen1990 changed the title edit add configmap does not support specifying namespace kustomize edit add configmap does not support specifying namespace Oct 9, 2023
@natasha41575
Copy link
Contributor

/triage accepted

@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 Oct 10, 2023
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/accepted Indicates an issue or PR is ready to be actively worked on.
Development

Successfully merging a pull request may close this issue.

3 participants