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

[OCPCLOUD-1307] Refactor CCCMO cluster-operator resource handling #152

Merged

Conversation

Fedosin
Copy link
Contributor

@Fedosin Fedosin commented Dec 7, 2021

This PR moves logic from ClusterOperatorReconciler related to the status management into its own type - ClusterOperatorStatus. It allows to reuse it in other controllers.

@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 7, 2021

/retest

1 similar comment
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 7, 2021

/retest

Copy link
Contributor

@elmiko elmiko left a comment

Choose a reason for hiding this comment

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

this makes sense to me, thanks Mike
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 8, 2021
Copy link
Contributor

@lobziik lobziik left a comment

Choose a reason for hiding this comment

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

Thanks a lot!
Looks mostly good for me, just couple of nits

if err := r.setCloudControllerOwnerCondition(ctx); err != nil {
// Set the CloudControllerOwner condition to true
if err := r.setClusterOperatorCondition(ctx, cloudControllerOwnershipCondition, configv1.ConditionTrue, ReasonAsExpected,
fmt.Sprintf("Cluster Cloud Controller Manager Operator owns cloud controllers at %s", r.ReleaseVersion)); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

klog.Infof IMO is better fit there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to provide a formatted string value to the function setClusterOperatorCondition. klog.Infof doesn't do this, but just prints the string to the log.

Copy link
Contributor

@lobziik lobziik Dec 9, 2021

Choose a reason for hiding this comment

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

Oh, sorry. Misread this line... Dunno why, but i thought its a log message

@@ -30,10 +31,17 @@ const (
defaultManagementNamespace = "openshift-cloud-controller-manager-operator"
)

type ClusterOperatorStatus struct {
Copy link
Contributor

@lobziik lobziik Dec 8, 2021

Choose a reason for hiding this comment

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

I'm thinking about better name for this struct...
ClusterOperatorStatusClient or smth like BaseClusterOperatorReconciler maybe.
Naming of this thing is a bit confusing IMHO. We are using this for embedding k8s client into reconcilers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ClusterOperatorStatusClient works for me.

@lobziik
Copy link
Contributor

lobziik commented Dec 8, 2021

/retest

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2021
@Fedosin Fedosin force-pushed the cluster_operator_status branch 3 times, most recently from 46ba321 to ff7e631 Compare December 10, 2021 10:46
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 10, 2021

/hold

we need to merge #153 first

@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 10, 2021
This commit moves logic from ClusterOperatorReconciler related to
the status management into its own type - ClusterOperatorStatus.
It allows to reuse it in other controllers.
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 11, 2021

/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 11, 2021
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 12, 2021

/retest

This commit injects ClusterOperatorStatus struct into config sync
controller, which allows it to set the operator status.
This commit injects ClusterOperatorStatus struct into trusted ca
bundle controller, which allows it to set the operator status.
Before deploying CCM resources we need to check if dependant controllers
are available, and degrade the operator if any of them doesn't work
properly.
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 12, 2021

/test unit

This commit adds missing deletions of the cluster operator resource
after each test.
@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 13, 2021

/retest

@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 14, 2021

/test e2e-azure-ccm
/test e2e-aws-upgrade

@Fedosin
Copy link
Contributor Author

Fedosin commented Dec 15, 2021

/retest

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 15, 2021

@Fedosin: 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-upgrade 6306895 link true /test e2e-aws-upgrade
ci/prow/e2e-vsphere-ccm 6306895 link false /test e2e-vsphere-ccm

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

Looks good, just one stylistic nit, not a blocker though

@@ -30,10 +31,17 @@ const (
defaultManagementNamespace = "openshift-cloud-controller-manager-operator"
)

type ClusterOperatorStatusClient struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I find it odd that this is exported, even though none of the methods are. Perhaps instead of constructing this in a constructor in each controller?

@JoelSpeed
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 16, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

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 16, 2021
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest-required

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 70c35b3 into openshift:master Dec 16, 2021
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.

None yet

6 participants