-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Describe the bug
When importing Kubernetes secrets with use-name-as-prefix
, I would expect the prefix to be the name of the secret. This does not work when using a label selector with duplicate keys:
application.yaml
spring:
config:
import: "kubernetes:"
cloud:
kubernetes:
secrets:
enable-api: true
sources:
- labels:
load: "true"
use-name-as-prefix: true
k8s-secrets.yaml
---
apiVersion: v1
kind: Secret
metadata:
name: client-1
labels:
load: "true"
stringData:
client-id: client-1
client-secret: S3cr371!
---
apiVersion: v1
kind: Secret
metadata:
name: client-2
labels:
load: "true"
stringData:
client-id: client-2
client-secret: S3cr372!
will result in these properties:
client-1.client-2.client-secret: S3cr372!
client-1.client-2.client-id: client-2
Expected result:
client-1.client-secret: S3cr371!
client-1.client-id: client-1
client-2.client-secret: S3cr372!
client-2.client-id: client-2
Spring Cloud: 2023.0.3
Sample
I built an example application here: https://github.com/jnodorp-jaconi/spring-cloud-kubernetes-reproducer