Add VolumeGroupSnapshot API definition, including CRD, client,

informer and lister generated code.
Update ./client/hack/README with instructions to update the client
directory.
This commit is contained in:
Raunak Pradip Shah
2023-02-24 14:26:45 +05:30
parent 0559478fc0
commit 0f5bcc4ff3
122 changed files with 6142 additions and 89 deletions

View File

@@ -0,0 +1,65 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumegroupsnapshotclasses.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshotClass
listKind: VolumeGroupSnapshotClassList
plural: volumegroupsnapshotclasses
shortNames:
- vsgclass
- vsgclasses
singular: volumegroupsnapshotclass
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: VolumeGroupSnapshotClass is the Schema for the volumegroupsnapshotclass
API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
deletionPolicy:
description: DeletionPolicy determines whether a VolumeGroupSnapshotContent
created through the VolumeGroupSnapshotClass should be deleted when
its bound VolumeGroupSnapshot is deleted. Supported values are "Retain"
and "Delete". Required.
enum:
- Delete
- Retain
type: string
driver:
description: Driver is the name of the storage driver expected to handle
this VolumeGroupSnapshotClass. Required.
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
parameters:
additionalProperties:
type: string
description: Parameters is a key-value map with storage driver specific
parameters for creating group snapshots. These values are opaque to
the system and are passed directly to the driver.
type: object
required:
- deletionPolicy
- driver
type: object
served: true
storage: true
subresources:
status: {}

View File

@@ -0,0 +1,249 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumegroupsnapshotcontents.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshotContent
listKind: VolumeGroupSnapshotContentList
plural: volumegroupsnapshotcontents
shortNames:
- vsc
- vgscs
singular: volumegroupsnapshotcontent
scope: Cluster
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: VolumeGroupSnapshotContent represents the actual "on-disk" group
snapshot object in the underlying storage system
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
spec:
description: VolumeGroupSnapshotContentSpec describes the common attributes
of a group snapshot content
properties:
deletionPolicy:
description: DeletionPolicy determines whether this VolumeGroupSnapshotContent
and the physical snapshots on the underlying storage system should
be deleted when the bound VolumeGroupSnapshot is deleted. Supported
values are "Retain" and "Delete". For dynamically provisioned group
snapshots, this field will automatically be filled in by the CSI
snapshotter sidecar with the "DeletionPolicy" field defined in the
corresponding VolumeGroupSnapshotClass. For pre-existing snapshots,
users MUST specify this field when creating the VolumeGroupSnapshotContent
object. Required.
enum:
- Delete
- Retain
type: string
driver:
description: Driver is the name of the CSI driver used to create the
physical group snapshot on the underlying storage system. This MUST
be the same as the name returned by the CSI GetPluginName() call
for that driver. Required.
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. Required.
properties:
persistentVolumeNames:
description: PersistentVolumeNames is a list of names of PersistentVolumes
to be snapshotted together. Signifies dynamic provisioning of
the VolumeGroupSnapshot. This field is immutable.
items:
type: string
type: array
volumeGroupSnapshotHandle:
description: VolumeGroupSnapshotHandle specifies the CSI "snapshot_id"
of a pre-existing snapshot on the underlying storage system
for which a Kubernetes object representation was (or should
be) created. This field is immutable.
type: string
type: object
volumeGroupSnapshotClassName:
description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
from which this group snapshot was (or will be) created. Note that
after provisioning, the VolumeGroupSnapshotClass may be deleted
or recreated with different set of values, and as such, should not
be referenced post-snapshot creation. For dynamic provisioning,
this field must be set. This field may be unset for pre-provisioned
snapshots.
type: string
volumeGroupSnapshotRef:
description: VolumeGroupSnapshotRef specifies the VolumeGroupSnapshot
object to which this VolumeGroupSnapshotContent object is bound.
VolumeGroupSnapshot.Spec.VolumeGroupSnapshotContentName field must
reference to this VolumeGroupSnapshotContent's name for the bidirectional
binding to be valid. For a pre-existing VolumeGroupSnapshotContent
object, name and namespace of the VolumeGroupSnapshot object MUST
be provided for binding to happen. This field is immutable after
creation. Required.
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
required:
- deletionPolicy
- driver
- source
- volumeGroupSnapshotRef
type: object
status:
description: VolumeGroupSnapshotContentStatus defines the observed state
of VolumeGroupSnapshotContent.
properties:
creationTime:
description: CreationTime is the timestamp when the point-in-time
group snapshot is taken by the underlying storage system. If not
specified, it indicates the creation time is unknown.
format: int64
type: integer
error:
description: Error is the last observed error during group snapshot
creation, if any. Upon success after retry, this error field will
be cleared.
properties:
message:
description: 'Message is a string detailing the encountered error
during snapshot creation if specified. NOTE: message may be
logged, and it should not contain sensitive information.'
type: string
time:
description: Time is the timestamp when the error was encountered.
format: date-time
type: string
type: object
readyToUse:
description: ReadyToUse indicates if all the individual snapshots
in the group are ready to be used to restore a volume. If not specified,
it means the readiness of a group snapshot is unknown.
type: boolean
volumeGroupSnapshotHandle:
description: VolumeGroupSnapshotHandle is a unique id returned by
the CSI driver to identify the VolumeGroupSnapshot on the storage
system. If a storage system does not provide such an id, the CSI
driver can choose to return the VolumeGroupSnapshot name.
type: string
volumeSnapshotRefList:
description: VolumeSnapshotContentRefList is the list of volume snapshot
content references for this group snapshot. The maximum number of
allowed snapshots in the group is 100.
items:
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, \"must refer only to types A and B\" or \"UID not honored\"
or \"name must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because this type
is embedded in many locations, updates to this type will affect
numerous schemas. Don't make new APIs embed an underspecified
API type they do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}

View File

@@ -0,0 +1,218 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumegroupsnapshots.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshot
listKind: VolumeGroupSnapshotList
plural: volumegroupsnapshots
shortNames:
- vgs
singular: volumegroupsnapshot
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: VolumeGroupSnapshot is a user's request for creating either a
point-in-time group snapshot or binding to a pre-existing group snapshot.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
spec:
description: VolumeGroupSnapshotSpec defines the desired state of VolumeGroupSnapshot
properties:
selector:
description: Selector is a label query over PersistentVolumeClaims
that are to be grouped together for snapshotting. This labelSelector
will be used to match the label added to a PVC. If the label is
added or removed to a volume after a group snapshot is created,
the existing group snapshots won't be modified. Once a VolumeGroupSnapshotContent
is created and the sidecar starts to process it, the volume list
will not change with retries.
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
volumeGroupSnapshotClassName:
description: VolumeGroupSnapshotClassName is the name of the VolumeGroupSnapshotClass
requested by the VolumeGroupSnapshot. VolumeGroupSnapshotClassName
may be left nil to indicate that the default class will be used.
Empty string is not allowed for this field.
type: string
required:
- selector
type: object
status:
description: VolumeGroupSnapshotStatus defines the observed state of VolumeGroupSnapshot
properties:
boundVolumeGroupSnapshotContentName:
description: 'BoundVolumeGroupSnapshotContentName is the name of the
VolumeGroupSnapshotContent object to which this VolumeGroupSnapshot
object intends to bind to. If not specified, it indicates that the
VolumeGroupSnapshot object has not been successfully bound to a
VolumeGroupSnapshotContent object yet. NOTE: To avoid possible security
issues, consumers must verify binding between VolumeGroupSnapshot
and VolumeGroupSnapshotContent objects is successful (by validating
that both VolumeGroupSnapshot and VolumeGroupSnapshotContent point
at each other) before using this object.'
type: string
creationTime:
description: CreationTime is the timestamp when the point-in-time
group snapshot is taken by the underlying storage system. If not
specified, it may indicate that the creation time of the group snapshot
is unknown.
format: date-time
type: string
error:
description: Error is the last observed error during group snapshot
creation, if any. This field could be helpful to upper level controllers
(i.e., application controller) to decide whether they should continue
on waiting for the group snapshot to be created based on the type
of error reported. The snapshot controller will keep retrying when
an error occurs during the group snapshot creation. Upon success,
this error field will be cleared.
properties:
message:
description: 'Message is a string detailing the encountered error
during snapshot creation if specified. NOTE: message may be
logged, and it should not contain sensitive information.'
type: string
time:
description: Time is the timestamp when the error was encountered.
format: date-time
type: string
type: object
readyToUse:
description: ReadyToUse indicates if all the individual snapshots
in the group are ready to be used to restore a volume. If not specified,
it means the readiness of a group snapshot is unknown.
type: boolean
volumeSnapshotRefList:
description: VolumeSnapshotRefList is the list of volume snapshot
references for this group snapshot. The maximum number of allowed
snapshots in the group is 100.
items:
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, \"must refer only to types A and B\" or \"UID not honored\"
or \"name must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because this type
is embedded in many locations, updates to this type will affect
numerous schemas. Don't make new APIs embed an underspecified
API type they do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of
an entire object, this string should contain a valid JSON/Go
field access statement, such as desiredState.manifest.containers[2].
For example, if the object reference is to a container within
a pod, this would take on a value like: "spec.containers{name}"
(where "name" refers to the name of the container that triggered
the event) or if no container name is specified "spec.containers[2]"
(container with index 2 in this pod). This syntax is chosen
only to have some well-defined way of referencing a part of
an object. TODO: this design is not final and this field is
subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}

View File

@@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/665"
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumesnapshotclasses.snapshot.storage.k8s.io
spec:

View File

@@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/665"
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumesnapshotcontents.snapshot.storage.k8s.io
spec:
@@ -172,6 +172,7 @@ spec:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
type: object
x-kubernetes-map-type: atomic
required:
- deletionPolicy
- driver
@@ -239,6 +240,10 @@ spec:
that dynamic snapshot creation has either failed or it is still
in progress.
type: string
volumeGroupSnapshotContentName:
description: VolumeGroupSnapshotContentName is the name of the VolumeGroupSnapshotContent
of which this VolumeSnapshotContent is a part of.
type: string
type: object
required:
- spec

View File

@@ -3,8 +3,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/665"
controller-gen.kubebuilder.io/version: v0.11.3
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
creationTimestamp: null
name: volumesnapshots.snapshot.storage.k8s.io
spec:
@@ -188,6 +188,10 @@ spec:
specified, it indicates that the size is unknown.
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
volumeGroupSnapshotName:
description: VolumeGroupSnapshotName is the name of the VolumeGroupSnapshot
of which this VolumeSnapshot is a part of.
type: string
type: object
required:
- spec