Skip to content

Commit a8ad524

Browse files
add multiple label selector support to backup API
Signed-off-by: Shubham Pampattiwar <[email protected]> remove backup CLI bits Signed-off-by: Shubham Pampattiwar <[email protected]> labelselectors spec option for velero restore Signed-off-by: Shubham Pampattiwar <[email protected]> add changelog file Signed-off-by: Shubham Pampattiwar <[email protected]> update spec name to OrLabelSelectors Signed-off-by: Shubham Pampattiwar <[email protected]> minor fixes Signed-off-by: Shubham Pampattiwar <[email protected]> add validations for labelSelector and orLabelSelectors Signed-off-by: Shubham Pampattiwar <[email protected]> update crds.gp after fixing conflicts Signed-off-by: Shubham Pampattiwar <[email protected]> fix CI and add unit tests Signed-off-by: Shubham Pampattiwar <[email protected]> updated OrLabelSelector spec description and added validation failure unit tests Signed-off-by: Shubham Pampattiwar <[email protected]> add comments and change log level Signed-off-by: Shubham Pampattiwar <[email protected]> update site docs Signed-off-by: Shubham Pampattiwar <[email protected]> wrap pager client calls in a function Signed-off-by: Shubham Pampattiwar <[email protected]> resolve confilcts and update crds.go Signed-off-by: Shubham Pampattiwar <[email protected]> rebase and update crds.go Signed-off-by: Shubham Pampattiwar <[email protected]>
1 parent e51865e commit a8ad524

20 files changed

+450
-40
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add multiple label selector support to Velero Backup and Restore APIs

config/crd/v1/bases/velero.io_backups.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,61 @@ spec:
314314
type: string
315315
type: object
316316
type: object
317+
orLabelSelectors:
318+
description: OrLabelSelectors is list of metav1.LabelSelector to filter
319+
with when adding individual objects to the backup. If multiple provided
320+
they will be joined by the OR operator. LabelSelector as well as
321+
OrLabelSelectors cannot co-exist in backup request, only one of
322+
them can be used.
323+
items:
324+
description: A label selector is a label query over a set of resources.
325+
The result of matchLabels and matchExpressions are ANDed. An empty
326+
label selector matches all objects. A null label selector matches
327+
no objects.
328+
properties:
329+
matchExpressions:
330+
description: matchExpressions is a list of label selector requirements.
331+
The requirements are ANDed.
332+
items:
333+
description: A label selector requirement is a selector that
334+
contains values, a key, and an operator that relates the
335+
key and values.
336+
properties:
337+
key:
338+
description: key is the label key that the selector applies
339+
to.
340+
type: string
341+
operator:
342+
description: operator represents a key's relationship
343+
to a set of values. Valid operators are In, NotIn, Exists
344+
and DoesNotExist.
345+
type: string
346+
values:
347+
description: values is an array of string values. If the
348+
operator is In or NotIn, the values array must be non-empty.
349+
If the operator is Exists or DoesNotExist, the values
350+
array must be empty. This array is replaced during a
351+
strategic merge patch.
352+
items:
353+
type: string
354+
type: array
355+
required:
356+
- key
357+
- operator
358+
type: object
359+
type: array
360+
matchLabels:
361+
additionalProperties:
362+
type: string
363+
description: matchLabels is a map of {key,value} pairs. A single
364+
{key,value} in the matchLabels map is equivalent to an element
365+
of matchExpressions, whose key field is "key", the operator
366+
is "In", and the values array contains only "value". The requirements
367+
are ANDed.
368+
type: object
369+
type: object
370+
nullable: true
371+
type: array
317372
orderedResources:
318373
additionalProperties:
319374
type: string

config/crd/v1/bases/velero.io_restores.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,61 @@ spec:
17081708
included in the map will be restored into namespaces of the same
17091709
name.
17101710
type: object
1711+
orLabelSelectors:
1712+
description: OrLabelSelectors is list of metav1.LabelSelector to filter
1713+
with when restoring individual objects from the backup. If multiple
1714+
provided they will be joined by the OR operator. LabelSelector as
1715+
well as OrLabelSelectors cannot co-exist in restore request, only
1716+
one of them can be used
1717+
items:
1718+
description: A label selector is a label query over a set of resources.
1719+
The result of matchLabels and matchExpressions are ANDed. An empty
1720+
label selector matches all objects. A null label selector matches
1721+
no objects.
1722+
properties:
1723+
matchExpressions:
1724+
description: matchExpressions is a list of label selector requirements.
1725+
The requirements are ANDed.
1726+
items:
1727+
description: A label selector requirement is a selector that
1728+
contains values, a key, and an operator that relates the
1729+
key and values.
1730+
properties:
1731+
key:
1732+
description: key is the label key that the selector applies
1733+
to.
1734+
type: string
1735+
operator:
1736+
description: operator represents a key's relationship
1737+
to a set of values. Valid operators are In, NotIn, Exists
1738+
and DoesNotExist.
1739+
type: string
1740+
values:
1741+
description: values is an array of string values. If the
1742+
operator is In or NotIn, the values array must be non-empty.
1743+
If the operator is Exists or DoesNotExist, the values
1744+
array must be empty. This array is replaced during a
1745+
strategic merge patch.
1746+
items:
1747+
type: string
1748+
type: array
1749+
required:
1750+
- key
1751+
- operator
1752+
type: object
1753+
type: array
1754+
matchLabels:
1755+
additionalProperties:
1756+
type: string
1757+
description: matchLabels is a map of {key,value} pairs. A single
1758+
{key,value} in the matchLabels map is equivalent to an element
1759+
of matchExpressions, whose key field is "key", the operator
1760+
is "In", and the values array contains only "value". The requirements
1761+
are ANDed.
1762+
type: object
1763+
type: object
1764+
nullable: true
1765+
type: array
17111766
preserveNodePorts:
17121767
description: PreserveNodePorts specifies whether to restore old nodePorts
17131768
from backup.

config/crd/v1/bases/velero.io_schedules.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,61 @@ spec:
343343
type: string
344344
type: object
345345
type: object
346+
orLabelSelectors:
347+
description: OrLabelSelectors is list of metav1.LabelSelector
348+
to filter with when adding individual objects to the backup.
349+
If multiple provided they will be joined by the OR operator.
350+
LabelSelector as well as OrLabelSelectors cannot co-exist in
351+
backup request, only one of them can be used.
352+
items:
353+
description: A label selector is a label query over a set of
354+
resources. The result of matchLabels and matchExpressions
355+
are ANDed. An empty label selector matches all objects. A
356+
null label selector matches no objects.
357+
properties:
358+
matchExpressions:
359+
description: matchExpressions is a list of label selector
360+
requirements. The requirements are ANDed.
361+
items:
362+
description: A label selector requirement is a selector
363+
that contains values, a key, and an operator that relates
364+
the key and values.
365+
properties:
366+
key:
367+
description: key is the label key that the selector
368+
applies to.
369+
type: string
370+
operator:
371+
description: operator represents a key's relationship
372+
to a set of values. Valid operators are In, NotIn,
373+
Exists and DoesNotExist.
374+
type: string
375+
values:
376+
description: values is an array of string values.
377+
If the operator is In or NotIn, the values array
378+
must be non-empty. If the operator is Exists or
379+
DoesNotExist, the values array must be empty. This
380+
array is replaced during a strategic merge patch.
381+
items:
382+
type: string
383+
type: array
384+
required:
385+
- key
386+
- operator
387+
type: object
388+
type: array
389+
matchLabels:
390+
additionalProperties:
391+
type: string
392+
description: matchLabels is a map of {key,value} pairs.
393+
A single {key,value} in the matchLabels map is equivalent
394+
to an element of matchExpressions, whose key field is
395+
"key", the operator is "In", and the values array contains
396+
only "value". The requirements are ANDed.
397+
type: object
398+
type: object
399+
nullable: true
400+
type: array
346401
orderedResources:
347402
additionalProperties:
348403
type: string

0 commit comments

Comments
 (0)