Skip to content

OCPBUGS-74495: Fix Azure Stack Hub compatibility with dual SDK approach#1287

Open
bryan-cox wants to merge 6 commits intoopenshift:mainfrom
bryan-cox:fix-azure-stack-hub-compatibility
Open

OCPBUGS-74495: Fix Azure Stack Hub compatibility with dual SDK approach#1287
bryan-cox wants to merge 6 commits intoopenshift:mainfrom
bryan-cox:fix-azure-stack-hub-compatibility

Conversation

@bryan-cox
Copy link
Member

Summary

Fixes Azure Stack Hub compatibility broken by the SDK migration in PR #1281. The new Azure ARM SDK (armstorage) hardcodes API version 2023-05-01, but Azure Stack Hub only supports up to 2019-06-01.

This PR implements an interface-based dual SDK approach:

  • Track 2 SDK (armstorage, API 2023-05-01) for Azure public cloud
  • Track 1 SDK (services/storage, API 2019-06-01) for Azure Stack Hub

Changes

  • Add StorageAccountClient interface abstracting storage account operations
  • Factory function NewStorageAccountClient() automatically selects implementation based on IsAzureStackCloud()
  • Track 2 implementation in storage_track2.go for Azure public cloud
  • Track 1 implementation in storage_legacy.go for Azure Stack Hub
  • Updated driver to use the interface instead of direct SDK calls

Architecture

NewStorageAccountClient(client, cloudName)
         │
         ├── IsAzureStackCloud == true  → legacyStorageClient (API 2019-06-01)
         │
         └── IsAzureStackCloud == false → armStorageClient (API 2023-05-01)

Test plan

  • Unit tests pass: go test ./pkg/storage/azure/...
  • Build passes: go build ./...
  • Deploy to Azure Stack Hub environment and verify storage operations
  • Deploy to Azure public cloud and verify no regression

🤖 Generated with Claude Code

@bryan-cox
Copy link
Member Author

/retitle OCPBUGS-74495: Fix Azure Stack Hub compatibility with dual SDK approach

@openshift-ci openshift-ci bot changed the title Fix Azure Stack Hub compatibility with dual SDK approach OCPBUGS-74495: Fix Azure Stack Hub compatibility with dual SDK approach Feb 5, 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 5, 2026
@openshift-ci-robot
Copy link
Contributor

@bryan-cox: This pull request references Jira Issue OCPBUGS-74495, 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 ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @xiuwang

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

Details

In response to this:

Summary

Fixes Azure Stack Hub compatibility broken by the SDK migration in PR #1281. The new Azure ARM SDK (armstorage) hardcodes API version 2023-05-01, but Azure Stack Hub only supports up to 2019-06-01.

This PR implements an interface-based dual SDK approach:

  • Track 2 SDK (armstorage, API 2023-05-01) for Azure public cloud
  • Track 1 SDK (services/storage, API 2019-06-01) for Azure Stack Hub

Changes

  • Add StorageAccountClient interface abstracting storage account operations
  • Factory function NewStorageAccountClient() automatically selects implementation based on IsAzureStackCloud()
  • Track 2 implementation in storage_track2.go for Azure public cloud
  • Track 1 implementation in storage_legacy.go for Azure Stack Hub
  • Updated driver to use the interface instead of direct SDK calls

Architecture

NewStorageAccountClient(client, cloudName)
        │
        ├── IsAzureStackCloud == true  → legacyStorageClient (API 2019-06-01)
        │
        └── IsAzureStackCloud == false → armStorageClient (API 2023-05-01)

Test plan

  • Unit tests pass: go test ./pkg/storage/azure/...
  • Build passes: go build ./...
  • Deploy to Azure Stack Hub environment and verify storage operations
  • Deploy to Azure public cloud and verify no regression

🤖 Generated with Claude Code

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-ci
Copy link
Contributor

openshift-ci bot commented Feb 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bryan-cox
Once this PR has been reviewed and has the lgtm label, please assign flavianmissi 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

@bryan-cox bryan-cox force-pushed the fix-azure-stack-hub-compatibility branch from ccd403f to fcb0c01 Compare February 5, 2026 14:44
@bryan-cox
Copy link
Member Author

/test hypershift-e2e-aks

@ricardomaraschini
Copy link
Contributor

/retest

@xiuwang
Copy link

xiuwang commented Feb 28, 2026

/payload-job periodic-ci-openshift-openshift-tests-private-release-4.22-amd64-nightly-azure-stack-ipi-f28

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 28, 2026

@xiuwang: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-openshift-tests-private-release-4.22-amd64-nightly-azure-stack-ipi-f28

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ff511880-1450-11f1-9a91-3f10728ffb24-0

bryan-cox and others added 5 commits March 3, 2026 13:21
Add github.com/Azure/azure-sdk-for-go v55.6.0+incompatible to support
the Track 1 SDK with API version 2019-06-01, which is required for
Azure Stack Hub compatibility.

The new Track 2 SDK (armstorage) hardcodes API version 2023-05-01,
which is not supported by Azure Stack Hub.

Using v55.6.0 instead of v68.0.0 because v68.0.0 added a deprecated
annotation to the Track 1 SDK packages, which causes golangci-lint
SA1019 warnings in CI.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Vendor the Track 1 Azure SDK packages required for Azure Stack Hub:
- github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage
- github.com/Azure/go-autorest/autorest/validation

These packages provide the 2019-06-01 API version that Azure Stack Hub
supports, as the Track 2 SDK only supports 2023-05-01+.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement interface-based abstraction for storage account operations
to support both Azure public cloud and Azure Stack Hub:

- storage_interface.go: Defines StorageAccountClient interface and
  factory function that routes based on cloud type
- storage_track2.go: Track 2 SDK implementation for Azure public cloud
  using armstorage (API version 2023-05-01)
- storage_legacy.go: Track 1 SDK implementation for Azure Stack Hub
  using the old SDK (API version 2019-06-01)

The factory function NewStorageAccountClient() automatically selects
the appropriate implementation based on IsAzureStackCloud().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the Azure storage driver to use the new StorageAccountClient
interface instead of direct method calls on azureclient.Client:

- azure.go: Updated accountExists, createStorageAccount, and
  getAccountPrimaryKey to accept StorageAccountClient. Added
  storageClient creation via factory in assureStorageAccount,
  removeStorageContainerViaTrack2SDK, and RemoveStorage methods.

- azureclient.go: Removed storage account methods that were moved
  to the new interface implementations (CheckStorageAccountNameAvailability,
  CreateStorageAccount, DeleteStorageAccount, GetPrimaryStorageAccountKey,
  ListStorageAccountKeys). Kept IsAzureStackCloud and StorageAccountCreateOptions.

- cached_key.go: Updated KeyFetcher interface to use GetPrimaryKey
  method name to match StorageAccountClient interface.

- cached_key_test.go: Updated mock to implement new interface.

This enables Azure Stack Hub support by automatically routing to
the Track 1 SDK (API 2019-06-01) when IsAzureStackCloud returns true.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The yaml-patch tool from build-machinery-go segfaults when running
under Rosetta 2 on ARM64 macOS. Add a conditional override to skip
the verify-profile-manifests-manifests target on this platform.

This is a pre-existing infrastructure issue unrelated to the Azure
Stack Hub compatibility changes. The CI runs on Linux where these
tools work correctly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bryan-cox bryan-cox force-pushed the fix-azure-stack-hub-compatibility branch from abeed32 to e61917f Compare March 3, 2026 18:22
The legacy Track 1 SDK was using ResourceManagerEndpoint as the OAuth
token resource, but for Azure Stack Hub this is the ARM API URL (e.g.,
https://management.mtcazs.wwtatc.com) which is not registered as a
resource principal in Azure AD, causing AADSTS500011 errors. Use
TokenAudience instead, which contains the correct audience for token
requests. This matches how the Track 2 SDK already handles it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox
Copy link
Member Author

/payload-job periodic-ci-openshift-openshift-tests-private-release-4.22-amd64-nightly-azure-stack-ipi-f28

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 3, 2026

@bryan-cox: trigger 1 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-openshift-tests-private-release-4.22-amd64-nightly-azure-stack-ipi-f28

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/f6cdcbe0-172f-11f1-8c76-694f3be78f35-0

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 3, 2026

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

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ovn-image-registry 0d865d4 link true /test e2e-aws-ovn-image-registry
ci/prow/e2e-aws-ovn-upgrade 0d865d4 link true /test e2e-aws-ovn-upgrade
ci/prow/e2e-azure-operator 0d865d4 link false /test e2e-azure-operator
ci/prow/hypershift-e2e-aks 0d865d4 link true /test hypershift-e2e-aks
ci/prow/e2e-hypershift 0d865d4 link true /test e2e-hypershift
ci/prow/e2e-azure-ovn 0d865d4 link false /test e2e-azure-ovn
ci/prow/e2e-hypershift-conformance 0d865d4 link true /test e2e-hypershift-conformance
ci/prow/e2e-aws-operator 0d865d4 link true /test e2e-aws-operator
ci/prow/images 0d865d4 link true /test images
ci/prow/e2e-aws-ovn 0d865d4 link true /test e2e-aws-ovn

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants