Skip to content

OCPBUGS-85296: export Azure Metadata.Region for state file serialization - #10736

Open
savio87 wants to merge 1 commit into
openshift:mainfrom
savio87:OCPBUGS-85296
Open

OCPBUGS-85296: export Azure Metadata.Region for state file serialization#10736
savio87 wants to merge 1 commit into
openshift:mainfrom
savio87:OCPBUGS-85296

Conversation

@savio87

@savio87 savio87 commented Aug 3, 2026

Copy link
Copy Markdown

Summary

  • Fixes reentrant Azure IPI installs failing with an empty region during availability zone lookup
  • Exports the region field in Azure Metadata struct with a JSON tag so it persists in the state file

Fixes https://issues.redhat.com/browse/OCPBUGS-85296

Details

The Azure Metadata.region field was unexported (lowercase) with no JSON tag, so it was not serialized to .openshift_install_state.json. When resuming an interrupted install with OPENSHIFT_INSTALL_REENTRANT=true, the installer loaded InstallConfig from the state file but region came back empty. This caused VMAvailabilityZones() to query the Azure API with an empty location filter, failing with location information not found for Standard_D8s_v3 in .

The fix follows the same pattern used by AWS metadata, which already exports Region with a JSON tag.

Test plan

  • Code compiles successfully (go build ./pkg/asset/installconfig/azure/...)
  • Existing tests pass (go test ./pkg/asset/installconfig/azure/...)
  • Reentrant Azure IPI install no longer fails with empty region (requires Azure environment)

Summary by CodeRabbit

  • Improvements
    • Azure metadata now exposes the region field for broader compatibility.
    • Region-based availability zone and VM capability lookups continue to work consistently.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 3, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@savio87: This pull request references Jira Issue OCPBUGS-85296, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

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

Details

In response to this:

Summary

  • Fixes reentrant Azure IPI installs failing with an empty region during availability zone lookup
  • Exports the region field in Azure Metadata struct with a JSON tag so it persists in the state file

Fixes https://issues.redhat.com/browse/OCPBUGS-85296

Details

The Azure Metadata.region field was unexported (lowercase) with no JSON tag, so it was not serialized to .openshift_install_state.json. When resuming an interrupted install with OPENSHIFT_INSTALL_REENTRANT=true, the installer loaded InstallConfig from the state file but region came back empty. This caused VMAvailabilityZones() to query the Azure API with an empty location filter, failing with location information not found for Standard_D8s_v3 in .

The fix follows the same pattern used by AWS metadata, which already exports Region with a JSON tag.

Test plan

  • Code compiles successfully (go build ./pkg/asset/installconfig/azure/...)
  • Existing tests pass (go test ./pkg/asset/installconfig/azure/...)
  • Reentrant Azure IPI install no longer fails with empty region (requires Azure environment)

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

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi @savio87. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Changes

Azure metadata region handling

Layer / File(s) Summary
Export the region field and update lookups
pkg/asset/installconfig/azure/metadata.go
Metadata now exposes the JSON-tagged Region field. Construction, availability-zone lookups, and VM capability lookups use Region.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies exporting Azure Metadata.Region for state file serialization, which is the primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The PR changes only metadata.go; no test files or Ginkgo title calls were added or modified, so no unstable test names are present.
Test Structure And Quality ✅ Passed The commit changes only pkg/asset/installconfig/azure/metadata.go and adds no Ginkgo tests, cluster operations, waits, or assertions to review.
Microshift Test Compatibility ✅ Passed The PR changes only pkg/asset/installconfig/azure/metadata.go and adds no Ginkgo e2e tests, so MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The patch changes only Azure production metadata.go; it adds no Ginkgo e2e tests or multi-node assumptions requiring SNO review.
Topology-Aware Scheduling Compatibility ✅ Passed The pull request changes only Azure install-config metadata and region lookups; it adds no manifests, operators, controllers, replicas, affinity, selectors, tolerations, or other scheduling constra...
Ote Binary Stdout Contract ✅ Passed The PR changes only Azure metadata serialization and region lookups; the diff adds no main, suite setup, klog, log, or stdout writes, and no OTE suite is present outside vendored code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The pull request changes only pkg/asset/installconfig/azure/metadata.go; it adds no Ginkgo e2e tests or network-dependent test code.
No-Weak-Crypto ✅ Passed The PR only exports Azure Region and updates region lookups; the added code contains no weak crypto, custom crypto, or secret/token comparisons.
Container-Privileges ✅ Passed The PR changes only pkg/asset/installconfig/azure/metadata.go; it adds no container/Kubernetes manifest or privilege setting.
No-Sensitive-Data-In-Logs ✅ Passed The diff adds no logging or formatted output. It only serializes Azure Region and reuses it for API lookups; a cloud region is not sensitive data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci
openshift-ci Bot requested review from jhixson74 and sadasu August 3, 2026 06:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/asset/installconfig/azure/metadata.go (1)

25-25: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add a regression test for the persisted Region contract.

Because Region must survive reentrant installs, add or extend a unit test that marshals and unmarshals Metadata, then verifies the restored value reaches GetRegionAvailabilityZones, GetAvailabilityZones, defaultInstanceType, and GetVMCapabilities. The provided context does not include coverage for this cross-layer contract.

As per coding guidelines, all Go code under pkg/ must have unit tests.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/asset/installconfig/azure/metadata.go` at line 25, Add a regression unit
test for Metadata’s Region persistence by marshaling and unmarshaling a
populated Metadata value, then verify the restored region is used by
GetRegionAvailabilityZones, GetAvailabilityZones, defaultInstanceType, and
GetVMCapabilities. Keep the test focused on the reentrant-install contract and
ensure the relevant pkg/ code paths are covered.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/asset/installconfig/azure/metadata.go`:
- Line 25: Add a regression unit test for Metadata’s Region persistence by
marshaling and unmarshaling a populated Metadata value, then verify the restored
region is used by GetRegionAvailabilityZones, GetAvailabilityZones,
defaultInstanceType, and GetVMCapabilities. Keep the test focused on the
reentrant-install contract and ensure the relevant pkg/ code paths are covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 10826c24-a8b6-430b-8fc4-cb4a2b452297

📥 Commits

Reviewing files that changed from the base of the PR and between 5f2b0d3 and d5f1e00.

📒 Files selected for processing (1)
  • pkg/asset/installconfig/azure/metadata.go

@savio87

savio87 commented Aug 3, 2026

Copy link
Copy Markdown
Author

Note: The Jira bot flagged OCPBUGS-85296 as invalid because it doesn't have a target version set. I don't have permissions to update the target version on the Jira issue. Could a maintainer set the target version to 5.0.0 on OCPBUGS-85296? I can then comment /jira refresh to re-validate.

@jhixson74

Copy link
Copy Markdown
Member

This looks good to me. I didn't even realize we had a re-entry flag though. I'm willing to bet there are many more problems than just this in that case.

According to commit 2b3d05a we don't necessarily want people to do this. I'm just pointing out we may want to create an epic to look at all the edge cases for re-entrant code.

@jhixson74

Copy link
Copy Markdown
Member

/assign

@savio87

savio87 commented Aug 4, 2026

Copy link
Copy Markdown
Author

Thanks for the review and for the context on the re-entry flag! An epic for auditing the re-entrant code paths sounds like a great idea. Let me know if there's anything else needed on this PR.

@jhixson74

Copy link
Copy Markdown
Member

/retest-required

@jhixson74

Copy link
Copy Markdown
Member

/test e2e-azure-ovn

@tthvo

tthvo commented Aug 4, 2026

Copy link
Copy Markdown
Member

/label ok-to-test

@openshift-ci

openshift-ci Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@tthvo: The label(s) ok-to-test cannot be applied or removed, because you are not in one of the allowed teams and are not an allowed user. Must be a member of one of these teams: openshift-patch-managers, openshift-staff-engineers, openshift-release-oversight, openshift-sustaining-engineers

Details

In response to this:

/label ok-to-test

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.

@tthvo

tthvo commented Aug 4, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@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 Aug 4, 2026
@tthvo

tthvo commented Aug 4, 2026

Copy link
Copy Markdown
Member

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 4, 2026
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@tthvo: This pull request references Jira Issue OCPBUGS-85296, 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 (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@savio87: 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.

@jhixson74

Copy link
Copy Markdown
Member

/approve
/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 5, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Tests from second stage were triggered manually. Pipeline can be controlled only manually, until HEAD changes. Use command to trigger second stage.

@openshift-ci

openshift-ci Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhixson74

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 Aug 5, 2026
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. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants