-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
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
MutatingWebhookConfigurationand webhookService(tied toSpiffeCSIDriverCR lifecycle) RELATED_IMAGE_SPIFFE_HELPERenv var for disconnected/air-gapped environments- RBAC for
mutatingwebhookconfigurations failurePolicy: Ignoreso pods still start if the webhook is down- Unit tests for webhook injection and controller reconciliation
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels