plugin-barman-cloud
plugin-barman-cloud copied to clipboard
feat(azure): support Azure workload identity via projected service account token
Summary
This PR adds Azure workload identity support for plugin-managed CNPG sidecars by projecting a service account token with the Azure audience into the sidecar pod when azureCredentials.useDefaultAzureCredentials: true is configured.
This keeps the existing AKS managed identity flow unchanged:
inheritFromAzureAD: truestill uses the managed identity / IMDS pathuseDefaultAzureCredentials: truenow supports workload identity by exposingAZURE_FEDERATED_TOKEN_FILEand the projected token toDefaultAzureCredential
Changes
- detect whether any referenced
ObjectStoreusesuseDefaultAzureCredentials - inject a projected service account token volume into the plugin sidecar pod
- set
AZURE_FEDERATED_TOKEN_FILEfor the sidecar - preserve existing user/webhook-provided Azure env vars
- add unit tests for:
- workload identity detection
- sidecar token volume/env injection
- preserving an existing
AZURE_FEDERATED_TOKEN_FILE
- update Azure object store docs to describe the workload identity path
Behavior
With this change:
-
useDefaultAzureCredentials: truethe plugin sidecar gets:- a projected token with audience
api://AzureADTokenExchange AZURE_FEDERATED_TOKEN_FILE=/var/run/secrets/azure/tokens/azure-identity-token
- a projected token with audience
-
inheritFromAzureAD: truebehavior is unchanged and no federated token volume is injected
This means clusters using the older implicit AKS managed identity flow remain supported, while clusters using Azure workload identity can now work without relying on an external injector to provide the token file.