Skip to content

feat: make the credentials Secret optional for workload identity - #131

Open
blacksoxx wants to merge 1 commit into
upbound:mainfrom
blacksoxx:workload-identity-optional-credentials
Open

blacksoxx wants to merge 1 commit into
upbound:mainfrom
blacksoxx:workload-identity-optional-credentials

Conversation

@blacksoxx

Copy link
Copy Markdown

Description of your changes

With workload identity the AKS webhook injects AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_FEDERATED_TOKEN_FILE and the projected token volume into any pod that carries the azure.workload.identity/use label and runs with an annotated service account, and azidentity.NewWorkloadIdentityCredential falls back to those variables when its options are empty. The function already passed empty options when the keys were absent, but it still required the azure-creds Secret to be present, and the README told users to set federatedTokenFile and to mount the token volume themselves.

getCreds now treats the Secret as optional when identity.type is AzureWorkloadIdentityCredentials; 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:

TestIdentityType gains a workload identity case without any credentials, which now reaches the identity provider instead of failing on the missing Secret (on main it fails with failed 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.

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>
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.

Simplify Workload Identity configuration

1 participant