Skip to content

Commit

Permalink
Merge pull request #2843 from rewantsoni/scp-api
Browse files Browse the repository at this point in the history
api: update the storageClusterPeer api
  • Loading branch information
openshift-merge-bot[bot] authored Nov 5, 2024
2 parents a2a119c + 73a9335 commit 9295290
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 591 deletions.
46 changes: 13 additions & 33 deletions api/v1/storageclusterpeer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,37 @@ limitations under the License.
package v1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// 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 NamespacedName struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}

// RemoteClusterSpec specifies the spec required for the remote cluster
type RemoteClusterSpec struct {
// ApiEndpoint is the URI of the ODF api server
ApiEndpoint string `json:"apiEndpoint"`

// OnboardingTicket holds an identity information required by the local ODF cluster to onboard.
OnboardingTicket string `json:"onboardingTicket"`

// StorageClusterName holds the namespacedName of the Remote ODF Cluster
StorageClusterName NamespacedName `json:"storageClusterName"`
}
type StorageClusterPeerState string

// LocalClusterSpec specifies the spec required for the local cluster
type LocalClusterSpec struct {
// Name holds the name of the local ODF cluster
Name corev1.LocalObjectReference `json:"name"`
}
const (
StorageClusterPeerStatePending StorageClusterPeerState = "Pending"
StorageClusterPeerStatePeered StorageClusterPeerState = "Peered"
)

// BlockPoolMirroringSpec enables setting up of mirroring for blockPools in the same namespace.
type BlockPoolMirroringSpec struct {
// Selector is used to select blockPools by label
Selector metav1.LabelSelector `json:"selector"`
type PeerInfo struct {
StorageClusterUid string `json:"storageClusterUid,omitempty"`
}

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

// RemoteCluster specifies the spec required for the remote cluster
RemoteCluster RemoteClusterSpec `json:"remoteCluster"`

// LocalCluster specifies the spec required for the local cluster
LocalCluster LocalClusterSpec `json:"localCluster"`
// ApiEndpoint is the URI of the ODF api server
ApiEndpoint string `json:"apiEndpoint"`

// BlockPoolMirroring indicates ceph block mirroring between block pool on the local and remote clusters
//+optional
BlockPoolMirroring *BlockPoolMirroringSpec `json:"blockPoolMirroring,omitempty"`
// OnboardingToken holds an identity information required by the local ODF cluster to onboard.
OnboardingToken string `json:"onboardingToken"`
}

// StorageClusterPeerStatus defines the observed state of StorageClusterPeer
type StorageClusterPeerStatus struct {
State StorageClusterPeerState `json:"state,omitempty"`
PeerInfo PeerInfo `json:"peerInfo"`
}

//+kubebuilder:object:root=true
Expand Down
66 changes: 6 additions & 60 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

123 changes: 19 additions & 104 deletions config/crd/bases/ocs.openshift.io_storageclusterpeers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,114 +40,29 @@ spec:
spec:
description: StorageClusterPeerSpec defines the desired state of StorageClusterPeer
properties:
blockPoolMirroring:
description: BlockPoolMirroring indicates ceph block mirroring between
block pool on the local and remote clusters
properties:
selector:
description: Selector is used to select blockPools by label
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
required:
- selector
type: object
localCluster:
description: LocalCluster specifies the spec required for the local
cluster
properties:
name:
description: Name holds the name of the local ODF cluster
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
required:
- name
type: object
remoteCluster:
description: RemoteCluster specifies the spec required for the remote
cluster
properties:
apiEndpoint:
description: ApiEndpoint is the URI of the ODF api server
type: string
onboardingTicket:
description: OnboardingTicket holds an identity information required
by the local ODF cluster to onboard.
type: string
storageClusterName:
description: StorageClusterName holds the namespacedName of the
Remote ODF Cluster
properties:
name:
type: string
namespace:
type: string
required:
- name
- namespace
type: object
required:
- apiEndpoint
- onboardingTicket
- storageClusterName
type: object
apiEndpoint:
description: ApiEndpoint is the URI of the ODF api server
type: string
onboardingToken:
description: OnboardingToken holds an identity information required
by the local ODF cluster to onboard.
type: string
required:
- localCluster
- remoteCluster
- apiEndpoint
- onboardingToken
type: object
status:
description: StorageClusterPeerStatus defines the observed state of StorageClusterPeer
properties:
peerInfo:
properties:
storageClusterUid:
type: string
type: object
state:
type: string
required:
- peerInfo
type: object
required:
- spec
Expand Down
Loading

0 comments on commit 9295290

Please sign in to comment.