Skip to content

Commit

Permalink
api: add the kubeObjectSelector field to the drpc and vrg
Browse files Browse the repository at this point in the history
It shouldn't be required that one provides a recipe to select the kube
objects that need protection. It should be enough to provide the
selector without the recipe.

However, the kube object protection feature is still enabled by setting
the kubeObjectProtectionSpec field to not nil. Atleast an empty struct
must be provided.

Signed-off-by: Raghavendra Talur <[email protected]>
  • Loading branch information
raghavendra-talur authored and ShyamsundarR committed Mar 30, 2024
1 parent 6269b17 commit 2f4de7c
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1alpha1/volumereplicationgroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ type KubeObjectProtectionSpec struct {
// Recipe parameter definitions
//+optional
RecipeParameters map[string][]string `json:"recipeParameters,omitempty"`

// Label selector to identify all the kube objects that need DR protection.
// +optional
KubeObjectSelector *metav1.LabelSelector `json:"kubeObjectSelector,omitempty"`
}

type RecipeRef struct {
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

45 changes: 45 additions & 0 deletions config/crd/bases/ramendr.openshift.io_drplacementcontrols.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,51 @@ spec:
description: Preferred time between captures
format: duration
type: string
kubeObjectSelector:
description: Label selector to identify all the kube objects that
need DR protection.
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
required:
- key
- operator
type: object
type: array
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
recipeParameters:
additionalProperties:
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,51 @@ spec:
description: Preferred time between captures
format: duration
type: string
kubeObjectSelector:
description: Label selector to identify all the kube
objects that need DR protection.
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
required:
- key
- operator
type: object
type: array
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
recipeParameters:
additionalProperties:
items:
Expand Down
45 changes: 45 additions & 0 deletions config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,51 @@ spec:
description: Preferred time between captures
format: duration
type: string
kubeObjectSelector:
description: Label selector to identify all the kube objects that
need DR protection.
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
required:
- key
- operator
type: object
type: array
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
recipeParameters:
additionalProperties:
items:
Expand Down

0 comments on commit 2f4de7c

Please sign in to comment.