-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
env.valueFrom.secretKeyRef.name
not changed in overlay when using namePrefix
#1563
Comments
This is a dup and has been fixed with kustomize 3.2.0 $HOME/go/bin/kustomize.3.2.0 build staging/overlay/ apiVersion: v1
data:
key: dmFsdWU=
kind: Secret
metadata:
name: overlay-staging-mysecret-7m4thk7c67
type: Opaque
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: overlay-staging-another-deployment
spec:
template:
spec:
containers:
- env:
- name: MY_SECRET_KEY
valueFrom:
secretKeyRef:
key: key
name: overlay-staging-mysecret-7m4thk7c67
image: another-test
name: another-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: overlay-staging-deployment
spec:
template:
spec:
containers:
- env:
- name: MY_SECRET_KEY
valueFrom:
secretKeyRef:
key: key
name: overlay-staging-mysecret-7m4thk7c67
image: test
name: test $HOME/go/bin/kustomize.3.1.0 build staging/overlay/ apiVersion: v1
data:
key: dmFsdWU=
kind: Secret
metadata:
name: overlay-staging-mysecret-7m4thk7c67
type: Opaque
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: overlay-staging-another-deployment
spec:
template:
spec:
containers:
- env:
- name: MY_SECRET_KEY
valueFrom:
secretKeyRef:
key: key
name: mysecret
image: another-test
name: another-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: overlay-staging-deployment
spec:
template:
spec:
containers:
- env:
- name: MY_SECRET_KEY
valueFrom:
secretKeyRef:
key: key
name: overlay-staging-mysecret-7m4thk7c67
image: test
name: test |
Indeed, 3.2.0 fixes it, thanks |
I'm using kubectl with kustomize version v4.5.7 and seeing this issue. The namePrefix is applied to other secrets that use kustomize output:
kubectl and kustomize versions
Update: This bug is being tracked at #5047 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The issue
Hi,
Given the following structure:
When running
kustomize build
in theoverlay
directory, theenv.valueFrom.secretKeyRef.name
of the Deploymentanother_deployment_added_by_staging_base
is not properly updated to the name automatically generated by kustomize for this secret.I was able to identify the issue is caused by my use of
namePrefix
in bothstaging/base
andstaging/overlay
. That is, I usenamePrefix: staging
andnamePrefix: overlay
respectively instaging/base/kustomization.yaml
andstaging/overlay/kustomization.yaml
When removing the
namePrefix:
fromstaging/base/kustomization.yaml
, the issue disappears.Output of the issue
Reproducing
You can reproduce the issue by cloning the following repository: https://github.com/huguesalary/kustomize-issue-1563
Otherwise, here are the files to reproduce the issue.
base/deployment.yaml
base/kustomization.yaml
staging/base/another_deployment_added_by_staging_base.yaml
staging/base/kustomization.yaml
staging/overlay/kustomization.yaml
The text was updated successfully, but these errors were encountered: