Problem
The SPIFFE CSI driver (csi.spiffe.io) only exposes the SPIRE Agent's Unix Domain Socket into pods. Applications that need on-disk certificate files (tls.crt, tls.key, ca.crt) — which is most non-SPIFFE-native software — currently require manually adding spiffe-helper init containers and sidecars to every deployment.
This is error-prone, boilerplate-heavy, and doesn't scale.
Proposed Solution
Add a MutatingAdmissionWebhook to the operator that automatically injects spiffe-helper containers into pods based on a pod annotation, eliminating manual sidecar configuration.
How it works
- User annotates a pod template with
spiffe.openshift.io/inject-helper: "true"
- The webhook intercepts Pod CREATE requests
- It injects: an init container (fetches initial SVID), a sidecar container (continuous rotation), the CSI volume, an emptyDir for certs, and a ConfigMap volume for helper config
- The main container reads certs from
/var/run/secrets/tls/
What gets injected
- Init container (
spiffe-helper-init): runs once to fetch initial certificates, then exits
- Sidecar container (
spiffe-helper): runs continuously for certificate rotation
- Volumes:
spiffe-workload-api (CSI), spiffe-certs (emptyDir), spiffe-helper-config (ConfigMap)
Optional annotations for customization
| Annotation |
Default |
Description |
spiffe.openshift.io/inject-helper |
— |
"true" to enable injection |
spiffe.openshift.io/cert-dir |
/var/run/secrets/tls |
Mount path for certs |
spiffe.openshift.io/helper-config |
spiffe-helper-config |
ConfigMap name |
Implementation scope
- Webhook handler implementing
admission.Handler
- Controller/reconciler managing the
MutatingWebhookConfiguration and webhook Service (tied to SpiffeCSIDriver CR lifecycle)
RELATED_IMAGE_SPIFFE_HELPER env var for disconnected/air-gapped environments
- RBAC for
mutatingwebhookconfigurations
failurePolicy: Ignore so pods still start if the webhook is down
- Unit tests for webhook injection and controller reconciliation
Problem
The SPIFFE CSI driver (
csi.spiffe.io) only exposes the SPIRE Agent's Unix Domain Socket into pods. Applications that need on-disk certificate files (tls.crt,tls.key,ca.crt) — which is most non-SPIFFE-native software — currently require manually addingspiffe-helperinit containers and sidecars to every deployment.This is error-prone, boilerplate-heavy, and doesn't scale.
Proposed Solution
Add a MutatingAdmissionWebhook to the operator that automatically injects
spiffe-helpercontainers into pods based on a pod annotation, eliminating manual sidecar configuration.How it works
spiffe.openshift.io/inject-helper: "true"/var/run/secrets/tls/What gets injected
spiffe-helper-init): runs once to fetch initial certificates, then exitsspiffe-helper): runs continuously for certificate rotationspiffe-workload-api(CSI),spiffe-certs(emptyDir),spiffe-helper-config(ConfigMap)Optional annotations for customization
spiffe.openshift.io/inject-helper"true"to enable injectionspiffe.openshift.io/cert-dir/var/run/secrets/tlsspiffe.openshift.io/helper-configspiffe-helper-configImplementation scope
admission.HandlerMutatingWebhookConfigurationand webhookService(tied toSpiffeCSIDriverCR lifecycle)RELATED_IMAGE_SPIFFE_HELPERenv var for disconnected/air-gapped environmentsmutatingwebhookconfigurationsfailurePolicy: Ignoreso pods still start if the webhook is down