Repository navigation
Conversation
The AKS workload identity webhook injects AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_FEDERATED_TOKEN_FILE and the token volume, and the Azure SDK falls back to them when the options are empty, but the function still required the azure-creds Secret to exist. It is now optional for identity.type AzureWorkloadIdentityCredentials and the README describes the Secret, its keys and the DeploymentRuntimeConfig as the webhook leaves them. Signed-off-by: Youssef Omar Bouden <youssef.bouden2002@gmail.com>
| "federatedTokenFile": "/var/run/secrets/azure/tokens/azure-identity-token" | ||
| "clientId": "your-client-id", # optional, defaults to AZURE_CLIENT_ID | ||
| "tenantId": "your-tenant-id", # optional, defaults to AZURE_TENANT_ID | ||
| "federatedTokenFile": "/var/run/secrets/azure/tokens/azure-identity-token" # optional, defaults to AZURE_FEDERATED_TOKEN_FILE |
There was a problem hiding this comment.
Now that the DRC no longer mounts /var/run/secrets/azure/tokens, this federatedTokenFile only resolves on webhook versions before v1.6.0 (which moved the token), and a set key overrides AZURE_FEDERATED_TOKEN_FILE.
Please drop this line and the trailing comma on tenantId.
Optional, since it predates this PR: the # notes make the JSON invalid, so moving them out of the block would make it copy-pasteable.
| }, | ||
| }, | ||
| }, | ||
| "AzureWorkloadIdentityCredentialsWithoutSecret": { |
There was a problem hiding this comment.
This case doesn't reach the identity provider: MockGraphQuery ignores the creds and returns that error text itself, so the nil-creds AZURE_* fallback in initializeWorkloadIdentityProvider is untested.
Could you add a direct test: t.Setenv AZURE_CLIENT_ID, AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE, call (&GraphQuery{}).initializeWorkloadIdentityProvider(nil) and expect no error?
|
hello @blacksoxx,
|
Description of your changes
With workload identity the AKS webhook injects
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_FEDERATED_TOKEN_FILEand the projected token volume into any pod that carries theazure.workload.identity/uselabel and runs with an annotated service account, andazidentity.NewWorkloadIdentityCredentialfalls back to those variables when its options are empty. The function already passed empty options when the keys were absent, but it still required theazure-credsSecret to be present, and the README told users to setfederatedTokenFileand to mount the token volume themselves.getCredsnow treats the Secret as optional whenidentity.typeisAzureWorkloadIdentityCredentials; it stays required for service principal credentials, where nothing else can supply the secret. The README marks the Secret and its keys as optional with their environment variable defaults, and the DeploymentRuntimeConfig example is reduced to the label and the service account annotation the webhook needs.Fixes #117
I have:
TestIdentityTypegains a workload identity case without any credentials, which now reaches the identity provider instead of failing on the missing Secret (onmainit fails withfailed to get azure-creds credentials), and a service principal case without credentials that pins the unchanged fatal.go test ./...and the repository's golangci-lint configuration are clean; the input type did not change, so nothing was regenerated. Not run on an AKS cluster.