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

[WIP] Adds metadata to storage claim response proto message #2620

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raaizik
Copy link
Contributor

@raaizik raaizik commented May 20, 2024

Changes

Adds metadata field to storage claim response proto message that contains a mirroring flag of CephBlockPool to be read directly from the StorageClaim's controller which will in turn label the StorageClass with the required Ramen labels that allow RBD mirroring.

RHSTOR-5754

Copy link
Contributor

openshift-ci bot commented May 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: raaizik
Once this PR has been reviewed and has the lgtm label, please assign agarwal-mudit for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@raaizik
Copy link
Contributor Author

raaizik commented May 20, 2024

/cc @nb-ohad

@openshift-ci openshift-ci bot requested a review from nb-ohad May 20, 2024 18:15
@raaizik raaizik changed the title Add mirroring flag to the block pool's data Adds mirroring flag to the block pool's data May 20, 2024
@raaizik
Copy link
Contributor Author

raaizik commented May 21, 2024

/retest

@raaizik raaizik force-pushed the RHSTOR-5754 branch 2 times, most recently from 92d4cf5 to 60764a0 Compare May 23, 2024 10:31
@raaizik
Copy link
Contributor Author

raaizik commented May 23, 2024

/cc @rewantsoni

@openshift-ci openshift-ci bot requested a review from rewantsoni May 23, 2024 11:37
Comment on lines 596 to 606
cbp := &rookCephv1.CephBlockPool{}
err = s.client.Get(ctx, types.NamespacedName{Name: cephRes.Name, Namespace: s.namespace}, rns)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get %s CephBlockPool. %v", cephRes.Name, err)
}

Copy link
Member

Choose a reason for hiding this comment

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

Not sure what you are trying to achieve here, you are creating a cpb var but you are getting the radosnamespace.
Also, we should not depend on one cephBlockPool to decide if we are enabling mirroring or not. There might be a case where we might need to blacklist some blockpools for mirroring.

Copy link
Contributor Author

@raaizik raaizik May 23, 2024

Choose a reason for hiding this comment

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

No, I'm tagging the CBPRN class with a flag that will signal to StorageClaim's controller whether mirroring's enabled for said class.

There might be a case where we might need to blacklist some blockpools for mirroring.

Care to elaborate? What indicates a blacklisted pool? Either way, it's something that's better off handled on the client.

Copy link
Member

Choose a reason for hiding this comment

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

err = s.client.Get(ctx, types.NamespacedName{Name: cephRes.Name, Namespace: s.namespace}, rns)

You are getting the rns here, not the cbl, is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed over DMs:

  • CBP is the only source to fetch the mirroring flag from.
  • In case of blacklisted pools we can have their flag indicating that override the mirroring flag.

Comment on lines 596 to 606
cbp := &rookCephv1.CephBlockPool{}
err = s.client.Get(ctx, types.NamespacedName{Name: cephRes.Name, Namespace: s.namespace}, rns)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get %s CephBlockPool. %v", cephRes.Name, err)
}

Copy link
Member

Choose a reason for hiding this comment

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

err = s.client.Get(ctx, types.NamespacedName{Name: cephRes.Name, Namespace: s.namespace}, rns)

You are getting the rns here, not the cbl, is this intended?

Comment on lines 620 to 634
rbdStorageClassMetaData := map[string]string{
"mirroring": fmt.Sprintf("%v", cbp.Spec.Mirroring.Enabled),
}
Copy link
Member

Choose a reason for hiding this comment

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

If I am not wrong this will always be false, as you are haven't fetched the cbp

Copy link
Contributor Author

@raaizik raaizik May 23, 2024

Choose a reason for hiding this comment

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

You are getting the rns here, not the cbl, is this intended?

CBPRN and its respective CPB carry the same name.

@raaizik raaizik force-pushed the RHSTOR-5754 branch 3 times, most recently from 62ee5f8 to 97ff9bd Compare May 23, 2024 14:14
@raaizik raaizik changed the title Adds mirroring flag to the block pool's data [WIP] Adds mirroring flag to the block pool's data May 27, 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 May 27, 2024
@raaizik raaizik changed the title [WIP] Adds mirroring flag to the block pool's data [WIP] Adds metadata to ceph resources May 28, 2024
@raaizik raaizik force-pushed the RHSTOR-5754 branch 7 times, most recently from 4652707 to a052245 Compare May 30, 2024 16:02
@raaizik raaizik changed the title [WIP] Adds metadata to ceph resources [WIP] Adds metadata to storage storage claim response proto message May 30, 2024
@raaizik raaizik changed the title [WIP] Adds metadata to storage storage claim response proto message [WIP] Adds metadata to storage claim response proto message May 30, 2024
@raaizik
Copy link
Contributor Author

raaizik commented Jun 3, 2024

/retest

@raaizik raaizik force-pushed the RHSTOR-5754 branch 3 times, most recently from af4ca4a to 1e7beac Compare June 3, 2024 10:24
@rewantsoni
Copy link
Member

/retest-required

@raaizik raaizik changed the title [WIP] Adds metadata to storage claim response proto message Adds metadata to storage claim response proto message Jun 3, 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 Jun 3, 2024
Signed-off-by: raaizik <132667934+raaizik@users.noreply.github.com>
@Nikhil-Ladha
Copy link
Member

/retest

@raaizik raaizik requested a review from rewantsoni June 5, 2024 08:26
@rewantsoni
Copy link
Member

Changes

Adds metadata field to storage claim response proto message that contains a mirroring flag of CephBlockPool to be read directly from the StorageClaim's controller which will in turn label the StorageClass with the required Ramen labels that allow RBD mirroring.

RHSTOR-5754

I went through the PR and this works in the case of storageClaim of type block, if I am not wrong we also need to label the storageClass created by storageClaim of type filesystem as well right? How are we handling that?

@raaizik
Copy link
Contributor Author

raaizik commented Jun 9, 2024

Changes

Adds metadata field to storage claim response proto message that contains a mirroring flag of CephBlockPool to be read directly from the StorageClaim's controller which will in turn label the StorageClass with the required Ramen labels that allow RBD mirroring.
RHSTOR-5754

I went through the PR and this works in the case of storageClaim of type block, if I am not wrong we also need to label the storageClass created by storageClaim of type filesystem as well right? How are we handling that?

For Volume*SnapshotClass, the SID can be applied for backed classes of both types.
For Volume*ReplicationClass, the RepID can only be applied when there are two peered EPs. Can add a Replication flag (that I'd need to figure out how to populate) along with the Mirroring flag. @rewantsoni

@raaizik raaizik changed the title Adds metadata to storage claim response proto message [WIP] Adds metadata to storage claim response proto message Jun 10, 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 Jun 10, 2024
@@ -153,6 +153,8 @@ message StorageClaimConfigRequest{
message StorageClaimConfigResponse{
// ExternalResource holds the configuration data of external storage cluster
repeated ExternalResource externalResource = 1;
// MetaData contains additional info regarding the external cluster resources
bytes MetaData = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to Title case the field as generated proto already gives us an exported field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be. I will take this into account.

@@ -153,6 +153,8 @@ message StorageClaimConfigRequest{
message StorageClaimConfigResponse{
// ExternalResource holds the configuration data of external storage cluster
repeated ExternalResource externalResource = 1;
// MetaData contains additional info regarding the external cluster resources
bytes MetaData = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

after going through PR, why not bool enableMirroring = 2;? why do we need to convert bool (cbp.Spec.Mirroring.Enabled) into string (%v) and then encode to bytes (json.Marshal)

The default proto value will be false anyways, unless false is also a valid value like after enabling you could disable we don't need to use bool pointer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See first link in the description of the attached Jira for design details, @leelavg. We're looking at a feature that would allow us to add multiple fields that are considered as metadata. Once this PR's WIP tag is removed, there will be two flags appended to the metadata field.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants