Skip to content

send vgrc from provider to client #3275

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rewantsoni
Copy link
Member

@rewantsoni rewantsoni commented Jun 2, 2025

Send VGRC from the provider to the client.

Fixes: https://issues.redhat.com/browse/DFBUGS-2672

@rewantsoni
Copy link
Member Author

/retest-required

package util

import (
"context"
Copy link
Contributor

Choose a reason for hiding this comment

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

pls configure your editor to group the imports properly,

import (
    stdlib

    own-module

    third-party
)


resources := getKubeResourcesForClass(
consumer.Spec.VolumeGroupReplicationClasses,
"VolumeGroupSnapshotClass",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"VolumeGroupSnapshotClass",
"VolumeGroupReplicationClass",

remoteRbdStorageId string,
) ([]client.Object, error) {
if mirrorEnabled, err := s.isConsumerMirrorEnabled(ctx, consumer); err != nil {
return kubeResources, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return kubeResources, err
return nil, err

no need for caller to second guess

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2025
Comment on lines 1840 to 1843
} else if !mirrorEnabled {
klog.Infof("skipping distribution of VolumeGroupReplicationClass as mirroring is not enabled for the consumer")
return kubeResources, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the server condition the sending of the information to the client if mirroring is not enabled? I would say that this is more a confusing behavior then anything else. If the admin configured something to be sent it should be sent, if he didn't first enabled mirroring then it is his mistake but the system should continue to be consistent.

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 was following the same behaviour that we had for the Repliaction class, but I think we should have the behaviour that you specified. I will open a new PR to have the same behaviour for the Repliaction class as well

// pool name is added to the VGRC's template
poolName := vgrc.Spec.Parameters["pool"]
storageIDs := []string{rbdStorageId, remoteRbdStorageId, poolName}
slices.Sort(storageIDs)
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 wrong! it will create an assortment of potential orders between the storageId and the poolName.
You should sort only the storage ID and the name should be added last. Because we are only talking about 2 strings you don't need even apply a slice sort functionality, just a string compare functionality

storageIDs := []string{rbdStorageId, remoteRbdStorageId, poolName}
slices.Sort(storageIDs)
replicationID := CalculateMD5Hash(storageIDs)
vgrc.Spec.Parameters["replication.storage.openshift.io/group-replication-secret-name"] = consumerConfig.GetCsiRbdProvisionerCephUserName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason the replication class uses the same user as the storage class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Replication class requires the provisioner secret, which is similar to what we have for the snapshot classes

vgrc.Spec.Parameters["replication.storage.openshift.io/group-replication-secret-namespace"] = consumer.Status.Client.OperatorNamespace
vgrc.Spec.Parameters["clusterID"] = consumerConfig.GetRbdClientProfileName()
AddLabel(vgrc, ramenDRStorageIDLabelKey, rbdStorageId)
AddLabel(vgrc, ramenMaintenanceModeLabelKey, "Failover")
Copy link
Contributor

Choose a reason for hiding this comment

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

IF this is a constant in need to be part of the template

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, this is a constant. We could add it to the template for VGRC and VRC as well.

@Nikhil-Ladha This needs to be added to the VGRC and VRC template created by MCO

Copy link
Contributor

openshift-ci bot commented Jul 21, 2025

[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 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

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2025
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