Skip to content

Commit

Permalink
Merge pull request #211 from umangachapagain/remove-MultiClusterServi…
Browse files Browse the repository at this point in the history
…ce-automation

remove unused configuration of MultiClusterService
  • Loading branch information
openshift-merge-bot[bot] authored Jun 11, 2024
2 parents 570778d + 7e3c771 commit acfbd5a
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 91 deletions.
53 changes: 0 additions & 53 deletions addons/agent_mirrorpeer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
multiclusterv1alpha1 "github.com/red-hat-storage/odf-multicluster-orchestrator/api/v1alpha1"
"github.com/red-hat-storage/odf-multicluster-orchestrator/controllers/utils"
rookv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
submarinerv1alpha1 "github.com/submariner-io/submariner-operator/api/v1alpha1"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -155,15 +154,6 @@ func (r *MirrorPeerReconciler) Reconcile(ctx context.Context, req ctrl.Request)
if len(errs) > 0 {
return ctrl.Result{}, fmt.Errorf("few failures occured while labeling RBD StorageClasses: %v", errs)
}

// Trying this at last to allow bootstrapping to be completed
if mirrorPeer.Spec.OverlappingCIDR {
klog.Info("enabling multiclusterservice", "MirrorPeer", mirrorPeer.GetName(), "Peers", mirrorPeer.Spec.Items)
err := r.enableMulticlusterService(ctx, scr.Name, scr.Namespace)
if err != nil {
return ctrl.Result{}, fmt.Errorf("failed to enable multiclusterservice for storagecluster %q in namespace %q: %v", scr.Name, scr.Namespace, err)
}
}
}
return ctrl.Result{}, nil
}
Expand Down Expand Up @@ -302,49 +292,6 @@ func (r *MirrorPeerReconciler) getS3bucket(ctx context.Context, mirrorPeer multi
return noobaaOBC, err
}

// enableMulticlusterService sets the multiclusterservice flag on StorageCluster if submariner globalnet is enabled
func (r *MirrorPeerReconciler) enableMulticlusterService(ctx context.Context, storageClusterName string, namespace string) error {
klog.Infof("Enabling MCS for StorageCluster %q in %q namespace.", storageClusterName, namespace)
var sc ocsv1.StorageCluster
err := r.SpokeClient.Get(ctx, types.NamespacedName{
Name: storageClusterName,
Namespace: namespace,
}, &sc)
if err != nil {
klog.Errorf("Error fetching StorageCluster while enabling MCS. Error: %v", err)
return err
}

var submariner submarinerv1alpha1.Submariner
err = r.SpokeClient.Get(ctx, types.NamespacedName{
Name: "submariner",
Namespace: "submariner-operator"},
&submariner)
if err != nil {
klog.Errorf("Error fetching Submariner config while enabling MCS. Error: %v", err)
return err
}

if sc.Spec.Network == nil {
sc.Spec.Network = &rookv1.NetworkSpec{}
klog.Infof("StorageCluster %q in %q namespace has no network config defined. Initializing it now. New NetworkSpec: %v", storageClusterName, namespace, sc.Spec.Network)
}

if !sc.Spec.Network.MultiClusterService.Enabled || sc.Spec.Network.MultiClusterService.ClusterID == "" {
sc.Spec.Network.MultiClusterService.Enabled = true
sc.Spec.Network.MultiClusterService.ClusterID = submariner.Spec.ClusterID
klog.Infof("StorageCluster %q in %q namespace has MCS disabled. Enabling it now. New MCS spec: %v", storageClusterName, namespace, sc.Spec.Network.MultiClusterService)
err := r.SpokeClient.Update(ctx, &sc)
if err != nil {
klog.Errorf("Error updating MCS config for StorageCluster %q in %q namespace. Error: %v", storageClusterName, namespace, err)
}
return err
}

klog.Infof("StorageCluster %q in %q namespace has MCS enabled already. Current MCS spec: %v", storageClusterName, namespace, sc.Spec.Network.MultiClusterService)
return nil
}

// enableMirroring is a wrapper function around toggleMirroring to enable mirroring in a storage cluster
func (r *MirrorPeerReconciler) enableMirroring(ctx context.Context, storageClusterName string, namespace string, mp *multiclusterv1alpha1.MirrorPeer) error {
return r.toggleMirroring(ctx, storageClusterName, namespace, true, mp)
Expand Down
2 changes: 0 additions & 2 deletions addons/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
multiclusterv1alpha1 "github.com/red-hat-storage/odf-multicluster-orchestrator/api/v1alpha1"
rookv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"github.com/spf13/cobra"
submarinerv1alpha1 "github.com/submariner-io/submariner-operator/api/v1alpha1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -57,7 +56,6 @@ func init() {
utilruntime.Must(ocsv1.AddToScheme(mgrScheme))
utilruntime.Must(obv1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(routev1.AddToScheme(mgrScheme))
utilruntime.Must(submarinerv1alpha1.AddToScheme(mgrScheme))
utilruntime.Must(rookv1.AddToScheme(mgrScheme))
utilruntime.Must(extv1.AddToScheme(mgrScheme))
//+kubebuilder:scaffold:scheme
Expand Down
8 changes: 0 additions & 8 deletions api/v1alpha1/mirrorpeer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ type MirrorPeerSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
ManageS3 bool `json:"manageS3,omitempty"`

// OverlappingCIDR should be set to true if the peer clusters
// have overlapping Pod or Service CIDR. This will enable storage
// clusters to use submariner globalnet. Enabling this will cause
// storage service disruption while network is being reconfigured.
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
OverlappingCIDR bool `json:"overlappingCIDR,omitempty"`
}

// MirrorPeerStatus defines the observed state of MirrorPeer
Expand Down
3 changes: 0 additions & 3 deletions api/v1alpha1/mirrorpeer_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ func (r *MirrorPeer) ValidateUpdate(old runtime.Object) (warnings admission.Warn
}
}

if oldMirrorPeer.Spec.OverlappingCIDR && !r.Spec.OverlappingCIDR {
return []string{}, fmt.Errorf("error updating MirrorPeer: OverlappingCIDR value can not be changed from %t to %t. This is to prevent Disaster Recovery from being unusable between clusters that have overlapping IPs", oldMirrorPeer.Spec.OverlappingCIDR, r.Spec.OverlappingCIDR)
}
return []string{}, validateMirrorPeer(r)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ spec:
manageS3:
default: false
type: boolean
overlappingCIDR:
default: false
description: |-
OverlappingCIDR should be set to true if the peer clusters
have overlapping Pod or Service CIDR. This will enable storage
clusters to use submariner globalnet. Enabling this will cause
storage service disruption while network is being reconfigured.
type: boolean
schedulingIntervals:
description: |-
SchedulingIntervals is a list of intervals at which mirroring snapshots are taken.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ spec:
manageS3:
default: false
type: boolean
overlappingCIDR:
default: false
description: |-
OverlappingCIDR should be set to true if the peer clusters
have overlapping Pod or Service CIDR. This will enable storage
clusters to use submariner globalnet. Enabling this will cause
storage service disruption while network is being reconfigured.
type: boolean
schedulingIntervals:
description: |-
SchedulingIntervals is a list of intervals at which mirroring snapshots are taken.
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/rook/rook/pkg/apis v0.0.0-20231204200402-5287527732f7
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.8.4
github.com/submariner-io/submariner-operator v0.17.0
golang.org/x/sync v0.5.0
k8s.io/api v0.29.2
k8s.io/apiextensions-apiserver v0.29.2
Expand Down Expand Up @@ -52,6 +51,7 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
Expand Down Expand Up @@ -93,8 +93,6 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stolostron/multicloud-operators-placementrule v1.2.4-1-20220311-8eedb3f.0.20230828200208-cd3c119a7fa0 // indirect
github.com/submariner-io/admiral v0.17.0 // indirect
github.com/submariner-io/submariner v0.17.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
Expand Down
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -778,12 +778,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/submariner-io/admiral v0.17.0 h1:Hz722z70W8hPAlKv/Y70MhNGwmmjl4eMZ+bDw9S+BAQ=
github.com/submariner-io/admiral v0.17.0/go.mod h1:OYkNN5EYaMZ1w1qxzVzD5q8hVNtojQkVoNPcO8/LL+Y=
github.com/submariner-io/submariner v0.17.0 h1:IrD2kqf+2pTLw5ldNycoPv7eKURngQWaQ06vX7/pvPY=
github.com/submariner-io/submariner v0.17.0/go.mod h1:mD6agq0P2OGSXHb74lblkSxGgxP7vy9/sa4ghzJBd1E=
github.com/submariner-io/submariner-operator v0.17.0 h1:7fQW/KAaCTP4HPzaIN0w/9u8j1rqwpQTfLjU2F+Z0zg=
github.com/submariner-io/submariner-operator v0.17.0/go.mod h1:/DrA6G1ll97bmyMvPDVj2OKU0htQUrYY0MtOpzlYM9I=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
Expand Down

0 comments on commit acfbd5a

Please sign in to comment.