Skip to content

Commit

Permalink
Consider only available drclusters for s3 profiles
Browse files Browse the repository at this point in the history
When creating s3 profile names, include only the s3 profiles from
available drclusters.

This affects generating a VRG for manifestwork. When validating failover
prerequisites we already use only the failover clsuter, and this cluster
cannot be deleted.

Another case of drcluster deploy/undeploy flow, which still use all
drclusters and may require more work.

Signed-off-by: Nir Soffer <[email protected]>
  • Loading branch information
nirs authored and ShyamsundarR committed Dec 13, 2023
1 parent c533963 commit 948a47c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion controllers/drplacementcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"sigs.k8s.io/yaml"

rmn "github.com/ramendr/ramen/api/v1alpha1"
Expand Down Expand Up @@ -1501,7 +1502,7 @@ func (d *DRPCInstance) generateVRG(repState rmn.ReplicationState) rmn.VolumeRepl
Spec: rmn.VolumeReplicationGroupSpec{
PVCSelector: d.instance.Spec.PVCSelector,
ReplicationState: repState,
S3Profiles: rmnutil.DRPolicyS3Profiles(d.drPolicy, d.drClusters).List(),
S3Profiles: d.availableS3Profiles(),
KubeObjectProtection: d.instance.Spec.KubeObjectProtection,
},
}
Expand All @@ -1513,6 +1514,21 @@ func (d *DRPCInstance) generateVRG(repState rmn.ReplicationState) rmn.VolumeRepl
return vrg
}

func (d *DRPCInstance) availableS3Profiles() []string {
profiles := sets.New[string]()

for i := range d.drClusters {
drCluster := &d.drClusters[i]
if drClusterIsDeleted(drCluster) {
continue
}

profiles.Insert(drCluster.Spec.S3ProfileName)
}

return sets.List(profiles)
}

func (d *DRPCInstance) generateVRGSpecAsync() *rmn.VRGAsyncSpec {
if dRPolicySupportsRegional(d.drPolicy, d.drClusters) {
return &rmn.VRGAsyncSpec{
Expand Down

0 comments on commit 948a47c

Please sign in to comment.