-
Notifications
You must be signed in to change notification settings - Fork 185
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
Sends and labels V*ReplicationClass
, V*SnapClass
, StorageClass
to client
#2727
Conversation
/cc @Madhu-1 |
cb85825
to
eeb74d1
Compare
/cc @rewantsoni |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For Volume*ReplicationClass we are sending only the parameters field like we did for Volume*SnapshotClass and StorageClass, Should we send the entire spec for it or maybe the entire object that will allow us to add labels/annotations required (ramen labels, reclaimspace annotation) from the provider itself and the client would be responsible for adding missing fields like ProvisionerName and namespace for secrets and then creating/upating it.
@nb-ohad WDYT?
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/replication-secret-name": provisionerSecretName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For flattening VRC, we require the special parameter flattenMode: force
to be added, we should add it from the provider side
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raaizik I think this was missed
services/provider/server/server.go
Outdated
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/replication-secret-name": provisionerSecretName, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Along with the replication secret name, we also require mirroringMode key that can we sent from the provider, could you add that as well in all the V*RC?
Ref: https://github.com/red-hat-storage/odf-multicluster-orchestrator/blob/main/controllers/drpolicy_controller.go#L170-L178
services/provider/server/server.go
Outdated
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/group-replication-secret-name": provisionerSecretName, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For flattening VGRC, we require the special parameter flattenMode: force
to be added, we should add it from the provider side
@raaizik: GitHub didn't allow me to request PR reviews from the following users: Rakshith-R. Note that only red-hat-storage members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
/cc @Rakshith-R |
@raaizik: GitHub didn't allow me to request PR reviews from the following users: Rakshith-R. Note that only red-hat-storage members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this:
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. |
ffd5355
to
5c428c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"replication.storage.openshift.io/is-default-class": "true",
This should be added as a annotation
and
"replication.storage.openshift.io/flatten-mode": "force",
This as a label
hope both of the above will be handled accordingly in consumer side.
Other than the above, everything else looks good to me.
@Rakshith-R I'm aware and it will. |
I will start with the later proposal first:
We do not want to do that, an object contains not just desired state but also status and some metadata that is local to the provider cluster. In internal discussions, we already acknowledged the need to send labels and annotations but not as part of the serialized spec we send (the data field of the ExternalResource struct). The plan is to add it to the metadata of the
|
/test ocs-operator-bundle-e2e-aws |
1 similar comment
/test ocs-operator-bundle-e2e-aws |
/test ocs-operator-bundle-e2e-aws |
/lgtm |
a8d44cb
to
16961db
Compare
services/provider/server/server.go
Outdated
rns := &rookCephv1.CephBlockPoolRadosNamespace{} | ||
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 CephBlockPoolRadosNamespace. %v", cephRes.Name, err) | ||
} | ||
|
||
mirroringEnabled := len(rns.Spec.Mirroring.Mode) > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by it checks both?
We need to set this if mirroring is enabled, checking only if it is not nil should be sufficient
services/provider/server/server.go
Outdated
} | ||
case "StorageClass": | ||
if isMirroringReplicationEnabled { | ||
labels["ramendr.openshift.io/replicationid"] = replicationID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storageClass doesn't need the replicationID label
d65b1f2
to
cae0219
Compare
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/replication-secret-name": provisionerSecretName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raaizik I think this was missed
LGTM |
V*ReplicationClass
to clientV*ReplicationClass
, V*SnapClass
, StorageClass
to client
services/provider/server/server.go
Outdated
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", replicationEnabled, false, replicationID, storageID), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", replicationEnabled, false, replicationID, storageID), | |
}, | |
Labels: getExternalResourceLabels("VolumeSnapshotClass", replicationEnabled, false, replicationID, storageID), | |
}, |
services/provider/server/server.go
Outdated
&pb.ExternalResource{ | ||
Name: "cephfs", | ||
Kind: "VolumeGroupSnapshotClass", | ||
Data: mustMarshal(map[string]string{ | ||
"csi.storage.k8s.io/group-snapshotter-secret-name": provisionerSecretName, | ||
})}, | ||
}), | ||
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", replicationEnabled, false, replicationID, storageID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", replicationEnabled, false, replicationID, storageID), | |
Labels: getExternalResourceLabels("VolumeGroupSnapshotClass", replicationEnabled, false, replicationID, storageID), |
services/provider/server/server.go
Outdated
&pb.ExternalResource{ | ||
Name: "ceph-rbd", | ||
Kind: "VolumeGroupReplicationClass", | ||
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/group-replication-secret-name": provisionerSecretName, | ||
"mirroringMode": "snapshot", | ||
}), | ||
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", mirroringEnabled, false, replicationID, storageID), | ||
Annotations: map[string]string{ | ||
"replication.storage.openshift.io/is-default-class": "true", | ||
}, | ||
}, | ||
&pb.ExternalResource{ | ||
Name: "ceph-rbd-flatten", | ||
Kind: "VolumeGroupReplicationClass", | ||
Data: mustMarshal(map[string]string{ | ||
"replication.storage.openshift.io/group-replication-secret-name": provisionerSecretName, | ||
"mirroringMode": "snapshot", | ||
"flattenMode": "force", | ||
}), | ||
Labels: getExternalResourceLabels("VolumeGroupReplicationClass", mirroringEnabled, true, replicationID, storageID), | ||
Annotations: map[string]string{}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont have voluemegroupreplicationclass in 4.18 isnt it? can we remove this and add it later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&pb.ExternalResource{ | ||
Name: "cephfs", | ||
Kind: "VolumeGroupSnapshotClass", | ||
Data: mustMarshal(map[string]string{ | ||
"csi.storage.k8s.io/group-snapshotter-secret-name": provisionerSecretName, | ||
})}, | ||
}), | ||
Labels: getExternalResourceLabels("VolumeGroupSnapshotClass", replicationEnabled, false, replicationID, storageID), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should use consts for all class kinds, we are passing it as string in multiple places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you mean replace it in all places not just the function call -- I did that at first, but @nb-ohad opposed to the idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can easily make mistake when using string in multiple places. we need to have a var or const for it.
services/provider/server/server.go
Outdated
} | ||
case "VolumeSnapshotClass", "VolumeGroupSnapshotClass": | ||
if isMirroringReplicationEnabled { | ||
labels["ramendr.openshift.io/storageID"] = storageID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have a const for the label keys?
- Sends two V*RCs (one for image flattening) for RDR - Labels V*RepClass, V*SnapClass and StorageClass Signed-off-by: raaizik <[email protected]>
V*ReplicationClass
, V*SnapClass
, StorageClass
to clientVSnapReplicationClass
, V*SnapClass
, StorageClass
to client
VSnapReplicationClass
, V*SnapClass
, StorageClass
to clientV*ReplicationClass
, V*SnapClass
, StorageClass
to client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Madhu-1, nb-ohad, raaizik 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 |
fc3d188
into
red-hat-storage:main
Changes
RHSTOR-5753, RHSTOR-5794, RHSTOR-5754, RHSTOR-5873