Skip to content

Populate a single kubernetes secret from multiple Vault secrets #923

Open
@fer1592

Description

@fer1592

Is your feature request related to a problem? Please describe.
Currently, for VaultStaticSecrets we can only specify a single secret in Vault as the source, which forces us to, weather create and mount many k8s secrets when we have those distributed in many Vault secrets, or to create secrets in Vault with a lot of key/values, that might be repeated across many more Vault secrets.

Also, there is another use case. We would like to remove read permissions to (human) users, and allow them to only create/update/delete secrets in the KV engines. However, by doing that, the UI won't show which are the existing keys in a secret when creating a new version, forcing users to re-enter each key/value for the new secret version. This could be solved by the new feature KV patch+subkey, however that seems to be just for the Enterprise edition, not the community one. So, another solution for this problem would be to allow VaultStaticSecrets to get data from multiple paths, and instruct our users to create secrets in Vault with a single key/value, where the key is a known word, or same as the secret name.

Describe the solution you'd like
It would be great if we could populate a single k8s secret with the values from different secrets in Vault.

Describe alternatives you've considered
The External Secrets project allows to specify different paths on the ExternalSecret for the vault provider. Eg:

---
apiVersion: external-secrets.io/v1beta1
kind: SecretStore
metadata:
  name: example-store
  namespace: example
spec:
  provider:
    vault:
      server: "https://vault.example.com"
      path: "kv-v2-example-secrets"
      version: "v2"
      auth:
        kubernetes:
          mountPath: "kubernetes"
          role: "kubernetes-service-account"
          serviceAccountRef:
            name: "example"
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
  name: example-external-secret
  namespace: example
spec:
  refreshInterval: "60s"
  secretStoreRef:
    name: example-store
    kind: SecretStore
  target:
    name: example-sync
  data:
  - secretKey: keyforsecret1
    remoteRef:
      key: testing/secret1
      property: secret1
  - secretKey: keyforsecret2
    remoteRef:
      key: testing/secret2
      property: secret2
# It creates the following secret
# apiVersion: v1
# kind: Secret
# metadata:
#   ...
#   name: example-sync
#   namespace: example
# data:
#   keyforsecret1: <b64 encoded value of testing/secret1 secret1>
#   keyforsecret2: <b64 encoded value of testing/secret2 secret2>
# immutable: false
# type: Opaque

Additional context
Although it's possible to use External Secrets, we would really like to have a similar feature in VSO, since not only External Secrets doesn't support DynamicSecrets, but also it will be one more tool to maintain.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions