Skip to content

Commit

Permalink
DRPolicy: add default values
Browse files Browse the repository at this point in the history
add empty default values to replicationClassSelector
and volumeSnapshotClassSelector fields using
kubebuilder CRD validation rules

Signed-off-by: rakeshgm <rakeshgm@redhat.com>
  • Loading branch information
rakeshgm authored and ShyamsundarR committed Apr 5, 2024
1 parent 0fa3664 commit 9d58e61
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha1/drpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type DRPolicySpec struct {
// need DR protection. It will be passed in to the VRG when it is created
//+optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:={}
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="replicationClassSelector is immutable"
ReplicationClassSelector metav1.LabelSelector `json:"replicationClassSelector"`

Expand All @@ -33,6 +34,7 @@ type DRPolicySpec struct {
// need DR protection. It will be passed in to the VRG when it is created
//+optional
// +kubebuilder:validation:Optional
// +kubebuilder:default:={}
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="volumeSnapshotClassSelector is immutable"
VolumeSnapshotClassSelector metav1.LabelSelector `json:"volumeSnapshotClassSelector"`

Expand Down
2 changes: 2 additions & 0 deletions config/crd/bases/ramendr.openshift.io_drpolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ spec:
- message: drClusters is immutable
rule: self == oldSelf
replicationClassSelector:
default: {}
description: |-
Label selector to identify all the VolumeReplicationClasses.
This selector is assumed to be the same for all subscriptions that
Expand Down Expand Up @@ -112,6 +113,7 @@ spec:
- message: schedulingInterval is immutable
rule: self == oldSelf
volumeSnapshotClassSelector:
default: {}
description: |-
Label selector to identify all the VolumeSnapshotClasses.
This selector is assumed to be the same for all subscriptions that
Expand Down

0 comments on commit 9d58e61

Please sign in to comment.