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

controllers: Do not update client operator in provider mode #393

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

iamniting
Copy link
Member

Client operator manages its own upgrade life cycle in the provider mode, Do not update its channel in the provider mode.

Signed-off-by: Nitin Goyal [email protected]

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 2, 2024
@iamniting iamniting requested a review from leelavg April 3, 2024 11:27
@@ -259,6 +263,7 @@ func (r *StorageSystemReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&odfv1alpha1.StorageSystem{}, builder.WithPredicates(generationChangedPredicate)).
Owns(&operatorv1alpha1.Subscription{}, builder.WithPredicates(generationChangedPredicate, ignoreCreatePredicate)).
Owns(&ocsv1.StorageCluster{}, builder.WithPredicates(generationChangedPredicate)).
Copy link
Contributor

Choose a reason for hiding this comment

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

in existing code, is storagesystem being set as a controller owner for storagecluster?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@@ -51,6 +52,14 @@ func CheckExistingSubscriptions(cli client.Client, desiredSubscription *operator
odfSub.Spec.Config = &operatorv1alpha1.SubscriptionConfig{}
}

var isProvider bool
if desiredSubscription.Spec.Package == OcsClientSubscriptionPackage {
Copy link
Contributor

Choose a reason for hiding this comment

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

is OcsClientSubscriptionPackage already defined? lint might've already failed but just confirming.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it is defined in the defaults.go

Comment on lines +81 to +83
if !isProvider {
actualSub.Spec.Channel = desiredSubscription.Spec.Channel
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I see only channel update is being skipped, no qualms w/ that, small question, does odf-operator overwrites any metadata in the subscription?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, it does not overwrite metadata.

@@ -102,6 +114,23 @@ func CheckExistingSubscriptions(cli client.Client, desiredSubscription *operator
return desiredSubscription, nil
}

func isProviderServer(cli client.Client) (bool, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure isProviderServer sounds correct, to be abstract can use isProviderMode or to be exact can use isAllowRemoteStorageConsumersSet

Copy link
Member Author

Choose a reason for hiding this comment

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

I will change it to isProviderMode as we always refer it as provider.

Comment on lines +119 to +131
storageclusters := &ocsv1.StorageClusterList{}
err := cli.List(context.TODO(), storageclusters)
if err != nil {
return false, err
}

for _, storagecluster := range storageclusters.Items {
if storagecluster.Spec.AllowRemoteStorageConsumers {
return true, nil
}
}

return false, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

sry, this seems a lot of work to find the fields values, not mandatory and here's what I'm thinking, cli.List will try to list storageclusters in all namespaces and storagecluster in for loop is making a copy of every storagecluster in the Items.

It might be good to limit the result to operator ns and taken an index into Items? again, only a suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would say let it be. We may extend the func later on.

Client operator manages its own upgrade life cycle in the provider mode,
Do not update its channel in the provider mode.

Signed-off-by: Nitin Goyal <[email protected]>
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2024
Copy link
Contributor

openshift-ci bot commented Apr 4, 2024

[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-merge-bot openshift-merge-bot bot merged commit 096506a into red-hat-storage:main Apr 4, 2024
16 checks passed
@iamniting
Copy link
Member Author

/cherry-pick release-4.16

@openshift-cherrypick-robot

@iamniting: new pull request created: #395

In response to this:

/cherry-pick release-4.16

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.

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.

3 participants