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

How to deal with mounted volumes with the same filename. #315

Open
StephanePaulus opened this issue Jun 10, 2021 · 1 comment
Open

How to deal with mounted volumes with the same filename. #315

StephanePaulus opened this issue Jun 10, 2021 · 1 comment
Labels
status: next major version The issue will be considered for the next major version

Comments

@StephanePaulus
Copy link

As far as I know the current Micronaut-Kubernetes integration cannot deal with reading/parsing configmaps/secrets from mounted-volumes that have the same name.

Example:

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  username: YWRtaW4=
  password: MWYyZDFlMmU2N2Rm
apiVersion: v1
kind: Secret
metadata:
  name: mysecret2
type: Opaque
data:
  username: YWRtaW4=
  password: MWYyZDFlMmU2N2Rm
......
          volumeMounts:
            - name: secret1
              mountPath: "/etc/micronaut-sandbox/secret1"
              readOnly: true
            - name: secret2
              mountPath: "/etc/micronaut-sandbox/secret2"
              readOnly: true
      volumes:
        - name: secret1
          secret:
            secretName: mysecret
        - name: secret2
          secret:
            secretName: mysecret2
.....

I don't think there is a way to deal with this issue.

@Value("${username}") will just return the data of the last one parsed. The same goes for configmaps. A proposed fix could be to include the folder of the mountPath like @Value("${secret1.username}")

Another issue I have discover is that if the configmap or secret "key" starts with a numerical value it will also be ignored.

Example

apiVersion: v1
kind: Secret
metadata:
  name: mysecret
type: Opaque
data:
  8d26bd90-7f74-4a08-9fc4-5a5feb61331e : YWRtaW4=
  c07efbea-e85b-4026-90f9-55e40175b16f: MWYyZDFlMmU2N2Rm

@Value("${c07efbea-e85b-4026-90f9-55e40175b16f}") will work but @Value("${8d26bd90-7f74-4a08-9fc4-5a5feb61331e }") will not.

@pgressa pgressa added the status: next major version The issue will be considered for the next major version label Nov 15, 2021
@pgressa
Copy link
Contributor

pgressa commented Nov 15, 2021

While preparing for next major release, this issue should be discussed again since it will most probably require breaking change on how the secrets are processed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: next major version The issue will be considered for the next major version
Projects
None yet
Development

No branches or pull requests

2 participants