Skip to content

Commit

Permalink
add logic for storageClusterPeer controller
Browse files Browse the repository at this point in the history
Signed-off-by: Rewant Soni <resoni@redhat.com>
  • Loading branch information
rewantsoni committed Jul 30, 2024
1 parent 2aa07b6 commit acef0db
Show file tree
Hide file tree
Showing 6 changed files with 594 additions and 19 deletions.
21 changes: 21 additions & 0 deletions api/v1/storageclusterpeer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@ import (

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

type StorageClusterPeerRemoteState string

const (
// StorageClusterPeerRemoteStateInitializing represents Initializing state of StorageClusterPeerState
StorageClusterPeerRemoteStateInitializing StorageClusterPeerRemoteState = "Initializing"
// StorageClusterPeerRemoteStateOnboarding represents Onboarding state of storageClusterPeer
StorageClusterPeerRemoteStateOnboarding StorageClusterPeerRemoteState = "Onboarding"
// StorageClusterPeerRemoteStateConnected represents Onboarding state of storageClusterPeer
StorageClusterPeerRemoteStateConnected StorageClusterPeerRemoteState = "Connected"
// StorageClusterPeerRemoteStateOffboarding represents Onboarding state of storageClusterPeer
StorageClusterPeerRemoteStateOffboarding StorageClusterPeerRemoteState = "Offboarding"
// StorageClusterPeerRemoteStateOffboarded represents Deleting state of StorageClusterPeerState
StorageClusterPeerRemoteStateOffboarded StorageClusterPeerRemoteState = "Offboarded"
)

type NamespacedName struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Expand Down Expand Up @@ -52,6 +68,10 @@ type BlockPoolMirroringSpec struct {
Selector metav1.LabelSelector `json:"selector"`
}

const (
StorageClusterPeerFinalizer = "storageclusterpeer.ocs.openshift.io"
)

// StorageClusterPeerSpec defines the desired state of StorageClusterPeer
type StorageClusterPeerSpec struct {

Expand All @@ -68,6 +88,7 @@ type StorageClusterPeerSpec struct {

// StorageClusterPeerStatus defines the observed state of StorageClusterPeer
type StorageClusterPeerStatus struct {
RemoteState StorageClusterPeerRemoteState `json:"remoteState,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
4 changes: 3 additions & 1 deletion controllers/storagecluster/cephblockpools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package storagecluster
import (
"context"
"fmt"

ocsv1 "github.com/red-hat-storage/ocs-operator/api/v4/v1"
"github.com/red-hat-storage/ocs-operator/v4/controllers/util"
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -75,6 +75,7 @@ func (r *StorageClusterReconciler) newCephBlockPoolInstances(initData *ocsv1.Sto
ObjectMeta: metav1.ObjectMeta{
Name: builtinMgrPoolName,
Namespace: poolNamespace,
Labels: map[string]string{util.CephBlockPoolForbidMirroringLabel: ""},
},
Spec: cephv1.NamedBlockPoolSpec{
Name: ".mgr",
Expand Down Expand Up @@ -125,6 +126,7 @@ func (r *StorageClusterReconciler) newCephBlockPoolInstances(initData *ocsv1.Sto
ObjectMeta: metav1.ObjectMeta{
Name: generateNameForCephNFSBlockPool(initData),
Namespace: initData.Namespace,
Labels: map[string]string{util.CephBlockPoolForbidMirroringLabel: ""},
},
Spec: cephv1.NamedBlockPoolSpec{
Name: ".nfs",
Expand Down
Loading

0 comments on commit acef0db

Please sign in to comment.