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

provider: enable csi omap generator for client #2874

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

Conversation

rewantsoni
Copy link
Member

send a configMap from provider to client to enable csi-omap generator required for DR on client cluster

services/provider/server/server.go Outdated Show resolved Hide resolved
services/provider/server/server.go Outdated Show resolved Hide resolved
@rewantsoni rewantsoni force-pushed the csi-omap branch 2 times, most recently from b747ba5 to 8f2f36f Compare November 5, 2024 08:47
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

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 7, 2024
@rewantsoni rewantsoni force-pushed the csi-omap branch 2 times, most recently from bd2c11d to 3325edc Compare November 8, 2024 06:50
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 8, 2024
@rewantsoni rewantsoni force-pushed the csi-omap branch 2 times, most recently from 62ff5cf to 6a49ca6 Compare November 8, 2024 07:09
@@ -27,6 +27,10 @@ import (
v1 "github.com/red-hat-storage/ocs-operator/api/v4/v1"
)

const (
ClientMappingConfigMapName = "client-mapping-config"
Copy link
Contributor

Choose a reason for hiding this comment

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

'Client' and 'Mapping' are very generic terms when you consider all of ODF and not just RDR. Please choose a better name for the config map and the var

if err != nil {
return nil, err
}
_, hasClientID := clientMappingConfig.Data[req.StorageConsumerUUID]
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember the design was a mapping of client names not consumer uuids

Copy link
Member Author

Choose a reason for hiding this comment

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

From provider we are sending the storageConsumerUIDs, and MCO updates this configmap with local ClientID to remote ClientID

Comment on lines 228 to 231
clientMappingConfig, err := s.getClientMapping(ctx)
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why would we fail this function if there is not storage client id mapping config?

Copy link
Member Author

Choose a reason for hiding this comment

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

This function is failing in cases expect isNotFound

Comment on lines 430 to 436
clientMappingConfig, err := s.getClientMapping(ctx)
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as last comment

Copy link
Member Author

Choose a reason for hiding this comment

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

This function is failing in cases expect isNotFound

if err != nil {
return nil, err
}
_, hasClientID := clientMappingConfig.Data[string(consumerResource.UID)]
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not good enough, what if the mapping is broken? For example the key exists but not a value
I would suggest doing this instead

Suggested change
_, hasClientID := clientMappingConfig.Data[string(consumerResource.UID)]
clientIsMapped := clientMappingConfig.Data[string(consumerResource.UID)] != ""

Comment on lines 436 to 448
extR = append(extR, &pb.ExternalResource{
Name: "ocs-ceph-csi-config",
Kind: "ConfigMap",
Data: mustMarshal(map[string]string{
"CSI_ENABLE_OMAP_GENERATOR": strconv.FormatBool(hasClientID),
}),
})
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this ocs-ceph-csi-config? I believe that ceph csi operator is using a CR for that

Copy link
Member Author

Choose a reason for hiding this comment

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

The CR is created in operator_configmap controller, it is not sent from provider to the client.
The rpc calls are limited to storageClient/storageClaim controller. In order to pass information from storageClient to operator_configmap controller, creating this new configMap. operator_configMap will load this configMap and then set the fields as required

@@ -910,6 +941,17 @@ func (s *OCSProviderServer) getOCSSubscriptionChannel(ctx context.Context) (stri
return subscription.Spec.Channel, nil
}

func (s *OCSProviderServer) getClientMapping(ctx context.Context) (*corev1.ConfigMap, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What return a config map and not just map[string]string. You are not interested in the resource, just in the mapping.

Also, please rename this func to something more specific

send a configMap from provider to client to enable csi-omap
generator required for DR on client cluster

Signed-off-by: Rewant Soni <[email protected]>
Copy link
Contributor

openshift-ci bot commented Nov 13, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rewantsoni
Once this PR has been reviewed and has the lgtm label, please ask for approval from nb-ohad. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants