Skip to content

feat(cluster-secret-store): GCP Secret Manager provider - #55

Merged
danielgines merged 2 commits into
mainfrom
feat/cluster-secret-store-gcpsm
Aug 25, 2026
Merged

danielgines merged 2 commits into
mainfrom
feat/cluster-secret-store-gcpsm

Conversation

@danielgines

Copy link
Copy Markdown
Member

Why

DigitalOcean has no managed secret store. Vault is the platform's intended one
and arrives at wave 6, but cert-manager needs its DNS-01 token at wave
2
— and with no store to read from, cert-manager-config falls to its other
branch and renders that token in cleartext onto an Application spec,
readable by anyone with Argo CD access.

That circle is why this exists: ExternalSecret needs a ClusterSecretStore → on
DigitalOcean the only one this chart could build was Vault-backed → Vault is
four waves later.

provider: gcpsm

provider here names the secret backend, not the cloud the cluster runs
on — the same way aws means Secrets Manager and azure means Key Vault. A
DigitalOcean cluster reading from Google sets gcpsm; that case is why the
value is not a cloud name.

Authentication

workloadIdentityFederation, not workloadIdentity. The latter is
GKE-only: it reads cluster metadata from the GCE metadata server, which a node
that is not Google's does not have. Federation is what ESO documents for "AKS,
EKS, self-hosted clusters, and OpenShift". No key is placed in the cluster — a
bound ServiceAccount token is exchanged for a short-lived Google one.

gcpServiceAccountEmail impersonates a Google service account after
federating, so reads are authorised by that account's bindings (typically
roles/secretmanager.secretAccessor scoped to a single secret) rather than on
the federated principal. One stable member to write IAM against, and the grant
survives the cluster being rebuilt. Optional — left empty, the federated
principal must hold the permission itself.

The two audiences are different values

This is the trap, so both are configurable and both are documented in the
template and in values.yaml:

field form what it is
gcpsm.audience //iam.googleapis.com/… the STS audience
gcpsm.serviceAccount.audiences https://iam.googleapis.com/… the aud of the projected Kubernetes token

Swapping them fails at the token exchange, not at render, and the resulting
error names neither field.

Also documented because it is not configurable here and refuses the exchange on
its own: the pool provider's attributeCondition must admit the
ServiceAccount's sub. That is Terraform's side, evaluated before IAM — a
workload missing from it is rejected while every binding it needs looks
correct.

Verified by rendering, not by reading

case result
no values at all azure, identical to before
provider=aws unchanged
provider=gcpsm the store, single and multi-store with per-entry overrides
gcpsm missing projectID fails naming the field
gcpsm missing audience fails naming the field
no gcpServiceAccountEmail field omitted, not rendered as ""
vault.enabled=true app-secret-store still renders alongside

helm lint passes.

The azure default is untouched — existing deployments render exactly as
before.

Not in this PR

platform-root still has to pass provider=gcpsm and the gcpsm.*
parameters on the DigitalOcean branch. That is a change to
estabilis-platform, and it lands separately.

DigitalOcean has no managed secret store. Vault is the platform's intended
one and arrives at wave 6, but cert-manager needs its DNS-01 token at wave
2 — and with no store to read from, the cert-manager-config chart falls to
its other branch and renders that token in cleartext onto an Application
spec, readable by anyone with Argo CD access. That is the circle this
breaks.

`provider: gcpsm` names the secret BACKEND, not the cloud the cluster runs
on — the same way `aws` here means Secrets Manager and `azure` means Key
Vault. A DigitalOcean cluster reading from Google sets `gcpsm`, and that
case is why the value is not a cloud name.

AUTHENTICATION

`workloadIdentityFederation`, not `workloadIdentity`. The latter is
GKE-only: it reads cluster metadata from the GCE metadata server, which a
node that is not Google's does not have. Federation is what ESO documents
for "AKS, EKS, self-hosted clusters, and OpenShift". No key is placed in
the cluster — ESO exchanges a bound ServiceAccount token for a short-lived
Google one.

`gcpServiceAccountEmail` impersonates a Google service account after
federating, so reads are authorised by THAT account's bindings — typically
roles/secretmanager.secretAccessor scoped to a single secret — rather than
on the federated principal. One stable member to write IAM against, and the
grant survives the cluster being rebuilt. Optional: left empty, the
federated principal must hold the permission itself.

THE TWO AUDIENCES ARE DIFFERENT VALUES

`gcpsm.audience` is the STS audience, `//iam.googleapis.com/...`.
`gcpsm.serviceAccount.audiences` is the `aud` the projected Kubernetes
token carries, which Google requires as `https://iam.googleapis.com/...`
when the pool provider sets no allowedAudiences. Both are configurable
because swapping them fails at the exchange, not at render, and the
resulting error names neither field. The template comment and values.yaml
both say so.

Also documented, because it is not configurable here and refuses the
exchange on its own: the pool provider's attributeCondition must admit the
ServiceAccount's `sub`. That is Terraform's side and it is evaluated before
IAM, so a workload missing from it is rejected while every binding it needs
looks correct.

VERIFIED BY RENDERING, not by reading

  default (no values)  → azure, byte-identical to before
  provider=aws         → unchanged
  provider=gcpsm       → the store above, single and multi-store
  missing projectID    → fails with the field name
  missing audience     → fails with the field name
  no gcpServiceAccountEmail → field omitted, not rendered as ""
  vault.enabled=true   → app-secret-store still renders alongside

helm lint passes.
`remoteRef.key` was the flat name `cloudflare-api-token`, which made the AWS
path silently wrong. platform-root has been passing
kvSecrets.cloudflareApiToken with the full Secrets Manager path since
v0.62.0; this template ignored it and looked up a name that only resolves
against Azure Key Vault, where names are flat.

Nothing errored. The ExternalSecret simply never resolved, which reads as a
cert-manager problem rather than a lookup pointed at the wrong key.

Same shape and same default cert-manager-config took in v0.42.11, so Azure
deployments render byte-identically.

  default              → "cloudflare-api-token"
  with kvSecrets       → "/estabilis/prd/platform-cloudflare-api-token"
@danielgines
danielgines merged commit d4ee3de into main Aug 25, 2026
5 checks passed
@danielgines
danielgines deleted the feat/cluster-secret-store-gcpsm branch August 25, 2026 00:59
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.

1 participant