fix: prefer AZURE_FEDERATED_TOKEN_FILE over hardcoded OIDC token path - #1281
Merged
jonasz-lasut merged 1 commit intoAug 4, 2026
Merged
Conversation
gravufo
requested review from
erhancagirici,
jastang,
jonasz-lasut,
sergenyalcin,
turkenf and
ulucinar
as code owners
August 4, 2026 01:22
oidcAuth() defaulted the OIDC token file path to a hardcoded constant matching the azure-workload-identity webhook's old mount location. The webhook moved that path in v1.6.0 (a documented breaking change) and now sets AZURE_FEDERATED_TOKEN_FILE to the current location instead. Read AZURE_FEDERATED_TOKEN_FILE when no explicit oidcTokenFilePath is set, falling back to the historical hardcoded default only if the env var is also unset, so the provider isn't tied to one specific webhook mount path. Fixes crossplane-contrib#1280 Signed-off-by: Christian Artin <gravufo@gmail.com>
gravufo
force-pushed
the
fix/oidc-token-file-path-env
branch
from
August 4, 2026 01:24
9c24697 to
710de15
Compare
jonasz-lasut
approved these changes
Aug 4, 2026
jonasz-lasut
left a comment
Collaborator
There was a problem hiding this comment.
Thank you @gravufo LGTM!
This was referenced Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
oidcAuth()hardcoded the OIDC token file path to/var/run/secrets/azure/tokens/azure-identity-tokenwheneveroidcTokenFilePathwas left unset on theProviderConfig/ClusterProviderConfig. That path is owned and versioned by the AKSazure-workload-identitywebhook, which moved it as a documented breaking change in v1.6.0:https://github.com/Azure/azure-workload-identity/releases/tag/v1.6.0
The webhook already sets
AZURE_FEDERATED_TOKEN_FILEin the container to wherever it actually projected the token. This change reads that env var when no explicitoidcTokenFilePathis configured, and only falls back to the historical hardcoded constant if the env var is also unset (preserving current behavior for anyone relying on it, e.g. clusters still on pre-v1.6.0 webhook builds).Precedence, in order:
spec.oidcTokenFilePathif explicitly set (unchanged, still wins).AZURE_FEDERATED_TOKEN_FILEenv var (new).Fixes #1280
I have:
make reviewableto ensure this PR is ready for review.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
Test_oidcAuth_tokenFilePathcovering all four precedence cases (explicit path wins over env, env used when no explicit path, falls back to default when env unset, falls back to default when env set but empty).go build,go vet,go test ./internal/clients/..., andgolangci-lint run internal/clients/...locally.All pass.
Note
I did this change with backward compatibility in mind. Personally, I would prefer entirely removing the hardcoded path, since it is not even correct anymore and just rely on the env var or the parameter.
Please let me know if you prefer I do that!