Skip to content

Conversation

@hypershift-jira-solve-ci
Copy link

What this PR does / why we need it:

This PR adds the TelemetryOptions.ApplicationID to Azure SDK client options when the Control Plane Operator (CPO) creates Azure ARM SDK clients. This ensures Azure API requests from the CPO include proper application identification ("hypershift-cpo") in the User-Agent header for request tracing and telemetry purposes.

Changes:

  1. support/azureutil/azureutil.go:

    • Added CPOUserAgent constant for application identification
    • Added NewARMClientOptions helper function that creates Azure ARM client options with proper cloud configuration and telemetry settings
    • Updated GetVnetInfoFromVnetID, GetNetworkSecurityGroupInfo, and GetResourceGroupInfo functions to accept a cloudName parameter and use proper telemetry options
  2. control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:

    • Updated validateAzureKMSConfig to include telemetry options when creating the Azure Key Vault keys client
    • Updated verifyResourceGroupLocationsMatch to pass the cloud name to the updated azureutil functions
  3. support/azureutil/azureutil_test.go:

    • Added unit tests for the new NewARMClientOptions function

Which issue(s) this PR fixes:

Fixes OCPBUGS-74498

Special notes for your reviewer:

  • The ApplicationID has a 24-character limit in the Azure SDK, so "hypershift-cpo" (14 chars) was chosen to be concise yet descriptive
  • The telemetry options include both the cloud configuration (for proper endpoint selection) and the ApplicationID (for request attribution)
  • This change is backward compatible - existing behavior is preserved, just with added telemetry

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira-solve OCPBUGS-74498 origin --ci

Always review AI generated responses prior to use.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 2, 2026
@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels Feb 2, 2026
@openshift-ci-robot
Copy link

@hypershift-jira-solve-ci[bot]: This pull request references Jira Issue OCPBUGS-74498, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.22.0) matches configured target version for branch (4.22.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @wewang58

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

This PR adds the TelemetryOptions.ApplicationID to Azure SDK client options when the Control Plane Operator (CPO) creates Azure ARM SDK clients. This ensures Azure API requests from the CPO include proper application identification ("hypershift-cpo") in the User-Agent header for request tracing and telemetry purposes.

Changes:

  1. support/azureutil/azureutil.go:
  • Added CPOUserAgent constant for application identification
  • Added NewARMClientOptions helper function that creates Azure ARM client options with proper cloud configuration and telemetry settings
  • Updated GetVnetInfoFromVnetID, GetNetworkSecurityGroupInfo, and GetResourceGroupInfo functions to accept a cloudName parameter and use proper telemetry options
  1. control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:
  • Updated validateAzureKMSConfig to include telemetry options when creating the Azure Key Vault keys client
  • Updated verifyResourceGroupLocationsMatch to pass the cloud name to the updated azureutil functions
  1. support/azureutil/azureutil_test.go:
  • Added unit tests for the new NewARMClientOptions function

Which issue(s) this PR fixes:

Fixes OCPBUGS-74498

Special notes for your reviewer:

  • The ApplicationID has a 24-character limit in the Azure SDK, so "hypershift-cpo" (14 chars) was chosen to be concise yet descriptive
  • The telemetry options include both the cloud configuration (for proper endpoint selection) and the ApplicationID (for request attribution)
  • This change is backward compatible - existing behavior is preserved, just with added telemetry

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira-solve OCPBUGS-74498 origin --ci

Always review AI generated responses prior to use.

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 2, 2026

Walkthrough

Added cloud-aware Azure ARM client options and telemetry to Key Vault KMS client construction and resource validation. Extended Azure utility functions to accept a cloudName and create ARM clients with cloud-specific options. Added a unit test for the new ARM client options behavior.

Changes

Cohort / File(s) Summary
Controller: KMS & validation
control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go
Passes cloud-aware arm.ClientOptions (including TelemetryOptions) when creating the Azure Key Vault keys client; threads cloudName and cached credentials into resource-group/location verification logic and passes cloudName to resource lookups.
Azure utilities
support/azureutil/azureutil.go
Introduces NewARMClientOptions(cloud.Configuration) *arm.ClientOptions and CPOUserAgent constant. Updates client-creation sites to use NewARMClientOptions and changes signatures to accept cloudName for: GetVnetInfoFromVnetID, getFullVnetInfo, GetNetworkSecurityGroupInfo, and GetResourceGroupInfo.
Tests
support/azureutil/azureutil_test.go
Adds TestNewARMClientOptions verifying NewARMClientOptions sets cloud host and telemetry ApplicationID for AzurePublic, AzureGovernment, and AzureChina configurations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@hypershift-jira-solve-ci
Copy link
Author

/auto-cc

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

Hi @hypershift-jira-solve-ci[bot]. Thanks for your PR.

I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@openshift-ci openshift-ci bot added the area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release label Feb 2, 2026
@openshift-ci openshift-ci bot requested review from enxebre and sjenning February 2, 2026 12:49
@openshift-ci openshift-ci bot added area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release and removed do-not-merge/needs-area labels Feb 2, 2026
vaultURL := fmt.Sprintf("https://%s.%s", azureKmsSpec.ActiveKey.KeyVaultName, azureKeyVaultDNSSuffix)
keysClient, err := azkeys.NewClient(vaultURL, cred, nil)
keysClient, err := azkeys.NewClient(vaultURL, cred, &azkeys.ClientOptions{
Copy link
Member

Choose a reason for hiding this comment

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

Why not use NewARMClientOptions here for the clientOptions?

Copy link
Author

Choose a reason for hiding this comment

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

Good question! The NewARMClientOptions function returns *arm.ClientOptions, which is specifically designed for Azure Resource Manager (ARM) clients like armnetwork, armresources, etc.

However, azkeys.NewClient expects *azkeys.ClientOptions, which is a different type - it's for Key Vault clients rather than ARM clients. While both types embed azcore.ClientOptions, they are distinct and not interchangeable:

  • arm.ClientOptions → for ARM SDK clients (armnetwork.NewVirtualNetworksClient, etc.)
  • azkeys.ClientOptions → for Key Vault SDK clients (azkeys.NewClient)

The common configuration (cloud config and telemetry) is the same between them, but the container types differ.

I could create a similar helper function like NewKeyVaultClientOptions(cloudConfig) in the azureutil package to provide the same consistent pattern - would that be preferred? Alternatively, we could create a lower-level helper that returns azcore.ClientOptions which both ARM and KeyVault client options could embed.


AI-assisted response via Claude Code

Copy link
Member

Choose a reason for hiding this comment

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

Oh no that's ok. I missed that part. No changes requested.

Copy link
Author

Choose a reason for hiding this comment

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

Great, thanks for confirming! 👍


AI-assisted response via Claude Code

@bryan-cox
Copy link
Member

/assign @bryan-cox

@bryan-cox
Copy link
Member

/ok-to-test
/test verify
/test unit

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 2, 2026
@celebdor celebdor marked this pull request as ready for review February 2, 2026 16:31
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 2, 2026
@celebdor
Copy link
Collaborator

celebdor commented Feb 2, 2026

/cherry-pick release-4.21
/cherry-pick release-4.20

@openshift-cherrypick-robot

@celebdor: once the present PR merges, I will cherry-pick it on top of release-4.20, release-4.21 in new PRs and assign them to you.

Details

In response to this:

/cherry-pick release-4.21
/cherry-pick release-4.20

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.

@openshift-ci openshift-ci bot requested review from jparrill and muraee February 2, 2026 16:35
@bryan-cox
Copy link
Member

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, hypershift-jira-solve-ci[bot]

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 2, 2026
@bryan-cox
Copy link
Member

/retest

1 similar comment
@bryan-cox
Copy link
Member

/retest

@bryan-cox
Copy link
Member

hypershift-jira-solve-ci - rebase the PR to fix the konflux issues

OpenShift CI Bot and others added 2 commits February 6, 2026 20:04
The Control Plane Operator (CPO) was not setting the UserAgent in the
Azure SDK TelemetryOptions when creating Azure ARM SDK clients. This
meant Azure API requests from CPO did not include proper application
identification for request tracing and telemetry purposes.

This commit adds:
- CPOUserAgent constant ("hypershift-cpo") for application identification
- NewARMClientOptions helper function that creates Azure ARM client options
  with proper cloud configuration and TelemetryOptions.ApplicationID set
- Updated GetVnetInfoFromVnetID, GetNetworkSecurityGroupInfo, and
  GetResourceGroupInfo functions to accept a cloudName parameter and use
  the new helper function for proper telemetry configuration
- Unit tests for the new NewARMClientOptions function

The ApplicationID is added to the User-Agent header of all Azure API
requests, enabling proper attribution of CPO requests in Azure
telemetry and monitoring.

Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
Update the validateAzureKMSConfig function to include TelemetryOptions
with CPOUserAgent when creating the Azure Key Vault keys client. This
ensures that requests to Azure Key Vault from the CPO include the
"hypershift-cpo" application identifier in the User-Agent header.

Also updates calls to GetVnetInfoFromVnetID, GetNetworkSecurityGroupInfo,
and GetResourceGroupInfo in verifyResourceGroupLocationsMatch to pass
the cloud name parameter as required by the updated function signatures.

Co-Authored-By: Claude (claude-opus-4-5) <noreply@anthropic.com>
@hypershift-jira-solve-ci
Copy link
Author

@bryan-cox Done. Rebased the PR onto the latest main (was 199 commits behind). The branch is now up to date — both commits (fd6dcef07 and c279efc41) replay cleanly with no conflicts. Konflux CI should pick up the updated base.


AI-assisted response via Claude Code

@hypershift-jira-solve-ci
Copy link
Author

Done. Rebased onto the latest main (now at 12a6c6ca4) to pick up the latest Konflux pipeline changes. No conflicts.


AI-assisted response via Claude Code

@bryan-cox
Copy link
Member

hypershift-jira-solve-ci - the unit tests are failing. You need to fix this.

@bryan-cox
Copy link
Member

/test review-agent-single-pr

@hypershift-jira-solve-ci
Copy link
Author

@bryan-cox I investigated the unit test failure. The failing test is TestSeekOverride/if_registry_override_partial_coincidence_is_found,_and_using_ID in support/util/imagemetadata_test.go — this is not related to the changes in this PR.

This test connects to external registries (quay.io) to verify image reference overrides and fails intermittently due to network conditions in CI. It passes locally and is a pre-existing flaky test.

The files changed by this PR (support/azureutil/azureutil.go, support/azureutil/azureutil_test.go, and control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go) all compile and pass their unit tests successfully.

A /retest should resolve the CI failure.


AI-assisted response via Claude Code

@bryan-cox
Copy link
Member

/test unit

Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

/lgtm

@bryan-cox
Copy link
Member

/verified later @wewang58

@openshift-ci-robot openshift-ci-robot added verified-later verified Signifies that the PR passed pre-merge verification criteria labels Feb 9, 2026
@openshift-ci-robot
Copy link

@bryan-cox: This PR has been marked to be verified later by @wewang58.

Details

In response to this:

/verified later @wewang58

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 openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox
Copy link
Member

/test verify-deps

@bryan-cox
Copy link
Member

/test all

@jparrill
Copy link
Contributor

jparrill commented Feb 9, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 9, 2026
@openshift-ci-robot
Copy link

Scheduling required tests:
/test verify-deps

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 9, 2026

@hypershift-jira-solve-ci[bot]: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

@openshift-merge-bot openshift-merge-bot bot merged commit 10c5108 into openshift:main Feb 9, 2026
14 checks passed
@openshift-ci-robot
Copy link

@hypershift-jira-solve-ci[bot]: Jira Issue OCPBUGS-74498: All pull requests linked via external trackers have merged:

This pull request has the verified-later tag and will need to be manually moved to VERIFIED after testing. Jira Issue OCPBUGS-74498 has been moved to the MODIFIED state.

Details

In response to this:

What this PR does / why we need it:

This PR adds the TelemetryOptions.ApplicationID to Azure SDK client options when the Control Plane Operator (CPO) creates Azure ARM SDK clients. This ensures Azure API requests from the CPO include proper application identification ("hypershift-cpo") in the User-Agent header for request tracing and telemetry purposes.

Changes:

  1. support/azureutil/azureutil.go:
  • Added CPOUserAgent constant for application identification
  • Added NewARMClientOptions helper function that creates Azure ARM client options with proper cloud configuration and telemetry settings
  • Updated GetVnetInfoFromVnetID, GetNetworkSecurityGroupInfo, and GetResourceGroupInfo functions to accept a cloudName parameter and use proper telemetry options
  1. control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller.go:
  • Updated validateAzureKMSConfig to include telemetry options when creating the Azure Key Vault keys client
  • Updated verifyResourceGroupLocationsMatch to pass the cloud name to the updated azureutil functions
  1. support/azureutil/azureutil_test.go:
  • Added unit tests for the new NewARMClientOptions function

Which issue(s) this PR fixes:

Fixes OCPBUGS-74498

Special notes for your reviewer:

  • The ApplicationID has a 24-character limit in the Azure SDK, so "hypershift-cpo" (14 chars) was chosen to be concise yet descriptive
  • The telemetry options include both the cloud configuration (for proper endpoint selection) and the ApplicationID (for request attribution)
  • This change is backward compatible - existing behavior is preserved, just with added telemetry

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

🤖 Generated with Claude Code via /jira-solve OCPBUGS-74498 origin --ci

Always review AI generated responses prior to use.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-cherrypick-robot

@celebdor: new pull request created: #7685

Details

In response to this:

/cherry-pick release-4.21
/cherry-pick release-4.20

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.

@openshift-cherrypick-robot

@celebdor: #7620 failed to apply on top of branch "release-4.20":

Applying: feat(support/azureutil): Add UserAgent telemetry for Azure ARM clients
Using index info to reconstruct a base tree...
M	support/azureutil/azureutil.go
M	support/azureutil/azureutil_test.go
Falling back to patching base and 3-way merge...
Auto-merging support/azureutil/azureutil_test.go
CONFLICT (content): Merge conflict in support/azureutil/azureutil_test.go
Auto-merging support/azureutil/azureutil.go
CONFLICT (content): Merge conflict in support/azureutil/azureutil.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 feat(support/azureutil): Add UserAgent telemetry for Azure ARM clients

Details

In response to this:

/cherry-pick release-4.21
/cherry-pick release-4.20

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.

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. area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. verified Signifies that the PR passed pre-merge verification criteria verified-later

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants