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

remove storageClassClaim and add new storageClassRequest CR #1913

Conversation

subhamkrai
Copy link
Contributor

Signed-off-by: subhamkrai srai@redhat.com

@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 Jan 10, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 10, 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

@subhamkrai
Copy link
Contributor Author

/test all

@subhamkrai
Copy link
Contributor Author

/test all

@subhamkrai
Copy link
Contributor Author

/test all

@subhamkrai
Copy link
Contributor Author

/test all

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 20, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 24, 2023
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 21, 2023
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 30, 2023
@subhamkrai subhamkrai force-pushed the remove-storage-class-claim branch 7 times, most recently from 546e2c4 to efc8f0a Compare April 3, 2023 10:13
@subhamkrai subhamkrai marked this pull request as ready for review April 3, 2023 10:28
@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 Apr 3, 2023
Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

@subhamkrai Thanks for the required changes. @nb-ohad, this also needs some migration changes as storageclassclaim needs to be replaced with storageClassRequest in existing clusters.

@@ -244,26 +244,6 @@ type ExternalStorageClusterSpec struct {
//+kubebuilder:validation:Enum=ocs;rhcs
// StorageProviderKind Identify the type of storage provider cluster this consumer cluster is going to connect to.
StorageProviderKind ExternalStorageKind `json:"storageProviderKind,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

We dont need storageProviderKind also anymore?

Copy link
Member

Choose a reason for hiding this comment

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

lets keep it with rhcs mode also it might help in the future to add new functionalities

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there is no reference to this, so I removed it. Also, in case required in the future, we can add it later.

Copy link
Member

Choose a reason for hiding this comment

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

lets keep it for now as am not sure if someone is using this field other than managed service

Copy link
Contributor

Choose a reason for hiding this comment

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

@Madhu-1 The default was always RHCS, so no RHCS deployment was using it. And the only other value is ODF which now becomes irrelevant. I think a quick search on the codebase will assure you that this is not even looked at. If I am mistaken here we can keep it

Copy link
Member

Choose a reason for hiding this comment

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

Yes you are correct, it's not used anywhere to be on the safer side we are not removing the Field from the Spec to avoid the foreseen problem, we can also remove it later if it's not used by others after some confirmation.


const (
StorageClassRequestFinalizer = "StorageClassRequest.ocs.openshift.io"
StorageClassRequestAnnotation = "ocs.openshift.io.fulfillstoragesclassclaim"
Copy link
Member

Choose a reason for hiding this comment

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

The annotation value need to be changed to math storageClassRequest

@@ -0,0 +1,62 @@
apiVersion: operators.coreos.com/v1alpha1
Copy link
Member

Choose a reason for hiding this comment

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

Why we got the new CSV file here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my branch is older, so before fusion addition, it was like this. So, I removed the file now. Thanks

@@ -54,15 +54,14 @@ func (cc *OCSProviderClient) Close() {

// OnboardConsumer to validate the consumer and create StorageConsumer
// resource on the StorageProvider cluster
func (cc *OCSProviderClient) OnboardConsumer(ctx context.Context, ticket, name, capacity string) (*pb.OnboardConsumerResponse, error) {
func (cc *OCSProviderClient) OnboardConsumer(ctx context.Context, ticket, name string) (*pb.OnboardConsumerResponse, error) {
Copy link
Member

Choose a reason for hiding this comment

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

we dont need any change in this file as its a GRPC client

Copy link
Member

Choose a reason for hiding this comment

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

Just remove the capacity nothing else

@@ -26,10 +26,10 @@ service OCSProvider {
rpc AcknowledgeOnboarding(AcknowledgeOnboardingRequest)
returns (AcknowledgeOnboardingResponse){}

// FulfillStorageClassClaim RPC call to create the StorageclassClaim CR on
// StorageClassRequest RPC call to create the StorageclassClaim CR on
Copy link
Member

Choose a reason for hiding this comment

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

No change is required in proto file as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to change terminology? We are still fulfilling a storageclassclaim (not request) so I am not sure why is this change here.

@@ -76,14 +76,14 @@ func NewOCSProviderServer(ctx context.Context, namespace string) (*OCSProviderSe

storageClassClaimManager, err := newStorageClassClaimManager(ctx, client, namespace)
Copy link
Member

Choose a reason for hiding this comment

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

newStorageClassClaimManager need to be changed to newStorageClassRequestManager

// provider cluster.
func (s *OCSProviderServer) FulfillStorageClassClaim(ctx context.Context, req *pb.FulfillStorageClassClaimRequest) (*pb.FulfillStorageClassClaimResponse, error) {
func (s *OCSProviderServer) StorageClassRequest(ctx context.Context, req *pb.StorageClassRequestRequest) (*pb.StorageClassRequestResponse, error) {
Copy link
Member

Choose a reason for hiding this comment

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

the RPC calls should remain the same only the CRD create/Delete/Get API calls need to be changed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

got it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to change terminology? We are still fulfilling a storageclassclaim (not request) so I am not sure why is this change here.

metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec StorageClassRequestSpec `json:"spec,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

not related to this PR but Spec is a required field not a optional to do omitempty

Comment on lines 204 to 210
- apiGroups:
- ocs.openshift.io
resources:
- storageclassrequests
verbs:
- get
- list
Copy link
Member

Choose a reason for hiding this comment

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

Why did this gets added new?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be good now

var result reconcile.Result
var reconcileError error

result, reconcileError = r.reconcileProviderPhases()
Copy link
Member

Choose a reason for hiding this comment

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

call this as reconcilePhases()?

main.go Outdated
Comment on lines 171 to 178
if err = (&controllers.StorageConsumerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("StorageConsumer"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "StorageConsumer")
os.Exit(1)
}
Copy link
Member

Choose a reason for hiding this comment

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

Why storageConsumer is removed?

@@ -74,16 +74,16 @@ func NewOCSProviderServer(ctx context.Context, namespace string) (*OCSProviderSe
return nil, fmt.Errorf("failed to create new OCSConumer instance. %v", err)
}

storageClassClaimManager, err := newStorageClassClaimManager(ctx, client, namespace)
storageClassRequestManager, err := newStorageClassClaimManager(ctx, client, namespace)
Copy link
Member

Choose a reason for hiding this comment

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

still its calling newStorageClassClaimManager

@Madhu-1 Madhu-1 requested a review from nb-ohad April 3, 2023 12:26
@rewantsoni
Copy link
Member

Tested migration of the provider and consumer with the build shared by Subham and it was a success. @Madhu-1 @subhamkrai

image

image

@Madhu-1 Madhu-1 requested a review from iamniting April 12, 2023 06:36
Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -33,16 +33,16 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"k8s.io/klog"
Copy link
Member

Choose a reason for hiding this comment

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

this is not addressed yet.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2023
@Madhu-1
Copy link
Member

Madhu-1 commented Apr 12, 2023

Tested migration of the provider and consumer with the build shared by Subham and it was a success. @Madhu-1 @subhamkrai

image

image

Thank you @rewantsoni for testing it.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Apr 12, 2023
@subhamkrai
Copy link
Contributor Author

Tested migration of the provider and consumer with the build shared by Subham and it was a success. @Madhu-1 @subhamkrai

image

image

thanks @rewantsoni for testing

@@ -98,11 +98,6 @@ properties:
group: ocs.openshift.io
kind: OCSInitialization
version: v1
- type: olm.gvk
Copy link
Member

Choose a reason for hiding this comment

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

@subhamkrai Can you drop this change also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted. Thanks!

from 4.13 we are moving from storageClassClaim
to storageClassRequest CR. Also, we don't need
consumer mode code in ocs-operator now, new operator
will have  consumer.

Signed-off-by: subhamkrai <srai@redhat.com>
Signed-off-by: subhamkrai <srai@redhat.com>
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 13, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: iamniting, Madhu-1, subhamkrai

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 Apr 13, 2023
@openshift-merge-robot openshift-merge-robot merged commit ee09e5d into red-hat-storage:main Apr 13, 2023
17 checks passed
@iamniting
Copy link
Member

/cherry-pick release-4.13

@openshift-cherrypick-robot

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

Applying: remove storageClassClaim and add new cr
Using index info to reconstruct a base tree...
M	controllers/storageclassclaim/storageclassclaim_controller.go
M	controllers/storagecluster/external_resources.go
Falling back to patching base and 3-way merge...
Removing services/provider/server/storageclaim_test.go
Removing services/provider/server/storageclaim.go
Removing services/consumer/main.go
Removing deploy/ocs-operator/manifests/storageclassclaim.crd.yaml
Removing deploy/ics-operator/manifests/storageclassclaim.crd.yaml
Auto-merging controllers/storagecluster/external_resources.go
Removing controllers/storagecluster/external_ocs.go
CONFLICT (modify/delete): controllers/storageclassclaim/storageclassclaim_controller.go deleted in remove storageClassClaim and add new cr and modified in HEAD. Version HEAD of controllers/storageclassclaim/storageclassclaim_controller.go left in tree.
Removing config/rbac/storageclassclaim_viewer_role.yaml
Removing config/rbac/storageclassclaim_editor_role.yaml
Removing config/crd/bases/ocs.openshift.io_storageclassclaims.yaml
Removing api/v1alpha1/storageclassclaim_types.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 remove storageClassClaim and add new cr
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/test-infra repository.

@iamniting
Copy link
Member

@subhamkrai Can you pls create a manual backport?

@subhamkrai subhamkrai deleted the remove-storage-class-claim branch April 13, 2023 07:09
@subhamkrai
Copy link
Contributor Author

@subhamkrai Can you pls create a manual backport?

here #2007

@iamniting iamniting changed the title Bug 2184769: remove storageClassClaim and add new storageClassRequest CR remove storageClassClaim and add new storageClassRequest CR Apr 13, 2023
@iamniting iamniting removed bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. bugzilla/severity-unspecified Referenced Bugzilla bug's severity is unspecified for the PR. labels Apr 13, 2023
Namespace: s.namespace,
Labels: map[string]string{
controllers.ConsumerUUIDLabel: consumerUUID,
storageClassRequestName: storageClassRequestName,
Copy link
Member

Choose a reason for hiding this comment

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

@subhamkrai This should be storageClassClaimNameLabel we are adding name for both the label key and label value.

Copy link
Member

Choose a reason for hiding this comment

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

Let's prioritize it and get it in both 4.13 and 4.12

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

8 participants