Skip to content

fix: propagate SERVICE_ACCOUNT_ISSUER to workload cluster template#6302

Closed
andyzhangx wants to merge 1 commit into
kubernetes-sigs:release-1.23from
andyzhangx:fix-wi-issuer-propagation
Closed

fix: propagate SERVICE_ACCOUNT_ISSUER to workload cluster template#6302
andyzhangx wants to merge 1 commit into
kubernetes-sigs:release-1.23from
andyzhangx:fix-wi-issuer-propagation

Conversation

@andyzhangx
Copy link
Copy Markdown
Member

@andyzhangx andyzhangx commented May 12, 2026

What this PR does

kind-with-registry.sh creates an OIDC storage account and exports SERVICE_ACCOUNT_ISSUER, but this value is lost when create-workload-cluster runs envsubst in a separate Make recipe (each recipe line runs in its own shell).

The workload cluster template (#6288) has:

service-account-issuer: ${SERVICE_ACCOUNT_ISSUER:-https://kubernetes.default.svc.cluster.local}

Without propagation, the fallback https://kubernetes.default.svc.cluster.local is used. AAD cannot reach this URL for OIDC discovery, breaking Workload Identity on CAPZ workload clusters.

How it works

  1. kind-with-registry.sh: After resolving SERVICE_ACCOUNT_ISSUER (either BYO or auto-created), persist it to ${REPO_ROOT}/.service-account-issuer.env
  2. Makefile (create-workload-cluster): Source the .env file before running envsubst on the cluster template

Why this is needed

Downstream CSI driver E2E tests (e.g., blob-csi-driver) that test Workload Identity on CAPZ workload clusters fail because AAD returns AADSTS501661 — it cannot perform OIDC discovery against the cluster-internal kubernetes.default.svc.cluster.local URL.

Related: #6288

Release note:

none

kind-with-registry.sh creates an OIDC storage account and sets
SERVICE_ACCOUNT_ISSUER, but this value was lost when
create-workload-cluster runs envsubst in a separate shell context.

The workload cluster template has:
  service-account-issuer: ${SERVICE_ACCOUNT_ISSUER:-https://kubernetes.default.svc.cluster.local}

Without the propagation, the fallback value is used, which is
unreachable by AAD for OIDC discovery, breaking Workload Identity
on CAPZ workload clusters.

Fix: persist SERVICE_ACCOUNT_ISSUER to a .env file in
kind-with-registry.sh and source it in the create-workload-cluster
Makefile target before running envsubst.
@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 12, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign fabriziopandini for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.74%. Comparing base (eee3bfd) to head (ad5767d).
⚠️ Report is 1 commits behind head on release-1.23.

Additional details and impacted files
@@              Coverage Diff              @@
##           release-1.23    #6302   +/-   ##
=============================================
  Coverage         43.74%   43.74%           
=============================================
  Files               289      289           
  Lines             25475    25475           
=============================================
  Hits              11145    11145           
  Misses            13527    13527           
  Partials            803      803           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andyzhangx this looks good to me, but could you reopen it against main? Then we can cherry-pick it into the release-1.24 and release-1.23 branches.

@andyzhangx
Copy link
Copy Markdown
Member Author

addressed by #6306

@andyzhangx andyzhangx closed this May 13, 2026
@github-project-automation github-project-automation Bot moved this from Todo to Done in CAPZ Planning May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants