Skip to content

Conversation

@bryan-cox
Copy link
Member

@bryan-cox bryan-cox commented Dec 16, 2025

What this PR does / why we need it:

Fixes an issue where the Azure platform reconciliation in HyperShift was replacing the entire AzurePlatformStatus struct, which inadvertently reverted API-defaulted fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource as the defaulting controller fought with the reconciliation loop, resulting in errors like:

Object got updated more than one time without a no-op update, this indicates hypershift incorrectly reverting defaulted values

Changes:

  1. Only initialize the AzurePlatformStatus struct if it's nil, preserving any defaulted values
  2. Read the cloud name from hcp.Spec.Platform.Azure.Cloud instead of hardcoding AzurePublicCloud, falling back to AzurePublicCloud if not specified
  3. Only update the specific fields HyperShift explicitly manages (CloudName and ResourceGroupName)

Which issue(s) this PR fixes:

A part of OCPBUGS-66211

Special notes for your reviewer:

The change is minimal and targeted - instead of replacing the entire struct, we now:

  1. Only initialize the struct if it's nil
  2. Properly derive CloudName from the HCP spec with a sensible default
  3. Update only the fields HyperShift explicitly manages

Checklist:

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

@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 Dec 16, 2025
@openshift-ci-robot
Copy link

@bryan-cox: This pull request references Jira Issue OCPBUGS-66211, which is invalid:

  • expected the bug to target either version "4.22." or "openshift-4.22.", but it targets "4.21.0" instead

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:

What this PR does / why we need it:

Fixes an issue where the Azure platform reconciliation in HyperShift was replacing the entire AzurePlatformStatus struct, which inadvertently reverted API-defaulted fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource as the defaulting controller fought with the reconciliation loop, resulting in errors like:

Object got updated more than one time without a no-op update, this indicates hypershift incorrectly reverting defaulted values

The fix now checks if the Azure struct exists before initializing, and only updates the specific fields we manage (CloudName and ResourceGroupName), preserving any other defaulted values.

Which issue(s) this PR fixes:

Fixes OCPBUGS-66211

Special notes for your reviewer:

The change is minimal and targeted - instead of replacing the entire struct, we now:

  1. Only initialize the struct if it's nil
  2. Update only the fields HyperShift explicitly manages

Checklist:

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

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 Dec 16, 2025

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

ReconcileInfrastructure's Azure handling was refactored: the code now ensures infra.Status.PlatformStatus.Azure is non-nil, derives CloudName from hcp.Spec.Platform.Azure.Cloud with a default to AzurePublicCloud when empty, and assigns CloudName and ResourceGroupName via separate field assignments instead of a struct literal.

Changes

Cohort / File(s) Summary
Azure platform status initialization refactor
support/globalconfig/infrastructure.go
Replace inline struct literal initialization of infra.Status.PlatformStatus.Azure with a nil-check and incremental field assignments. Derive CloudName from hcp.Spec.Platform.Azure.Cloud (defaulting to AzurePublicCloud when empty) and set ResourceGroupName as a separate assignment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the nil-check correctly initializes infra.Status.PlatformStatus.Azure only when needed.
  • Confirm CloudName defaulting logic matches prior behavior and there are no missing edge cases.
  • Ensure separate field assignments produce equivalent end-state compared to the previous struct literal.

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

@openshift-ci openshift-ci bot requested review from enxebre and muraee December 16, 2025 11:34
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

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 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 and removed do-not-merge/needs-area labels Dec 16, 2025
@bryan-cox
Copy link
Member Author

/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 Dec 16, 2025
@openshift-ci-robot
Copy link

@bryan-cox: This pull request references Jira Issue OCPBUGS-66211, which is valid.

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 POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @wewang58

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 requested a review from wewang58 December 16, 2025 11:35
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between bcd5066 and f05d4d0.

📒 Files selected for processing (1)
  • support/globalconfig/infrastructure.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • support/globalconfig/infrastructure.go

@bryan-cox
Copy link
Member Author

/test e2e-aks-4-21

@bryan-cox
Copy link
Member Author

/test e2e-aws-upgrade-hypershift-operator

@bryan-cox
Copy link
Member Author

/test e2e-aks-4-21

@csrwng csrwng changed the title OCPBUGS-66211: fix(azure): preserve defaulted values in Infrastructure status fix(azure): preserve defaulted values in Infrastructure status Dec 17, 2025
@openshift-ci-robot openshift-ci-robot removed 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 Dec 17, 2025
@openshift-ci-robot
Copy link

@bryan-cox: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

Details

In response to this:

What this PR does / why we need it:

Fixes an issue where the Azure platform reconciliation in HyperShift was replacing the entire AzurePlatformStatus struct, which inadvertently reverted API-defaulted fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource as the defaulting controller fought with the reconciliation loop, resulting in errors like:

Object got updated more than one time without a no-op update, this indicates hypershift incorrectly reverting defaulted values

The fix now checks if the Azure struct exists before initializing, and only updates the specific fields we manage (CloudName and ResourceGroupName), preserving any other defaulted values.

Which issue(s) this PR fixes:

Fixes OCPBUGS-66211

Special notes for your reviewer:

The change is minimal and targeted - instead of replacing the entire struct, we now:

  1. Only initialize the struct if it's nil
  2. Update only the fields HyperShift explicitly manages

Checklist:

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

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-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 17, 2025
Previously, the Azure platform reconciliation replaced the entire
AzurePlatformStatus struct, which inadvertently reverted API-defaulted
fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource
as the defaulting controller fought with the reconciliation loop.

The fix now checks if the Azure struct exists before initializing,
and only updates the specific fields we manage (CloudName and
ResourceGroupName), preserving any other defaulted values.

Signed-off-by: Bryan Cox <brcox@redhat.com>
@bryan-cox bryan-cox changed the title fix(azure): preserve defaulted values in Infrastructure status OCPBUGS-66211: fix(azure): preserve defaulted values in Infrastructure status Dec 17, 2025
@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 Dec 17, 2025
@openshift-ci-robot
Copy link

@bryan-cox: This pull request references Jira Issue OCPBUGS-66211, which is invalid:

  • expected the bug to be in one of the following states: NEW, ASSIGNED, POST, but it is Verified instead

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.

Details

In response to this:

What this PR does / why we need it:

Fixes an issue where the Azure platform reconciliation in HyperShift was replacing the entire AzurePlatformStatus struct, which inadvertently reverted API-defaulted fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource as the defaulting controller fought with the reconciliation loop, resulting in errors like:

Object got updated more than one time without a no-op update, this indicates hypershift incorrectly reverting defaulted values

The fix now checks if the Azure struct exists before initializing, and only updates the specific fields we manage (CloudName and ResourceGroupName), preserving any other defaulted values.

Which issue(s) this PR fixes:

Fixes OCPBUGS-66211

Special notes for your reviewer:

The change is minimal and targeted - instead of replacing the entire struct, we now:

  1. Only initialize the struct if it's nil
  2. Update only the fields HyperShift explicitly manages

Checklist:

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

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.

@muraee
Copy link
Contributor

muraee commented Dec 17, 2025

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 17, 2025
@bryan-cox
Copy link
Member Author

/test e2e-aks-4-21

@bryan-cox
Copy link
Member Author

/override "ci/prow/okd-scos-images"

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 17, 2025

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/okd-scos-images

Details

In response to this:

/override "ci/prow/okd-scos-images"

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.

@bryan-cox
Copy link
Member Author

/test e2e-aks-4-21

infra.Status.PlatformStatus.Azure = &configv1.AzurePlatformStatus{}
}
infra.Status.PlatformStatus.Azure.CloudName = configv1.AzurePublicCloud
cloudName := configv1.AzureCloudEnvironment(hcp.Spec.Platform.Azure.Cloud)
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not the same constants. I believe you'll need to add a mapping function.

Copy link
Member Author

Choose a reason for hiding this comment

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

The direct type conversion is actually valid here - both types use the same underlying string values. Looking at both APIs:

  • HyperShift API (hyperv1.AzurePlatformSpec.Cloud): string with enum AzurePublicCloud;AzureUSGovernmentCloud;AzureChinaCloud;AzureGermanCloud;AzureStackCloud
  • configv1 API (configv1.AzureCloudEnvironment): type AzureCloudEnvironment string with enum "";AzurePublicCloud;AzureUSGovernmentCloud;AzureChinaCloud;AzureGermanCloud;AzureStackCloud

The string values are identical between both APIs. The only difference is configv1 also allows empty string, which we handle on lines 86-88 by defaulting to AzurePublicCloud.

Since both are backed by string and use the exact same values, the type conversion configv1.AzureCloudEnvironment(hcp.Spec.Platform.Azure.Cloud) works correctly.

I did check for an existing mapping function - GetAzureCloudConfiguration in support/azureutil/azureutil.go maps to Azure SDK's cloud.Configuration, not to configv1.AzureCloudEnvironment. Happy to add an explicit mapping function if you'd prefer that for clarity, but the current approach is type-safe.


AI-assisted response via Claude Code

@csrwng
Copy link
Contributor

csrwng commented Dec 17, 2025

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 17, 2025
@csrwng
Copy link
Contributor

csrwng commented Dec 17, 2025

/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 17, 2025
@bryan-cox
Copy link
Member Author

/verified by e2e

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Dec 17, 2025
@openshift-ci-robot
Copy link

@bryan-cox: This PR has been marked as verified by e2e.

Details

In response to this:

/verified by e2e

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 Author

/retest

@bryan-cox
Copy link
Member Author

/jira refresh

@openshift-ci-robot
Copy link

@bryan-cox: This pull request references Jira Issue OCPBUGS-66211, which is invalid:

  • expected the bug to be in one of the following states: NEW, ASSIGNED, POST, but it is Verified instead

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.

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.

@bryan-cox
Copy link
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jan 6, 2026
@openshift-ci-robot
Copy link

@bryan-cox: This pull request references Jira Issue OCPBUGS-66211, which is valid.

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 POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @wewang58

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-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Jan 6, 2026
@bryan-cox
Copy link
Member Author

/test e2e-aks

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 6, 2026

@bryan-cox: 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 6ed903a into openshift:main Jan 6, 2026
21 checks passed
@openshift-ci-robot
Copy link

@bryan-cox: Jira Issue Verification Checks: Jira Issue OCPBUGS-66211
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-66211 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

What this PR does / why we need it:

Fixes an issue where the Azure platform reconciliation in HyperShift was replacing the entire AzurePlatformStatus struct, which inadvertently reverted API-defaulted fields like CloudLoadBalancerConfig and IPFamily to nil/empty values.

This caused the HCCO to continuously update the Infrastructure resource as the defaulting controller fought with the reconciliation loop, resulting in errors like:

Object got updated more than one time without a no-op update, this indicates hypershift incorrectly reverting defaulted values

Changes:

  1. Only initialize the AzurePlatformStatus struct if it's nil, preserving any defaulted values
  2. Read the cloud name from hcp.Spec.Platform.Azure.Cloud instead of hardcoding AzurePublicCloud, falling back to AzurePublicCloud if not specified
  3. Only update the specific fields HyperShift explicitly manages (CloudName and ResourceGroupName)

Which issue(s) this PR fixes:

A part of OCPBUGS-66211

Special notes for your reviewer:

The change is minimal and targeted - instead of replacing the entire struct, we now:

  1. Only initialize the struct if it's nil
  2. Properly derive CloudName from the HCP spec with a sensible default
  3. Update only the fields HyperShift explicitly manages

Checklist:

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

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.

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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants