-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Configuring Secrets Priority in propertySources #1867
Comments
is this still about config server? I think it is, but it's not clear... can you please make that explicit? thank you |
Sure, I have my Spring Cloud Kubernetes Config Server running in a k8s cluster on port 8888 with the following setup:
When I try to access secrets using the following curl --location 'http://localhost:8888/ab-service/ab-service,secrets' I get the following API response: "propertySources": [
{
"name": "vault:application",
"source": {
"TOKEN_A": "some_token_1",
"TOKEN_B": "${TOKEN_E}_some_token",
"TOKEN_C": "some_api_key"
}
},
{
"name": "secret:ab-service-secrets",
"source": {
"TOKEN_D": "some_token_2",
"TOKEN_E": "some_token_3"
}
}
] In this setup:
Since Kubernetes Secrets appear below Vault in the
In Vanilla Spring Cloud Config Server, we can explicitly define: spring:
cloud:
config:
server:
composite:
- type: vault
- type: git This setup ensures that Vault values are resolved first, allowing Git configurations to reference secrets from Vault. I have created this new issue as suggested by @ryanjbaxter here |
We will need to look into this. We might need to do some work to make something like this to work:
|
Yes, I can see we are using |
Hey @ryanjbaxter
This allows users to define Kubernetes as a composite type like: spring:
cloud:
config:
server:
composite:
- type: kubernetes
- type: vault Can you please take a look? P.S. Please ignore the weird commit msg :) |
In the current setup, Kubernetes Secrets appear at the bottom of the propertySources list in the API response.
Example response:
This ordering means that values from Kubernetes Secrets have lower precedence than other configuration sources. However, in many cases, it would be preferable for Kubernetes Secrets to take priority, allowing other configurations to resolve their values using Secrets.
Questions
Use Case
Having Kubernetes Secrets at the top of the list ensures that they override other configurations, making them the primary source of truth for sensitive values. This aligns with best practices for managing secrets in Kubernetes-based environments.
Looking forward to your insights on this!
The text was updated successfully, but these errors were encountered: