Skip to content

Commit

Permalink
config: crd changes for volumegroupreplication
Browse files Browse the repository at this point in the history
updated CRDs, fixed typos for volumegroupreplication

Signed-off-by: Nikhil-Ladha <[email protected]>
  • Loading branch information
Nikhil-Ladha committed Jan 16, 2025
1 parent ee41518 commit 4384b85
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ type VolumeGroupReplicationSpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupReplicationClassName is immutable"
VolumeGroupReplicationClassName string `json:"volumeGroupReplicationClassName"`

// volumeReplicationClassName is the volumeReplicationClass name for VolumeReplication object
// volumeReplicationClassName is the volumeReplicationClass name for the VolumeReplication object
// created for this volumeGroupReplication
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumReplicationClassName is immutable"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeReplicationClassName is immutable"
VolumeReplicationClassName string `json:"volumeReplicationClassName"`

// Name of the VolumeReplication object created for this volumeGroupReplication
Expand Down Expand Up @@ -65,7 +66,7 @@ type VolumeGroupReplicationSpec struct {
type VolumeGroupReplicationSource struct {
// Selector is a label query over persistent volume claims that are to be
// grouped together for replication.
// +optional
// +kubebuilder:validation:Required
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="selector is immutable"
Selector *metav1.LabelSelector `json:"selector,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ type VolumeGroupReplicationContentSpec struct {
// VolumeGroupReplicationContent object is bound.
// VolumeGroupReplication.Spec.VolumeGroupReplicationContentName field must reference to
// this VolumeGroupReplicationContent's name for the bidirectional binding to be valid.
// For a pre-existing VolumeGroupReplicationContent object, name and namespace of the
// VolumeGroupReplication object MUST be provided for binding to happen.
// This field is immutable after creation.
// Required.
// +kubebuilder:validation:XValidation:rule="has(self.name) && has(self.__namespace__)",message="both volumeGroupReplicationRef.name and volumeGroupReplicationRef.namespace must be set"
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="volumeGroupReplicationRef is immutable"
VolumeGroupReplicationRef corev1.ObjectReference `json:"volumeGroupReplicationRef"`
// For a pre-existing VolumeGroupReplication object, MUST provide an empty/nil value for
// VolumeGroupReplicationRef for the auto-binding to happen.
// +kubebuilder:validation:Optional
// +kubebuilder:validation:XValidation:rule="self != null ? has(self.name) && has(self.__namespace__) && has(self.uid) : true",message="volumeGroupReplicationRef.name, volumeGroupReplicationRef.namespace and volumeGroupReplicationRef.uid must be set if volumeGroupReplicationRef is defined"
VolumeGroupReplicationRef *corev1.ObjectReference `json:"volumeGroupReplicationRef,omitempty"`

// VolumeGroupReplicationHandle is a unique id returned by the CSI driver
// to identify the VolumeGroupReplication on the storage system.
// +kubebuilder:validation:Optional
VolumeGroupReplicationHandle string `json:"volumeGroupReplicationHandle"`

// provisioner is the name of the CSI driver used to create the physical
Expand All @@ -45,30 +44,34 @@ type VolumeGroupReplicationContentSpec struct {
// This MUST be the same as the name returned by the CSI GetPluginName() call for
// that driver.
// Required.
// +kubebuilder:validation:Required
Provisioner string `json:"provisioner"`

// VolumeGroupReplicationClassName is the name of the VolumeGroupReplicationClass from
// which this group replication was (or will be) created.
// +optional
// Required.
// +kubebuilder:validation:Required
VolumeGroupReplicationClassName string `json:"volumeGroupReplicationClassName"`

// Source specifies whether the snapshot is (or should be) dynamically provisioned
// or already exists, and just requires a Kubernetes object representation.
// This field is immutable after creation.
// Source specifies whether the volume group is (or should be) dynamically provisioned
// or already exists using the volumes listed here, and just requires a
// Kubernetes object representation.
// Required.
// +kubebuilder:validation:Required
Source VolumeGroupReplicationContentSource `json:"source"`
}

// VolumeGroupReplicationContentSource represents the CSI source of a group replication.
type VolumeGroupReplicationContentSource struct {
// VolumeHandles is a list of volume handles on the backend to be grouped
// and replicated.
// +kubebuilder:validation:Required
VolumeHandles []string `json:"volumeHandles"`
}

// VolumeGroupReplicationContentStatus defines the status of VolumeGroupReplicationContent
type VolumeGroupReplicationContentStatus struct {
// PersistentVolumeRefList is the list of of PV for the group replication
// PersistentVolumeRefList is the list of PV for the group replication
// The maximum number of allowed PV in the group is 100.
// +optional
PersistentVolumeRefList []corev1.LocalObjectReference `json:"persistentVolumeRefList,omitempty"`
Expand Down
6 changes: 5 additions & 1 deletion api/replication.storage/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ spec:
type: string
source:
description: |-
Source specifies whether the snapshot is (or should be) dynamically provisioned
or already exists, and just requires a Kubernetes object representation.
This field is immutable after creation.
Source specifies whether the volume group is (or should be) dynamically provisioned
or already exists using the volumes listed here, and just requires a
Kubernetes object representation.
Required.
properties:
volumeHandles:
Expand All @@ -71,6 +71,7 @@ spec:
description: |-
VolumeGroupReplicationClassName is the name of the VolumeGroupReplicationClass from
which this group replication was (or will be) created.
Required.
type: string
volumeGroupReplicationHandle:
description: |-
Expand All @@ -83,10 +84,8 @@ spec:
VolumeGroupReplicationContent object is bound.
VolumeGroupReplication.Spec.VolumeGroupReplicationContentName field must reference to
this VolumeGroupReplicationContent's name for the bidirectional binding to be valid.
For a pre-existing VolumeGroupReplicationContent object, name and namespace of the
VolumeGroupReplication object MUST be provided for binding to happen.
This field is immutable after creation.
Required.
For a pre-existing VolumeGroupReplication object, MUST provide an empty/nil value for
VolumeGroupReplicationRef for the auto-binding to happen.
properties:
apiVersion:
description: API version of the referent.
Expand Down Expand Up @@ -129,24 +128,23 @@ spec:
type: object
x-kubernetes-map-type: atomic
x-kubernetes-validations:
- message: both volumeGroupReplicationRef.name and volumeGroupReplicationRef.namespace
must be set
rule: has(self.name) && has(self.__namespace__)
- message: volumeGroupReplicationRef is immutable
rule: self == oldSelf
- message: volumeGroupReplicationRef.name, volumeGroupReplicationRef.namespace
and volumeGroupReplicationRef.uid must be set if volumeGroupReplicationRef
is defined
rule: 'self != null ? has(self.name) && has(self.__namespace__)
&& has(self.uid) : true'
required:
- provisioner
- source
- volumeGroupReplicationHandle
- volumeGroupReplicationRef
- volumeGroupReplicationClassName
type: object
status:
description: VolumeGroupReplicationContentStatus defines the status of
VolumeGroupReplicationContent
properties:
persistentVolumeRefList:
description: |-
PersistentVolumeRefList is the list of of PV for the group replication
PersistentVolumeRefList is the list of PV for the group replication
The maximum number of allowed PV in the group is 100.
items:
description: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ spec:
x-kubernetes-validations:
- message: selector is immutable
rule: self == oldSelf
required:
- selector
type: object
x-kubernetes-validations:
- message: source is immutable
Expand All @@ -131,11 +133,12 @@ spec:
- message: volumeGroupReplicationContentName is immutable
rule: self == oldSelf
volumeReplicationClassName:
description: volumeReplicationClassName is the volumeReplicationClass
name for VolumeReplication object
description: |-
volumeReplicationClassName is the volumeReplicationClass name for the VolumeReplication object
created for this volumeGroupReplication
type: string
x-kubernetes-validations:
- message: volumReplicationClassName is immutable
- message: volumeReplicationClassName is immutable
rule: self == oldSelf
volumeReplicationName:
description: Name of the VolumeReplication object created for this
Expand Down
37 changes: 19 additions & 18 deletions deploy/controller/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1414,9 +1414,9 @@ spec:
type: string
source:
description: |-
Source specifies whether the snapshot is (or should be) dynamically provisioned
or already exists, and just requires a Kubernetes object representation.
This field is immutable after creation.
Source specifies whether the volume group is (or should be) dynamically provisioned
or already exists using the volumes listed here, and just requires a
Kubernetes object representation.
Required.
properties:
volumeHandles:
Expand All @@ -1433,6 +1433,7 @@ spec:
description: |-
VolumeGroupReplicationClassName is the name of the VolumeGroupReplicationClass from
which this group replication was (or will be) created.
Required.
type: string
volumeGroupReplicationHandle:
description: |-
Expand All @@ -1445,10 +1446,8 @@ spec:
VolumeGroupReplicationContent object is bound.
VolumeGroupReplication.Spec.VolumeGroupReplicationContentName field must reference to
this VolumeGroupReplicationContent's name for the bidirectional binding to be valid.
For a pre-existing VolumeGroupReplicationContent object, name and namespace of the
VolumeGroupReplication object MUST be provided for binding to happen.
This field is immutable after creation.
Required.
For a pre-existing VolumeGroupReplication object, MUST provide an empty/nil value for
VolumeGroupReplicationRef for the auto-binding to happen.
properties:
apiVersion:
description: API version of the referent.
Expand Down Expand Up @@ -1491,24 +1490,23 @@ spec:
type: object
x-kubernetes-map-type: atomic
x-kubernetes-validations:
- message: both volumeGroupReplicationRef.name and volumeGroupReplicationRef.namespace
must be set
rule: has(self.name) && has(self.__namespace__)
- message: volumeGroupReplicationRef is immutable
rule: self == oldSelf
- message: volumeGroupReplicationRef.name, volumeGroupReplicationRef.namespace
and volumeGroupReplicationRef.uid must be set if volumeGroupReplicationRef
is defined
rule: 'self != null ? has(self.name) && has(self.__namespace__)
&& has(self.uid) : true'
required:
- provisioner
- source
- volumeGroupReplicationHandle
- volumeGroupReplicationRef
- volumeGroupReplicationClassName
type: object
status:
description: VolumeGroupReplicationContentStatus defines the status of
VolumeGroupReplicationContent
properties:
persistentVolumeRefList:
description: |-
PersistentVolumeRefList is the list of of PV for the group replication
PersistentVolumeRefList is the list of PV for the group replication
The maximum number of allowed PV in the group is 100.
items:
description: |-
Expand Down Expand Up @@ -1647,6 +1645,8 @@ spec:
x-kubernetes-validations:
- message: selector is immutable
rule: self == oldSelf
required:
- selector
type: object
x-kubernetes-validations:
- message: source is immutable
Expand All @@ -1666,11 +1666,12 @@ spec:
- message: volumeGroupReplicationContentName is immutable
rule: self == oldSelf
volumeReplicationClassName:
description: volumeReplicationClassName is the volumeReplicationClass
name for VolumeReplication object
description: |-
volumeReplicationClassName is the volumeReplicationClass name for the VolumeReplication object
created for this volumeGroupReplication
type: string
x-kubernetes-validations:
- message: volumReplicationClassName is immutable
- message: volumeReplicationClassName is immutable
rule: self == oldSelf
volumeReplicationName:
description: Name of the VolumeReplication object created for this
Expand Down

0 comments on commit 4384b85

Please sign in to comment.