Skip to content

OCPBUGS-44328: Fix desired before sync_worker's work is initialized - #1104

Merged
openshift-merge-bot[bot] merged 6 commits into
openshift:release-4.15from
hongkailiu:bk-415
Nov 19, 2024
Merged

OCPBUGS-44328: Fix desired before sync_worker's work is initialized#1104
openshift-merge-bot[bot] merged 6 commits into
openshift:release-4.15from
hongkailiu:bk-415

Conversation

@hongkailiu

@hongkailiu hongkailiu commented Nov 6, 2024

Copy link
Copy Markdown
Member

This PR is generated by

$ git cherry-pick a411e9da061c6ba1b71bb2b1ce5972a8e0c03307 6906bbfb9d075450e93680cdf8ccfc51d4e62c24 e3a05d439a609e1eb5fc3c63c70a7825ee48f41f a1ee1ca6c050b752c622264c6903823210671334 ae4e180b19aa4f67f2a53785813ff040ee1690da

and then fix the backported unit test TestCVO_UpgradePayloadStillInitializing by the following editting:

git --no-pager diff 
diff --git a/pkg/cvo/cvo_scenarios_test.go b/pkg/cvo/cvo_scenarios_test.go
index c195e26c..9f060195 100644
--- a/pkg/cvo/cvo_scenarios_test.go
+++ b/pkg/cvo/cvo_scenarios_test.go
@@ -33,9 +33,18 @@ import (
 )
 
 var architecture string
+var sortedCaps = configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]
+var sortedKnownCaps = configv1.KnownClusterVersionCapabilities
 
 func init() {
        architecture = runtime.GOARCH
+
+       sort.Slice(sortedCaps, func(i, j int) bool {
+               return sortedCaps[i] < sortedCaps[j]
+       })
+       sort.Slice(sortedKnownCaps, func(i, j int) bool {
+               return sortedKnownCaps[i] < sortedKnownCaps[j]
+       })
 }
 
 func setupCVOTest(payloadDir string) (*Operator, map[string]apiruntime.Object, *fake.Clientset, *dynamicfake.FakeDynamicClient, func()) {
diff --git a/pkg/cvo/sync_worker.go b/pkg/cvo/sync_worker.go
index 22ec05b9..eb2fb500 100644
--- a/pkg/cvo/sync_worker.go
+++ b/pkg/cvo/sync_worker.go
@@ -191,11 +191,6 @@ type SyncWorker struct {
 
        clusterProfile string
 
-       // alwaysEnableCapabilities is a list of cluster capabilities which should
-       // always be implicitly enabled.
-       // This contributes to whether or not some manifests are included for reconciliation.
-       alwaysEnableCapabilities []configv1.ClusterVersionCapability
-
        // initializedFunc is only for the unit-test purpose
        initializedFunc func() bool
 }

where alwaysEnableCapabilities is removed because it is not used in 4.15 and the variables sortedCaps and sortedKnownCaps are added because they are used in the backported unit test.

Note that e94580f is not picked to keep the manual work simple. Otherwise it would lead to more manual work such as fixing using constants from the new API like configv1.ClusterVersionCapabilityIngress which is not available for 4.15.

If the CVO pod gets restarted after a user sends a cluster
upgrade request with `--to-image`, the desired should not ALWAYS be
taken from `.Spec.DesiredUpdate`, e.g., when the targeting payload is blocked
on some precondition check failure.

The user request will be written to `cv.spec.desiredUpdate` where only
the `image` field is set, i.e., the `Version` field is empty.

If the CVO gets restarted, then

1. The desied [1] from `cv.spec.desiredUpdate` will be used to set
   `w.status.Actual` [2] and then applied to `cv.status.desired`.
2. When the next `optr.sync()` happens, the precondition check may become
   non-blocking [3] as the `Version` field is empty now.
3. CVO will then start an upgrade that should have been blocked.

[1]. https://github.com/openshift/cluster-version-operator/blob/1995380b6d755c29b926b846a64ca0039002c2cf/pkg/cvo/cvo.go#L680
[2]. https://github.com/openshift/cluster-version-operator/blob/1995380b6d755c29b926b846a64ca0039002c2cf/pkg/cvo/sync_worker.go#L502
[3]. https://github.com/openshift/cluster-version-operator/blob/1995380b6d755c29b926b846a64ca0039002c2cf/pkg/payload/precondition/clusterversion/rollback.go#L57
@hongkailiu hongkailiu changed the title Bk 415 [wip][release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized Nov 6, 2024
@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 Nov 6, 2024
@hongkailiu

Copy link
Copy Markdown
Member Author

/test-required

@hongkailiu

Copy link
Copy Markdown
Member Author

/test unit

@hongkailiu

Copy link
Copy Markdown
Member Author

/retest-required

@openshift-ci

openshift-ci Bot commented Nov 7, 2024

Copy link
Copy Markdown
Contributor

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

@hongkailiu

Copy link
Copy Markdown
Member Author

/jira cherrypick OCPBUGS-43964

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@hongkailiu: Jira Issue OCPBUGS-43964 has been cloned as Jira Issue OCPBUGS-44328. Will retitle bug to link to clone.
/retitle OCPBUGS-44328: [wip][release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized

Details

In response to this:

/jira cherrypick OCPBUGS-43964

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 changed the title [wip][release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized OCPBUGS-44328: [wip][release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized Nov 7, 2024
@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 Nov 7, 2024
@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. labels Nov 7, 2024
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@hongkailiu: This pull request references Jira Issue OCPBUGS-44328, which is valid. The bug has been moved to the POST state.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.15.z) matches configured target version for branch (4.15.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-43964 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-43964 targets the "4.16.z" version, which is one of the valid target versions: 4.16.0, 4.16.z
  • bug has dependents

Requesting review from QA contact:
/cc @jiajliu

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

Details

In response to this:

This PR is generated by

$ git cherry-pick a411e9da061c6ba1b71bb2b1ce5972a8e0c03307 6906bbfb9d075450e93680cdf8ccfc51d4e62c24 e3a05d439a609e1eb5fc3c63c70a7825ee48f41f a1ee1ca6c050b752c622264c6903823210671334 ae4e180b19aa4f67f2a53785813ff040ee1690da

and then fix the backported unit test TestCVO_UpgradePayloadStillInitializing by the following editting:

git --no-pager diff 
diff --git a/pkg/cvo/cvo_scenarios_test.go b/pkg/cvo/cvo_scenarios_test.go
index c195e26c..9f060195 100644
--- a/pkg/cvo/cvo_scenarios_test.go
+++ b/pkg/cvo/cvo_scenarios_test.go
@@ -33,9 +33,18 @@ import (
)

var architecture string
+var sortedCaps = configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]
+var sortedKnownCaps = configv1.KnownClusterVersionCapabilities

func init() {
       architecture = runtime.GOARCH
+
+       sort.Slice(sortedCaps, func(i, j int) bool {
+               return sortedCaps[i] < sortedCaps[j]
+       })
+       sort.Slice(sortedKnownCaps, func(i, j int) bool {
+               return sortedKnownCaps[i] < sortedKnownCaps[j]
+       })
}

func setupCVOTest(payloadDir string) (*Operator, map[string]apiruntime.Object, *fake.Clientset, *dynamicfake.FakeDynamicClient, func()) {
diff --git a/pkg/cvo/sync_worker.go b/pkg/cvo/sync_worker.go
index 22ec05b9..eb2fb500 100644
--- a/pkg/cvo/sync_worker.go
+++ b/pkg/cvo/sync_worker.go
@@ -191,11 +191,6 @@ type SyncWorker struct {

       clusterProfile string

-       // alwaysEnableCapabilities is a list of cluster capabilities which should
-       // always be implicitly enabled.
-       // This contributes to whether or not some manifests are included for reconciliation.
-       alwaysEnableCapabilities []configv1.ClusterVersionCapability
-
       // initializedFunc is only for the unit-test purpose
       initializedFunc func() bool
}

where alwaysEnableCapabilities is removed because it is not used in 4.15 and the variables sortedCaps and sortedKnownCaps are added because they are used in the backported unit test.

Note that e94580f is not picked to keep the manual work simple. Otherwise it would lead to more manual work such as fixing using constants from the new API like configv1.ClusterVersionCapabilityIngress.

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 Nov 7, 2024
@openshift-ci
openshift-ci Bot requested a review from jiajliu November 7, 2024 14:11
@hongkailiu hongkailiu changed the title OCPBUGS-44328: [wip][release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized OCPBUGS-44328: [release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized Nov 7, 2024
@hongkailiu

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@hongkailiu: This pull request references Jira Issue OCPBUGS-44328, which is valid.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.15.z) matches configured target version for branch (4.15.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-43964 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-43964 targets the "4.16.z" version, which is one of the valid target versions: 4.16.0, 4.16.z
  • bug has dependents

Requesting review from QA contact:
/cc @jiajliu

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

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.

@wking

wking commented Nov 9, 2024

Copy link
Copy Markdown
Member

/retitle OCPBUGS-44328: Fix desired before sync_worker's work is initialized

@openshift-ci openshift-ci Bot changed the title OCPBUGS-44328: [release-4.15] OCPBUGS-TODO: Fix desired before sync_worker's work is initialized OCPBUGS-44328: Fix desired before sync_worker's work is initialized Nov 9, 2024

@wking wking left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm
/label backport-risk-assessed

@openshift-ci openshift-ci Bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label Nov 9, 2024
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2024
@openshift-ci

openshift-ci Bot commented Nov 9, 2024

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hongkailiu, wking

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 Nov 9, 2024
@evakhoni

Copy link
Copy Markdown
Contributor

so the only change outside of the unit test, is the alwaysEnableCapabilities in sync worker, which anyway weren't there in 4.15 right? if such, no real change in behavior compared to the parent fix right?

@hongkailiu

Copy link
Copy Markdown
Member Author

so the only change outside of the unit test, is the alwaysEnableCapabilities in sync worker, which anyway weren't there in 4.15 right? if such, no real change in behavior compared to the parent fix right?

Correct and correct.

@evakhoni

Copy link
Copy Markdown
Contributor

ok then, verified.
/label qe-approved
/cc @jiajliu
for approval tnx

@openshift-ci openshift-ci Bot added the qe-approved Signifies that QE has signed off on this PR label Nov 18, 2024
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@hongkailiu: This pull request references Jira Issue OCPBUGS-44328, which is valid.

7 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.15.z) matches configured target version for branch (4.15.z)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
  • release note text is set and does not match the template
  • dependent bug Jira Issue OCPBUGS-43964 is in the state Closed (Done-Errata), which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), CLOSED (DONE-ERRATA))
  • dependent Jira Issue OCPBUGS-43964 targets the "4.16.z" version, which is one of the valid target versions: 4.16.0, 4.16.z
  • bug has dependents

Requesting review from QA contact:
/cc @evakhoni

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

Details

In response to this:

This PR is generated by

$ git cherry-pick a411e9da061c6ba1b71bb2b1ce5972a8e0c03307 6906bbfb9d075450e93680cdf8ccfc51d4e62c24 e3a05d439a609e1eb5fc3c63c70a7825ee48f41f a1ee1ca6c050b752c622264c6903823210671334 ae4e180b19aa4f67f2a53785813ff040ee1690da

and then fix the backported unit test TestCVO_UpgradePayloadStillInitializing by the following editting:

git --no-pager diff 
diff --git a/pkg/cvo/cvo_scenarios_test.go b/pkg/cvo/cvo_scenarios_test.go
index c195e26c..9f060195 100644
--- a/pkg/cvo/cvo_scenarios_test.go
+++ b/pkg/cvo/cvo_scenarios_test.go
@@ -33,9 +33,18 @@ import (
)

var architecture string
+var sortedCaps = configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]
+var sortedKnownCaps = configv1.KnownClusterVersionCapabilities

func init() {
       architecture = runtime.GOARCH
+
+       sort.Slice(sortedCaps, func(i, j int) bool {
+               return sortedCaps[i] < sortedCaps[j]
+       })
+       sort.Slice(sortedKnownCaps, func(i, j int) bool {
+               return sortedKnownCaps[i] < sortedKnownCaps[j]
+       })
}

func setupCVOTest(payloadDir string) (*Operator, map[string]apiruntime.Object, *fake.Clientset, *dynamicfake.FakeDynamicClient, func()) {
diff --git a/pkg/cvo/sync_worker.go b/pkg/cvo/sync_worker.go
index 22ec05b9..eb2fb500 100644
--- a/pkg/cvo/sync_worker.go
+++ b/pkg/cvo/sync_worker.go
@@ -191,11 +191,6 @@ type SyncWorker struct {

       clusterProfile string

-       // alwaysEnableCapabilities is a list of cluster capabilities which should
-       // always be implicitly enabled.
-       // This contributes to whether or not some manifests are included for reconciliation.
-       alwaysEnableCapabilities []configv1.ClusterVersionCapability
-
       // initializedFunc is only for the unit-test purpose
       initializedFunc func() bool
}

where alwaysEnableCapabilities is removed because it is not used in 4.15 and the variables sortedCaps and sortedKnownCaps are added because they are used in the backported unit test.

Note that e94580f is not picked to keep the manual work simple. Otherwise it would lead to more manual work such as fixing using constants from the new API like configv1.ClusterVersionCapabilityIngress which is not available for 4.15.

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 evakhoni November 18, 2024 15:47
@hongkailiu

Copy link
Copy Markdown
Member Author

/cherrypick release-4.14

@openshift-cherrypick-robot

Copy link
Copy Markdown

@hongkailiu: once the present PR merges, I will cherry-pick it on top of release-4.14 in a new PR and assign it to you.

Details

In response to this:

/cherrypick release-4.14

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.

@jiajliu

jiajliu commented Nov 19, 2024

Copy link
Copy Markdown
Contributor

/label cherry-pick-approved

@openshift-ci openshift-ci Bot added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label Nov 19, 2024
@openshift-merge-bot
openshift-merge-bot Bot merged commit fbb41e8 into openshift:release-4.15 Nov 19, 2024
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@hongkailiu: Jira Issue OCPBUGS-44328: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-44328 has been moved to the MODIFIED state.

Details

In response to this:

This PR is generated by

$ git cherry-pick a411e9da061c6ba1b71bb2b1ce5972a8e0c03307 6906bbfb9d075450e93680cdf8ccfc51d4e62c24 e3a05d439a609e1eb5fc3c63c70a7825ee48f41f a1ee1ca6c050b752c622264c6903823210671334 ae4e180b19aa4f67f2a53785813ff040ee1690da

and then fix the backported unit test TestCVO_UpgradePayloadStillInitializing by the following editting:

git --no-pager diff 
diff --git a/pkg/cvo/cvo_scenarios_test.go b/pkg/cvo/cvo_scenarios_test.go
index c195e26c..9f060195 100644
--- a/pkg/cvo/cvo_scenarios_test.go
+++ b/pkg/cvo/cvo_scenarios_test.go
@@ -33,9 +33,18 @@ import (
)

var architecture string
+var sortedCaps = configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]
+var sortedKnownCaps = configv1.KnownClusterVersionCapabilities

func init() {
       architecture = runtime.GOARCH
+
+       sort.Slice(sortedCaps, func(i, j int) bool {
+               return sortedCaps[i] < sortedCaps[j]
+       })
+       sort.Slice(sortedKnownCaps, func(i, j int) bool {
+               return sortedKnownCaps[i] < sortedKnownCaps[j]
+       })
}

func setupCVOTest(payloadDir string) (*Operator, map[string]apiruntime.Object, *fake.Clientset, *dynamicfake.FakeDynamicClient, func()) {
diff --git a/pkg/cvo/sync_worker.go b/pkg/cvo/sync_worker.go
index 22ec05b9..eb2fb500 100644
--- a/pkg/cvo/sync_worker.go
+++ b/pkg/cvo/sync_worker.go
@@ -191,11 +191,6 @@ type SyncWorker struct {

       clusterProfile string

-       // alwaysEnableCapabilities is a list of cluster capabilities which should
-       // always be implicitly enabled.
-       // This contributes to whether or not some manifests are included for reconciliation.
-       alwaysEnableCapabilities []configv1.ClusterVersionCapability
-
       // initializedFunc is only for the unit-test purpose
       initializedFunc func() bool
}

where alwaysEnableCapabilities is removed because it is not used in 4.15 and the variables sortedCaps and sortedKnownCaps are added because they are used in the backported unit test.

Note that e94580f is not picked to keep the manual work simple. Otherwise it would lead to more manual work such as fixing using constants from the new API like configv1.ClusterVersionCapabilityIngress which is not available for 4.15.

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-cherrypick-robot

Copy link
Copy Markdown

@hongkailiu: new pull request created: #1109

Details

In response to this:

/cherrypick release-4.14

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-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-version-operator
This PR has been included in build cluster-version-operator-container-v4.15.0-202411190104.p0.gfbb41e8.assembly.stream.el9.
All builds following this will include this PR.

@openshift-merge-robot

Copy link
Copy Markdown
Contributor

Fix included in accepted release 4.15.0-0.nightly-2024-11-19-015320

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. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. 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. qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants