Skip to content

Conversation

tvoran
Copy link
Member

@tvoran tvoran commented Oct 2, 2024

Caches HVS dynamic secrets (values and TTL/expiration info) for each HCPVaultSecretsApp in a k8s secret in the operator's namespace. This way dynamic secrets aren't fetched from the HVS API before the renewalPercent of their TTL (since each dynamic secret fetch from the HVS API creates and returns a new set of dynamic credentials, which would trigger rollout-restart, etc.).

The cache secret is named with a common prefix (vso-hvs) and a hash of the HCPVaultSecretsApp namespace and name, and has these labels and data layout:

apiVersion: v1
data:
  <dynamic secret name>: <dynamic secret response from HVS>
  <dynamic secret name>: <dynamic secret response from HVS>
  vso-messageMAC: <HMAC of all the dynamic secrets>
kind: Secret
immutable: true
metadata:
  labels:
    app.kubernetes.io/component: hvs-dynamic-secret-cache
    app.kubernetes.io/managed-by: hashicorp-vso
    app.kubernetes.io/name: vault-secrets-operator
    hcpvaultsecretsapps.secrets.hashicorp.com/hvs-app-name: sample-app
    hcpvaultsecretsapps.secrets.hashicorp.com/name: myapp
    hcpvaultsecretsapps.secrets.hashicorp.com/namespace: default
    secrets.hashicorp.com/vso-ownerRefUID: c66776d8-c547-4183-bf77-3c0e70768712
  name: vso-hvs-e1859a3957fcac8cd9f511
  namespace: vault-secrets-operator-system
type: Opaque

Caches HVS dynamic secrets (values and TTL/expiration info) for each
HCPVaultSecretsApp in a k8s secret in the operator's namespace, so
that dynamic secrets aren't fetched/created from the HVS API before
the renewalPercent of their TTL.
@tvoran tvoran added this to the v0.9.0 milestone Oct 2, 2024
@tvoran tvoran marked this pull request as ready for review October 2, 2024 07:19
@tvoran tvoran requested a review from a team as a code owner October 2, 2024 07:19
Copy link
Collaborator

@benashz benashz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really good!

@tvoran
Copy link
Member Author

tvoran commented Oct 7, 2024

Agree on the extra unit tests and periodic cleanup task, will work on those in a separate PR.

@tvoran tvoran requested a review from benashz October 7, 2024 06:46
Copy link
Collaborator

@benashz benashz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tvoran
Copy link
Member Author

tvoran commented Oct 7, 2024

Thanks!

@tvoran tvoran merged commit 0b17a0b into main Oct 7, 2024
43 checks passed
@tvoran tvoran deleted the VAULT-30921/hvs-dynamic-secrets-shadow branch October 7, 2024 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants