Skip to content

OCPBUGS-78974: Fix ManagementState being reset on operator restart#2942

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:masterfrom
kyrtapz:fix_managedstate_override
Mar 31, 2026
Merged

OCPBUGS-78974: Fix ManagementState being reset on operator restart#2942
openshift-merge-bot[bot] merged 1 commit intoopenshift:masterfrom
kyrtapz:fix_managedstate_override

Conversation

@kyrtapz
Copy link
Copy Markdown
Contributor

@kyrtapz kyrtapz commented Mar 20, 2026

network.MergeClusterConfig always defaults ManagementState to "Managed" when empty. Since the clusterconfig ctrl doesn't read the current API state it will always override it on reconciliation.

Preserve the current ManagementState in mergeOperConfigForUpdate when already set, otherwise let the updated value through.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@kyrtapz: This pull request references Jira Issue OCPBUGS-78974, 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)

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

Details

In response to this:

network.MergeClusterConfig always defaults ManagementState to "Managed" when empty. Since the clusterconfig ctrl doesn't read the current API state it will always override it on reconciliation.

Preserve the current ManagementState in mergeOperConfigForUpdate when already set, otherwise let the updated value through.

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 added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Mar 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f76caebe-fb0a-42d9-9331-e51e461e5076

📥 Commits

Reviewing files that changed from the base of the PR and between 8434ffa and 067feb9.

📒 Files selected for processing (3)
  • pkg/apply/merge.go
  • pkg/apply/merge_test.go
  • pkg/network/cluster_config.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/apply/merge.go

Walkthrough

merge logic updated to preserve an existing spec.managementState during updates: mergeOperConfigForUpdate now reads and keeps current.spec.managementState when present; MergeClusterConfig only sets ManagementState = "Managed" if the field is empty. Tests added for network operator merge behavior.

Changes

Cohort / File(s) Summary
Apply merge logic & tests
pkg/apply/merge.go, pkg/apply/merge_test.go
mergeOperConfigForUpdate now reads current.spec.managementState and, if present and non-empty, preserves it into the updated object. Added tests validating merge behavior for Network operator operatorSpec.managementState.
Cluster config defaulting
pkg/network/cluster_config.go
MergeClusterConfig sets operConf.ManagementState = "Managed" only when operConf.ManagementState is empty, avoiding overwriting an existing API-provided value (e.g., "Unmanaged").

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.11.3)

level=error msg="Running error: context loading failed: failed to load packages: failed to load packages: failed to load with go/packages: err: exit status 1: stderr: go: inconsistent vendoring in :\n\tgithub.com/Masterminds/semver@v1.5.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/Masterminds/sprig/v3@v3.2.3: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/containernetworking/cni@v0.8.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/ghodss/yaml@v1.0.1-0.20190212211648-25d852aebe32: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/go-bindata/go-bindata@v3.1.2+incompatible: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/onsi/gomega@v1.38.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tgithub.com/ope

... [truncated 17231 characters] ...

ired in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/gengo/v2@v2.0.0-20250922181213-ec3ebc5fd46b: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/kms@v0.34.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tk8s.io/kube-aggregator@v0.34.1: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tsigs.k8s.io/randfill@v1.0.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\tsigs.k8s.io/structured-merge-diff/v6@v6.3.0: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt\n\n\tTo ignore the vendor directory, use -mod=readonly or -mod=mod.\n\tTo sync the vendor directory, run:\n\t\tgo mod vendor\n"


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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@kyrtapz: This pull request references Jira Issue OCPBUGS-78974, 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)
Details

In response to this:

network.MergeClusterConfig always defaults ManagementState to "Managed" when empty. Since the clusterconfig ctrl doesn't read the current API state it will always override it on reconciliation.

Preserve the current ManagementState in mergeOperConfigForUpdate when already set, otherwise let the updated value through.

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.

network.MergeClusterConfig always defaults ManagementState to
"Managed" when empty. Since the clusterconfig ctrl doesn't read the
current API state it will always override it on reconciliation.

Preserve the current ManagementState in mergeOperConfigForUpdate when
already set, otherwise let the updated value through.

Signed-off-by: Patryk Diak <pdiak@redhat.com>
@kyrtapz kyrtapz force-pushed the fix_managedstate_override branch from 8434ffa to 067feb9 Compare March 20, 2026 08:40
@pperiyasamy
Copy link
Copy Markdown
Member

/retest-required

@pperiyasamy
Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 20, 2026
@pperiyasamy
Copy link
Copy Markdown
Member

/verified by @pperiyasamy

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kyrtapz, pperiyasamy

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-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 20, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@pperiyasamy: This PR has been marked as verified by @pperiyasamy.

Details

In response to this:

/verified by @pperiyasamy

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

/retest-required

Remaining retests: 0 against base HEAD 3689d5c and 2 for PR HEAD 067feb9 in total

@kyrtapz
Copy link
Copy Markdown
Contributor Author

kyrtapz commented Mar 25, 2026

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 25, 2026

@kyrtapz: Overrode contexts on behalf of kyrtapz: ci/prow/e2e-metal-ipi-ovn-dualstack-bgp, ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

Details

In response to this:

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

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.

@kyrtapz
Copy link
Copy Markdown
Contributor Author

kyrtapz commented Mar 26, 2026

/retest-required

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD f5e61cd and 1 for PR HEAD 067feb9 in total

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 5ce0f71 and 0 for PR HEAD 067feb9 in total

@openshift-ci-robot
Copy link
Copy Markdown
Contributor

/hold

Revision 067feb9 was retested 3 times: holding

@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 Mar 29, 2026
@kyrtapz
Copy link
Copy Markdown
Contributor Author

kyrtapz commented Mar 30, 2026

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp
/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

@kyrtapz
Copy link
Copy Markdown
Contributor Author

kyrtapz commented Mar 30, 2026

/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 Mar 30, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 30, 2026

@kyrtapz: Overrode contexts on behalf of kyrtapz: ci/prow/e2e-metal-ipi-ovn-dualstack-bgp, ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

Details

In response to this:

/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp
/override ci/prow/e2e-metal-ipi-ovn-dualstack-bgp-local-gw

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-robot
Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 5ce0f71 and 2 for PR HEAD 067feb9 in total

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Mar 30, 2026

@kyrtapz: 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-rhcos10-techpreview 067feb9 link false /test e2e-aws-ovn-rhcos10-techpreview
ci/prow/4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade 067feb9 link false /test 4.22-upgrade-from-stable-4.21-e2e-azure-ovn-upgrade
ci/prow/security 067feb9 link false /test security

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.

@kyrtapz
Copy link
Copy Markdown
Contributor Author

kyrtapz commented Mar 31, 2026

/retest-required

@openshift-merge-bot openshift-merge-bot bot merged commit 594de43 into openshift:master Mar 31, 2026
27 of 30 checks passed
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@kyrtapz: Jira Issue Verification Checks: Jira Issue OCPBUGS-78974
✔️ 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-78974 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:

network.MergeClusterConfig always defaults ManagementState to "Managed" when empty. Since the clusterconfig ctrl doesn't read the current API state it will always override it on reconciliation.

Preserve the current ManagementState in mergeOperConfigForUpdate when already set, otherwise let the updated value through.

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

Fix included in accepted release 4.22.0-0.nightly-2026-04-01-092906

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants