Skip to content

Conversation

@bryan-cox
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

The VMIdentityNone warning was incorrectly shown for clusters using WorkloadIdentity, UserAssignedMSI, or other non-Service Principal authentication methods. This caused confusing warnings about "Service Principal credentials being written to disk" when no such credentials exist.

This PR adds an isUsingSPCredentials helper to check the AzureClusterIdentity type before emitting the warning. Only ServicePrincipal, ManualServicePrincipal, and ServicePrincipalCertificate identity types now trigger the warning.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

The fix applies to all three azurejson controllers:

  • azurejson_machine_controller.go
  • azurejson_machinepool_controller.go
  • azurejson_machinetemplate_controller.go

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests
  • cherry-pick candidate

Release note:

Fix misleading Service Principal credential warning when using WorkloadIdentity or managed identity authentication. The warning about SP credentials being written to disk now only appears when actually using Service Principal identity types.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Dec 3, 2025
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 3, 2025
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 3, 2025
@bryan-cox
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-e2e-aks

@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.59%. Comparing base (e695d87) to head (51f5ec4).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
controllers/azurejson_machinepool_controller.go 0.00% 3 Missing ⚠️
controllers/azurejson_machine_controller.go 0.00% 0 Missing and 1 partial ⚠️
...ontrollers/azurejson_machinetemplate_controller.go 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5990      +/-   ##
==========================================
+ Coverage   44.54%   44.59%   +0.05%     
==========================================
  Files         279      279              
  Lines       25140    25166      +26     
==========================================
+ Hits        11199    11224      +25     
- Misses      13128    13129       +1     
  Partials      813      813              

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

…Service Principal

The VMIdentityNone warning was incorrectly shown for clusters using
WorkloadIdentity, UserAssignedMSI, or other non-SP authentication methods.
This caused confusing warnings about "Service Principal credentials being
written to disk" when no such credentials exist.

Add isUsingSPCredentials helper to check the AzureClusterIdentity type
before emitting the warning. Only ServicePrincipal, ManualServicePrincipal,
and ServicePrincipalCertificate identity types now trigger the warning.

Signed-off-by: Bryan Cox <[email protected]>
@bryan-cox
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-e2e-aks

@jackfrancis
Copy link
Contributor

/test ls

@k8s-ci-robot
Copy link
Contributor

@jackfrancis: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test pull-cluster-api-provider-azure-apiversion-upgrade
/test pull-cluster-api-provider-azure-build
/test pull-cluster-api-provider-azure-ci-entrypoint
/test pull-cluster-api-provider-azure-e2e
/test pull-cluster-api-provider-azure-e2e-aks
/test pull-cluster-api-provider-azure-e2e-workload-upgrade
/test pull-cluster-api-provider-azure-test
/test pull-cluster-api-provider-azure-verify

The following commands are available to trigger optional jobs:

/test pull-cluster-api-provider-azure-apidiff
/test pull-cluster-api-provider-azure-apiserver-ilb
/test pull-cluster-api-provider-azure-capi-e2e
/test pull-cluster-api-provider-azure-conformance
/test pull-cluster-api-provider-azure-conformance-azl3-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance-custom-builds
/test pull-cluster-api-provider-azure-conformance-dual-stack-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance-ipv6-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance-with-ci-artifacts
/test pull-cluster-api-provider-azure-conformance-with-ci-artifacts-dra
/test pull-cluster-api-provider-azure-dra-scalability
/test pull-cluster-api-provider-azure-e2e-optional
/test pull-cluster-api-provider-azure-e2e-windows
/test pull-cluster-api-provider-azure-load-test-1k-dra-with-workload-custom-builds
/test pull-cluster-api-provider-azure-load-test-custom-builds
/test pull-cluster-api-provider-azure-load-test-dra-custom-builds
/test pull-cluster-api-provider-azure-load-test-dra-with-workload-custom-builds
/test pull-cluster-api-provider-azure-perf-test-apiserver-availability
/test pull-cluster-api-provider-azure-windows-custom-builds
/test pull-cluster-api-provider-azure-windows-with-ci-artifacts

Use /test all to run the following jobs that were automatically triggered:

pull-cluster-api-provider-azure-apidiff
pull-cluster-api-provider-azure-build
pull-cluster-api-provider-azure-ci-entrypoint
pull-cluster-api-provider-azure-e2e
pull-cluster-api-provider-azure-e2e-aks
pull-cluster-api-provider-azure-test
pull-cluster-api-provider-azure-verify

In response to this:

/test ls

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jackfrancis
Copy link
Contributor

/test pull-cluster-api-provider-azure-e2e-optional
/test pull-cluster-api-provider-azure-e2e-workload-upgrade

Copy link
Contributor

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

/hold for tests

thank you @bryan-cox !

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 3, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 3, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0db8059d8dd0ef5fab0758be3ab93521c9bc2dea

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis

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

The pull request process is described here

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 3, 2025
@bryan-cox
Copy link
Contributor Author

/test pull-cluster-api-provider-azure-e2e-optional

@k8s-ci-robot
Copy link
Contributor

@bryan-cox: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-azure-e2e-optional 51f5ec4 link false /test pull-cluster-api-provider-azure-e2e-optional

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@jackfrancis
Copy link
Contributor

/hold cancel

test flakes are unrelated

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 3, 2025
@k8s-ci-robot k8s-ci-robot merged commit 856e605 into kubernetes-sigs:main Dec 4, 2025
23 of 24 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in CAPZ Planning Dec 4, 2025
@k8s-ci-robot k8s-ci-robot added this to the v1.22 milestone Dec 4, 2025
@bryan-cox bryan-cox deleted the update-sp-err-msg branch December 4, 2025 11:22
@chrischdi chrischdi mentioned this pull request Dec 8, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants