Skip to content

SDN-4829: Add machine config watchers to report IPsec status - #2383

Merged
openshift-merge-bot[bot] merged 8 commits into
openshift:masterfrom
pperiyasamy:mcp-watcher
Mar 3, 2025
Merged

SDN-4829: Add machine config watchers to report IPsec status#2383
openshift-merge-bot[bot] merged 8 commits into
openshift:masterfrom
pperiyasamy:mcp-watcher

Conversation

@pperiyasamy

@pperiyasamy pperiyasamy commented May 23, 2024

Copy link
Copy Markdown
Member

This PR enhances the status manager to react to the network operator's machine configs rendering, listens to machine config and machine config pool events during the lifetime of the machine configs rendered by the network operator and reflects machine config pool(s) progressing/degraded status while rolling out changes. It uses a new network.operator.openshift.io/rendered-machineconfig-state annotation as dynamic cache on the network cluster operator object to stash rendered machine config state so that network operator pod can rely on it to build its own internal state upon its pod restart caused by machine config triggered node reboot.

@openshift-ci
openshift-ci Bot requested review from JacobTanenbaum and tssurya May 23, 2024 17:07
@pperiyasamy
pperiyasamy marked this pull request as draft May 23, 2024 17:10
@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 May 23, 2024
@pperiyasamy
pperiyasamy marked this pull request as ready for review May 27, 2024 13:12
@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 May 27, 2024
@openshift-ci
openshift-ci Bot requested a review from kyrtapz May 27, 2024 13:14
@pperiyasamy pperiyasamy changed the title Add machine config pool watcher for status manager SDN-4829: Add machine config watchers to report IPsec status May 27, 2024
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 27, 2024
@openshift-ci-robot

openshift-ci-robot commented May 27, 2024

Copy link
Copy Markdown
Contributor

@pperiyasamy: This pull request references SDN-4829 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.17.0" version, but no target version was set.

Details

In response to this:

This enhances status manager to watch for machine config and machine config pool objects, retrieves machine config pool status when ipsec is enabled and when any one of the machine config pool goes into degraded state, then makes network operator also into degraded state.

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.

@pperiyasamy

Copy link
Copy Markdown
Member Author

/assign @jcaamano @kyrtapz

@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest

@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest

@jcaamano jcaamano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some generic comments first.

With this, I also think we should no longer return progressing from the render method. That was a trick we should not have used.

And would also like @kyrtapz to take a look eventually.

Comment thread pkg/controller/statusmanager/machineconfig_watcher.go Outdated
Comment thread pkg/controller/statusmanager/status_manager.go Outdated
Comment thread pkg/controller/statusmanager/ipsec_status.go Outdated
Comment thread pkg/controller/statusmanager/machineconfig_watcher.go Outdated
Comment thread pkg/controller/statusmanager/machineconfig_watcher.go
Comment thread pkg/controller/statusmanager/machineconfig_watcher.go
Comment thread pkg/controller/statusmanager/machineconfig_status.go Outdated
Comment thread pkg/controller/statusmanager/machineconfig_status.go Outdated
Comment thread pkg/controller/statusmanager/machineconfig_status.go Outdated
Comment thread pkg/network/ovn_kubernetes.go Outdated
@pperiyasamy
pperiyasamy force-pushed the mcp-watcher branch 3 times, most recently from a66e86d to bca0e79 Compare December 3, 2024 14:37
@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest

@openshift-ci openshift-ci Bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 28, 2025
@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest-required

@pperiyasamy

Copy link
Copy Markdown
Member Author

/test e2e-aws-ovn-ipsec-upgrade
/test e2e-aws-ovn-ipsec-serial

some ipsec jobs are failing due to olm deployment failures which happening very recently, not related to PR change. triggering it agin.

pperiyasamy and others added 8 commits February 28, 2025 14:45
This enhances status manager to watch for machine config and machine
config pool objects, retrieves machine config pool status when ipsec
is enabled and when any one of the machine config pool goes into
degraded state, then makes network operator also into degraded state.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
This commit also provides progressing status about ipsec machine config roll out,
it notifies user about ongoing progress, otherwise network co gets updated only at
the end with degrade status if there is any failure with ipsec rollout.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
The status manager should not be tied to only ipsec machine config,
network operator may own other machine configs in future, so this
commit processes every machine configs that contains network operator
as owner reference.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
This replaces informer with source.Kind for machine config
watcher which helps to make use of same cache used for the
manager.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
This commit captures machine config delete event, watches machine config pool
while removing machine config from the cluster and reflect machine config pool
status conditions into network status.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
When network operator owned machine config is deleted, though mco is still deleting
the rendered machine config from the machine config pool, there is no way to lookup
owner reference on the machine config object upon network operator pod reboot caused
by node reboot. This commit writes machine config rendering status onto
network.operator.openshift.io/last-seen-machineconfig-state network co annotation
and this is being looked up to report status accordingly.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
This commit removes unnecessary initialization of machine config cache
while handling events, cleans up cache entry at the right time,  better
handling of variable names, errors and adds few doc comments.

Signed-off-by: Periyasamy Palanisamy <pepalani@redhat.com>
@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 28, 2025
@pperiyasamy

Copy link
Copy Markdown
Member Author

/test e2e-aws-ovn-ipsec-upgrade
/test e2e-aws-ovn-ipsec-serial

@pperiyasamy

Copy link
Copy Markdown
Member Author

The commit b99b606 is updated with following change to fix an issue (Network status is still reflecting machine config pool status even after IPsec is disabled) found from @huiran0826's testing.

$ git diff
diff --git a/pkg/controller/statusmanager/machineconfig_status.go b/pkg/controller/statusmanager/machineconfig_status.go
index fa61f2dff..858293c22 100644
--- a/pkg/controller/statusmanager/machineconfig_status.go
+++ b/pkg/controller/statusmanager/machineconfig_status.go
@@ -157,7 +157,16 @@ func (status *StatusManager) SetFromMachineConfigPool(mcPools []mcfgv1.MachineCo
                                        removed = mcutil.AreMachineConfigsRemovedFromPool(pool.Status, mcSet)
                                        if removed {
                                                status.machineConfigsBeingRemoved[role].Delete(machineConfig)
+                                               // Delete map entry from status cache if role doesn't have machine configs. By deleting the entry,
+                                               // there won't be any unnecessary processing of pools in the reconcile loop when it's not dealing
+                                               // with network operator machine configs anymore.
+                                               if status.machineConfigsBeingRemoved[role].Len() == 0 {
+                                                       delete(status.machineConfigsBeingRemoved, role)
+                                               }
                                                status.renderedMachineConfigs[role].Delete(machineConfig)
+                                               if status.renderedMachineConfigs[role].Len() == 0 {
+                                                       delete(status.renderedMachineConfigs, role)
+                                               }
                                                if err := status.setLastRenderedMachineConfigState(status.renderedMachineConfigs); err != nil {
                                                        return fmt.Errorf("failed to update rendered machine config state: %v", err)
                                                }
diff --git a/pkg/controller/statusmanager/status_manager_test.go b/pkg/controller/statusmanager/status_manager_test.go
index 8a1930dcf..60ce0fe84 100644
--- a/pkg/controller/statusmanager/status_manager_test.go
+++ b/pkg/controller/statusmanager/status_manager_test.go
@@ -737,6 +737,39 @@ func TestStatusManagerSetFromIPsecConfigs(t *testing.T) {
        if len(co.Status.Versions) > 0 {
                t.Fatalf("Status.Versions unexpectedly already set: %#v", co.Status.Versions)
        }
+
+       // Set master mcp into degraded state, check network operator status condition is
+       // doesn't go into degraded state.
+       masterIPsecmachineConfigPool.Status = mcfgv1.MachineConfigPoolStatus{Conditions: []mcfgv1.MachineConfigPoolCondition{{Type: mcfgv1.MachineConfigPoolDegraded,
+               Status: v1.ConditionTrue}}}
+       err = status.SetFromMachineConfigPool([]mcfgv1.MachineConfigPool{masterIPsecmachineConfigPool,
+               workerIPsecMachineConfigPool})
+       if err != nil {
+               t.Fatalf("error processing machine config pools: %v", err)
+       }
+       co, oc, err = getStatuses(client, "testing")
+       if err != nil {
+               t.Fatalf("error getting ClusterOperator: %v", err)
+       }
+       if !conditionsInclude(oc.Status.Conditions, []operv1.OperatorCondition{
+               {
+                       Type:   operv1.OperatorStatusTypeDegraded,
+                       Status: operv1.ConditionFalse,
+               },
+       }) {
+               t.Fatalf("unexpected network Status.Conditions: %#v", oc.Status.Conditions)
+       }
+       if !conditionsInclude(oc.Status.Conditions, []operv1.OperatorCondition{
+               {
+                       Type:   operv1.OperatorStatusTypeProgressing,
+                       Status: operv1.ConditionFalse,
+               },
+       }) {
+               t.Fatalf("unexpected Status.Conditions: %#v", oc.Status.Conditions)
+       }

Did few tests with changes, The issue is also solved with the fix.

@pperiyasamy

Copy link
Copy Markdown
Member Author

/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 Feb 28, 2025
@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest-required

@jcaamano

jcaamano commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Mar 3, 2025
@openshift-ci

openshift-ci Bot commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcaamano, 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

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD c2322a9 and 2 for PR HEAD b99b606 in total

@openshift-ci

openshift-ci Bot commented Mar 3, 2025

Copy link
Copy Markdown
Contributor

@pperiyasamy: 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/4.18-upgrade-from-stable-4.17-e2e-azure-ovn-upgrade bf88169 link false /test 4.18-upgrade-from-stable-4.17-e2e-azure-ovn-upgrade
ci/prow/4.18-upgrade-from-stable-4.17-e2e-gcp-ovn-upgrade bf88169 link false /test 4.18-upgrade-from-stable-4.17-e2e-gcp-ovn-upgrade
ci/prow/e2e-vsphere-ovn-dualstack-primaryv6 b99b606 link false /test e2e-vsphere-ovn-dualstack-primaryv6
ci/prow/e2e-aws-ovn-ipsec-upgrade b99b606 link false /test e2e-aws-ovn-ipsec-upgrade
ci/prow/e2e-vsphere-ovn b99b606 link false /test e2e-vsphere-ovn
ci/prow/security b99b606 link false /test security
ci/prow/e2e-aws-hypershift-ovn-kubevirt b99b606 link false /test e2e-aws-hypershift-ovn-kubevirt
ci/prow/4.19-upgrade-from-stable-4.18-e2e-gcp-ovn-upgrade b99b606 link false /test 4.19-upgrade-from-stable-4.18-e2e-gcp-ovn-upgrade
ci/prow/4.19-upgrade-from-stable-4.18-e2e-azure-ovn-upgrade b99b606 link false /test 4.19-upgrade-from-stable-4.18-e2e-azure-ovn-upgrade
ci/prow/e2e-aws-ovn-ipsec-serial b99b606 link false /test e2e-aws-ovn-ipsec-serial

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.

@pperiyasamy

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-merge-bot
openshift-merge-bot Bot merged commit 972dea1 into openshift:master Mar 3, 2025
@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-network-operator
This PR has been included in build cluster-network-operator-container-v4.19.0-202503032209.p0.g972dea1.assembly.stream.el9.
All builds following this will include this PR.

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

Labels

acknowledge-critical-fixes-only Indicates if the issuer of the label is OK with the policy. approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants