Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface dependent Operator upgradeable conditions #355

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

leelavg
Copy link
Contributor

@leelavg leelavg commented Dec 8, 2023

  • odf-operator brings dependencies using OLM
  • this PR ensures odf-operator sets it's own operator condition based on upgradeability of it's dependents

[RHSTOR-5073]

Copy link
Contributor

openshift-ci bot commented Dec 8, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@leelavg
Copy link
Contributor Author

leelavg commented Dec 8, 2023

- testing in progress

@df-build-team df-build-team requested a review from a team December 8, 2023 18:59
@leelavg leelavg force-pushed the 5073-upgrade branch 4 times, most recently from 4f1bed4 to 45b9d6d Compare December 11, 2023 06:55
@leelavg leelavg marked this pull request as ready for review December 11, 2023 06:56
@leelavg
Copy link
Contributor Author

leelavg commented Dec 11, 2023

Testing:

--- Initial condition
== No StorageSystem
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:27:33Z","message":"Operator is ready","reason":"Ready","status":"True","type":"Upgradeable"}]

== With StorageSytem
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:27:33Z","message":"No dependent reports not upgradeable status","reason":"Dependents","status":"True","type":"Upgradeable"}]

--- Tests
== dependent is not upgradeable
# ko get condition mcg-operator.v4.13.4-rhodf -ojsonpath='{"Conditions: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: 
Conditions: [{"lastTransitionTime":"2023-12-11T04:05:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]]

== odf-operator is not upgradeable
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:31:42Z","message":"mcg-operator.v4.13.4-rhodf:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

-----

== dependent is upgradeable via overrides
# ko get condition mcg-operator.v4.13.4-rhodf -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-11T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-11T04:05:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:36:04Z","message":"No dependent reports not upgradeable status","reason":"Dependents","status":"True","type":"Upgradeable"}]

-----

== dependent is not upgradeable via overrides
# ko get condition mcg-operator.v4.13.4-rhodf -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-11T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-11T04:05:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:41:09Z","message":"mcg-operator.v4.13.4-rhodf:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

-----

== dependent override is removed
# ko get condition mcg-operator.v4.13.4-rhodf -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: 
Conditions: [{"lastTransitionTime":"2023-12-11T04:05:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.13.4-rhodf -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-11T06:43:49Z","message":"No dependent reports not upgradeable status","reason":"Dependents","status":"True","type":"Upgradeable"}]

@leelavg
Copy link
Contributor Author

leelavg commented Dec 11, 2023

/rerun-required

controllers/storagesystem_controller.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@leelavg
Copy link
Contributor Author

leelavg commented Dec 12, 2023

retested

== dependent is not upgradeable
# ko patch condition mcg-operator.v4.15.0-84.stable --type merge -p '{"spec": {"conditions": [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-84.stable patched

# ko get condition mcg-operator.v4.15.0-84.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}'
Overrides: 
Conditions: [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

== odf-operator is not upgradeable
# ko get condition odf-operator.v4.15.0-84.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-12T05:20:35Z","message":"mcg-operator.v4.15.0-84.stable:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

=====

== dependent is upgradeable via overrides
# ko patch condition mcg-operator.v4.15.0-84.stable --type merge -p '{"spec": {"overrides": [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-84.stable patched

# ko get condition mcg-operator.v4.15.0-84.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-12T04:05:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.15.0-84.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-12T05:22:32Z","message":"No dependent reports not upgradeable status","reason":"Dependents","status":"True","type":"Upgradeable"}]

=====

== dependent is not upgradeable via overrides
# ko patch condition mcg-operator.v4.15.0-84.stable --type merge -p '{"spec": {"overrides": [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-84.stable patched

# ko patch condition mcg-operator.v4.15.0-84.stable --type merge -p '{"spec": {"conditions": [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-84.stable patched

# ko get condition mcg-operator.v4.15.0-84.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.15.0-84.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-12T05:26:01Z","message":"mcg-operator.v4.15.0-84.stable:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

=====

== dependent override is removed
# ko patch condition mcg-operator.v4.15.0-84.stable --type merge -p '{"spec": {"overrides": null}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-84.stable patched

# ko get condition mcg-operator.v4.15.0-84.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: 
Conditions: [{"lastTransitionTime":"2023-12-12T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]]

== odf-operator is upgradeable
# ko get condition odf-operator.v4.15.0-84.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-12T05:27:58Z","message":"No dependent reports not upgradeable status","reason":"Dependents","status":"True","type":"Upgradeable"}]

@leelavg leelavg requested a review from iamniting December 12, 2023 06:00
@leelavg
Copy link
Contributor Author

leelavg commented Dec 14, 2023

/hold

@leelavg
Copy link
Contributor Author

leelavg commented Dec 14, 2023

/unhold
all good!

main.go Outdated Show resolved Hide resolved
controllers/subscription_controller.go Show resolved Hide resolved
@leelavg
Copy link
Contributor Author

leelavg commented Dec 19, 2023

/hold
testing in progress

@leelavg
Copy link
Contributor Author

leelavg commented Dec 19, 2023

/unhold
below extra scenario along w/ #355 (comment) cases are tested

== one operator is upgradeable via overide and another isn't

# ko patch condition mcg-operator.v4.15.0-89.stable --type merge -p '{"spec": {"overrides": [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]}}'

# ko patch condition mcg-operator.v4.15.0-89.stable --type merge -p '{"spec": {"conditions": [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]}}'

# ko patch condition odf-csi-addons-operator.v4.15.0-89.stable --type merge -p '{"spec": {"overrides": [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]}}'

# ko patch condition odf-csi-addons-operator.v4.15.0-89.stable --type merge -p '{"spec": {"conditions": [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]}}'

# ko get condition mcg-operator.v4.15.0-89.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]]

# ko get condition odf-csi-addons-operator.v4.15.0-89.stable -ojsonpath='{"Overrides: "}{.spec.overrides}{"\n"}{"Conditions: "}{.spec.conditions}]'
Overrides: [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"False","type":"Upgradeable"}]
Conditions: [{"lastTransitionTime":"2023-12-19T04:06:22Z","message":"MSG","reason":"RSN","status":"True","type":"Upgradeable"}]]

== odf-operator is not upgradeable due to odf-csi-addons override
# ko get condition odf-operator.v4.15.0-89.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-19T11:23:04Z","message":"odf-csi-addons-operator.v4.15.0-89.stable:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

# ko patch condition mcg-operator.v4.15.0-89.stable --type merge -p '{"spec": {"overrides": null}}'
operatorcondition.operators.coreos.com/mcg-operator.v4.15.0-89.stable patched

== odf-operator is not upgradeable due to mcg conditions
# ko get condition odf-operator.v4.15.0-89.stable -ojsonpath='{.spec.conditions}'
[{"lastTransitionTime":"2023-12-19T11:23:04Z","message":"mcg-operator.v4.15.0-89.stable:MSG","reason":"RSN","status":"False","type":"Upgradeable"}]

controllers/subscription_controller.go Outdated Show resolved Hide resolved
controllers/subscription_controller.go Outdated Show resolved Hide resolved
controllers/subscription_controller.go Outdated Show resolved Hide resolved
Signed-off-by: Leela Venkaiah G <lgangava@ibm.com>
@leelavg leelavg force-pushed the 5073-upgrade branch 2 times, most recently from 69d0df5 to 81148ce Compare December 19, 2023 13:26
- odf-operator brings dependencies using OLM
- this PR ensures odf-operator sets it's own operator condition based on
upgradeability of it's dependents.

Signed-off-by: Leela Venkaiah G <lgangava@ibm.com>
Signed-off-by: Leela Venkaiah G <lgangava@ibm.com>
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 19, 2023
Copy link
Contributor

openshift-ci bot commented Dec 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamniting, leelavg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 Dec 19, 2023
@iamniting iamniting changed the title [RHSTOR-5073] Surface dependent Operator upgradeable conditions Surface dependent Operator upgradeable conditions Dec 19, 2023
@iamniting
Copy link
Member

/test odf-operator-e2e-aws

@openshift-merge-bot openshift-merge-bot bot merged commit af060a2 into red-hat-storage:main Dec 19, 2023
18 checks passed
@iamniting
Copy link
Member

/cherry-pick release-4.15

@iamniting
Copy link
Member

/cherry-pick release-4.14

@openshift-cherrypick-robot

@iamniting: new pull request created: #358

In response to this:

/cherry-pick release-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 kubernetes/test-infra repository.

@openshift-cherrypick-robot

@iamniting: #355 failed to apply on top of branch "release-4.14":

Applying: godeps: go mod tidy and vendor
Using index info to reconstruct a base tree...
M	go.mod
M	go.sum
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 godeps: go mod tidy and vendor
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick 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/test-infra repository.

@iamniting
Copy link
Member

/cherry-pick release-4.13

@openshift-cherrypick-robot

@iamniting: #355 failed to apply on top of branch "release-4.13":

Applying: godeps: go mod tidy and vendor
Using index info to reconstruct a base tree...
M	go.mod
M	go.sum
M	vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/catalogsource_types.go
M	vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/subscription_types.go
M	vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/zz_generated.deepcopy.go
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Auto-merging vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/zz_generated.deepcopy.go
Auto-merging vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/subscription_types.go
CONFLICT (content): Merge conflict in vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/subscription_types.go
Auto-merging vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/catalogsource_types.go
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 godeps: go mod tidy and vendor
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.13

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.

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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants