Update snapshot-controller chart and CRDs

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
main
actions 2025-01-08 21:12:54 +00:00
parent 2550582eca
commit 7142aa5d06
24 changed files with 2466 additions and 0 deletions

View File

@ -0,0 +1,6 @@
apiVersion: v1
appVersion: v8.2.0
description: Installs the CRDs for rke2-snapshot-controller
name: rke2-snapshot-controller-crd
type: application
version: 4.0.001

View File

@ -0,0 +1,94 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1150"
controller-gen.kubebuilder.io/version: v0.15.0
name: volumegroupsnapshotclasses.groupsnapshot.storage.k8s.io
spec:
group: groupsnapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshotClass
listKind: VolumeGroupSnapshotClassList
plural: volumegroupsnapshotclasses
shortNames:
- vgsclass
- vgsclasses
singular: volumegroupsnapshotclass
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeGroupSnapshotContent created through
the VolumeGroupSnapshotClass should be deleted when its bound VolumeGroupSnapshot
is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: |-
VolumeGroupSnapshotClass specifies parameters that a underlying storage system
uses when creating a volume group snapshot. A specific VolumeGroupSnapshotClass
is used by specifying its name in a VolumeGroupSnapshot object.
VolumeGroupSnapshotClasses are non-namespaced.
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".
"Retain" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are kept.
"Delete" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are deleted.
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
metadata:
type: object
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 Kubernetes and are passed directly to the driver.
type: object
required:
- deletionPolicy
- driver
type: object
served: true
storage: true
subresources: {}

View File

@ -0,0 +1,324 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1150"
controller-gen.kubebuilder.io/version: v0.15.0
name: volumegroupsnapshotcontents.groupsnapshot.storage.k8s.io
spec:
group: groupsnapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshotContent
listKind: VolumeGroupSnapshotContentList
plural: volumegroupsnapshotcontents
shortNames:
- vgsc
- vgscs
singular: volumegroupsnapshotcontent
scope: Cluster
versions:
- additionalPrinterColumns:
- description: Indicates if all the individual snapshots in the group are ready
to be used to restore a group of volumes.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: Determines whether this VolumeGroupSnapshotContent and its physical
group snapshot on the underlying storage system should be deleted when its
bound VolumeGroupSnapshot is deleted.
jsonPath: .spec.deletionPolicy
name: DeletionPolicy
type: string
- description: Name of the CSI driver used to create the physical group snapshot
on the underlying storage system.
jsonPath: .spec.driver
name: Driver
type: string
- description: Name of the VolumeGroupSnapshotClass from which this group snapshot
was (or will be) created.
jsonPath: .spec.volumeGroupSnapshotClassName
name: VolumeGroupSnapshotClass
type: string
- description: Namespace of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent
object is bound.
jsonPath: .spec.volumeGroupSnapshotRef.namespace
name: VolumeGroupSnapshotNamespace
type: string
- description: Name of the VolumeGroupSnapshot object to which this VolumeGroupSnapshotContent
object is bound.
jsonPath: .spec.volumeGroupSnapshotRef.name
name: VolumeGroupSnapshot
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
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
metadata:
type: object
spec:
description: |-
Spec defines properties of a VolumeGroupSnapshotContent created by the underlying storage system.
Required.
properties:
deletionPolicy:
description: |-
DeletionPolicy determines whether this VolumeGroupSnapshotContent and the
physical group snapshot on the underlying storage system should be deleted
when the bound VolumeGroupSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are kept.
"Delete" means that the VolumeGroupSnapshotContent and its physical group
snapshot on underlying storage system are deleted.
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:
groupSnapshotHandles:
description: |-
GroupSnapshotHandles specifies the CSI "group_snapshot_id" of a pre-existing
group snapshot and a list of CSI "snapshot_id" of pre-existing snapshots
on the underlying storage system for which a Kubernetes object
representation was (or should be) created.
This field is immutable.
properties:
volumeGroupSnapshotHandle:
description: |-
VolumeGroupSnapshotHandle specifies the CSI "group_snapshot_id" of a pre-existing
group snapshot on the underlying storage system for which a Kubernetes object
representation was (or should be) created.
This field is immutable.
Required.
type: string
volumeSnapshotHandles:
description: |-
VolumeSnapshotHandles is a list of CSI "snapshot_id" of pre-existing
snapshots on the underlying storage system for which Kubernetes objects
representation were (or should be) created.
This field is immutable.
Required.
items:
type: string
type: array
required:
- volumeGroupSnapshotHandle
- volumeSnapshotHandles
type: object
x-kubernetes-validations:
- message: groupSnapshotHandles is immutable
rule: self == oldSelf
volumeHandles:
description: |-
VolumeHandles is a list of volume handles on the backend to be snapshotted
together. It is specified for dynamic provisioning of the VolumeGroupSnapshot.
This field is immutable.
items:
type: string
type: array
x-kubernetes-validations:
- message: volumeHandles is immutable
rule: self == oldSelf
type: object
x-kubernetes-validations:
- message: volumeHandles is required once set
rule: '!has(oldSelf.volumeHandles) || has(self.volumeHandles)'
- message: groupSnapshotHandles is required once set
rule: '!has(oldSelf.groupSnapshotHandles) || has(self.groupSnapshotHandles)'
- message: exactly one of volumeHandles and groupSnapshotHandles must
be set
rule: (has(self.volumeHandles) && !has(self.groupSnapshotHandles))
|| (!has(self.volumeHandles) && has(self.groupSnapshotHandles))
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
x-kubernetes-validations:
- message: both volumeGroupSnapshotRef.name and volumeGroupSnapshotRef.namespace
must be set
rule: has(self.name) && has(self.__namespace__)
required:
- deletionPolicy
- driver
- source
- volumeGroupSnapshotRef
type: object
status:
description: status represents the current information of a group snapshot.
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.
If not specified, it means the readiness of a group snapshot is unknown.
The format of this field is a Unix nanoseconds time encoded as an int64.
On Unix, the command date +%s%N returns the current time in nanoseconds
since 1970-01-01 00:00:00 UTC.
This field is the source for the CreationTime field in VolumeGroupSnapshotStatus
format: date-time
type: string
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 group of volumes.
ReadyToUse becomes true when ReadyToUse of all individual snapshots become true.
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
volumeSnapshotHandlePairList:
description: |-
VolumeSnapshotHandlePairList is a list of CSI "volume_id" and "snapshot_id"
pair returned by the CSI driver to identify snapshots and their source volumes
on the storage system.
items:
description: VolumeSnapshotHandlePair defines a pair of a source
volume handle and a snapshot handle
properties:
snapshotHandle:
description: |-
SnapshotHandle is a unique id returned by the CSI driver to identify a volume
snapshot on the storage system
Required.
type: string
volumeHandle:
description: |-
VolumeHandle is a unique id returned by the CSI driver to identify a volume
on the storage system
Required.
type: string
required:
- snapshotHandle
- volumeHandle
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}

View File

@ -0,0 +1,239 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/1150"
controller-gen.kubebuilder.io/version: v0.15.0
name: volumegroupsnapshots.groupsnapshot.storage.k8s.io
spec:
group: groupsnapshot.storage.k8s.io
names:
kind: VolumeGroupSnapshot
listKind: VolumeGroupSnapshotList
plural: volumegroupsnapshots
shortNames:
- vgs
singular: volumegroupsnapshot
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: Indicates if all the individual snapshots in the group are ready
to be used to restore a group of volumes.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: The name of the VolumeGroupSnapshotClass requested by the VolumeGroupSnapshot.
jsonPath: .spec.volumeGroupSnapshotClassName
name: VolumeGroupSnapshotClass
type: string
- description: Name of the VolumeGroupSnapshotContent object to which the VolumeGroupSnapshot
object intends to bind to. Please note that verification of binding actually
requires checking both VolumeGroupSnapshot and VolumeGroupSnapshotContent
to ensure both are pointing at each other. Binding MUST be verified prior
to usage of this object.
jsonPath: .status.boundVolumeGroupSnapshotContentName
name: VolumeGroupSnapshotContent
type: string
- description: Timestamp when the point-in-time group snapshot was taken by the
underlying storage system.
jsonPath: .status.creationTime
name: CreationTime
type: date
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
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
metadata:
type: object
spec:
description: |-
Spec defines the desired characteristics of a group snapshot requested by a user.
Required.
properties:
source:
description: |-
Source specifies where a group snapshot will be created from.
This field is immutable after creation.
Required.
properties:
selector:
description: |-
Selector is a label query over persistent volume claims 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
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
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
x-kubernetes-validations:
- message: selector is immutable
rule: self == oldSelf
volumeGroupSnapshotContentName:
description: |-
VolumeGroupSnapshotContentName specifies the name of a pre-existing VolumeGroupSnapshotContent
object representing an existing volume group snapshot.
This field should be set if the volume group snapshot already exists and
only needs a representation in Kubernetes.
This field is immutable.
type: string
x-kubernetes-validations:
- message: volumeGroupSnapshotContentName is immutable
rule: self == oldSelf
type: object
x-kubernetes-validations:
- message: selector is required once set
rule: '!has(oldSelf.selector) || has(self.selector)'
- message: volumeGroupSnapshotContentName is required once set
rule: '!has(oldSelf.volumeGroupSnapshotContentName) || has(self.volumeGroupSnapshotContentName)'
- message: exactly one of selector and volumeGroupSnapshotContentName
must be set
rule: (has(self.selector) && !has(self.volumeGroupSnapshotContentName))
|| (!has(self.selector) && has(self.volumeGroupSnapshotContentName))
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
x-kubernetes-validations:
- message: volumeGroupSnapshotClassName must not be the empty string
when set
rule: size(self) > 0
required:
- source
type: object
status:
description: |-
Status represents the current information of a group snapshot.
Consumers must verify binding between VolumeGroupSnapshot and
VolumeGroupSnapshotContent objects is successful (by validating that both
VolumeGroupSnapshot and VolumeGroupSnapshotContent point to each other) before
using this object.
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.
The format of this field is a Unix nanoseconds time encoded as an int64.
On Unix, the command date +%s%N returns the current time in nanoseconds
since 1970-01-01 00:00:00 UTC.
This field is updated based on the CreationTime field in VolumeGroupSnapshotContentStatus
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 group of volumes.
ReadyToUse becomes true when ReadyToUse of all individual snapshots become true.
If not specified, it means the readiness of a group snapshot is unknown.
type: boolean
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}

View File

@ -0,0 +1,143 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
controller-gen.kubebuilder.io/version: v0.15.0
name: volumesnapshotclasses.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshotClass
listKind: VolumeSnapshotClassList
plural: volumesnapshotclasses
shortNames:
- vsclass
- vsclasses
singular: volumesnapshotclass
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeSnapshotContent created through the
VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
VolumeSnapshotClass specifies parameters that a underlying storage system uses when
creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its
name in a VolumeSnapshot object.
VolumeSnapshotClasses are non-namespaced
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 VolumeSnapshotContent created through
the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept.
"Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted.
Required.
enum:
- Delete
- Retain
type: string
driver:
description: |-
driver is the name of the storage driver that handles this VolumeSnapshotClass.
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
metadata:
type: object
parameters:
additionalProperties:
type: string
description: |-
parameters is a key-value map with storage driver specific parameters for creating snapshots.
These values are opaque to Kubernetes.
type: object
required:
- deletionPolicy
- driver
type: object
served: true
storage: true
subresources: {}
- additionalPrinterColumns:
- jsonPath: .driver
name: Driver
type: string
- description: Determines whether a VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted.
jsonPath: .deletionPolicy
name: DeletionPolicy
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
# This indicates the v1beta1 version of the custom resource is deprecated.
# API requests to this version receive a warning in the server response.
deprecated: true
# This overrides the default warning returned to clients making v1beta1 API requests.
deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotClass is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotClass"
schema:
openAPIV3Schema:
description: VolumeSnapshotClass specifies parameters that a underlying storage system uses when creating a volume snapshot. A specific VolumeSnapshotClass is used by specifying its name in a VolumeSnapshot object. VolumeSnapshotClasses are non-namespaced
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 VolumeSnapshotContent created through the VolumeSnapshotClass should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. Required.
enum:
- Delete
- Retain
type: string
driver:
description: driver is the name of the storage driver that handles this VolumeSnapshotClass. 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 snapshots. These values are opaque to Kubernetes.
type: object
required:
- deletionPolicy
- driver
type: object
served: false
storage: false
subresources: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,457 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/955"
name: volumesnapshotcontents.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshotContent
listKind: VolumeSnapshotContentList
plural: volumesnapshotcontents
shortNames:
- vsc
- vscs
singular: volumesnapshotcontent
scope: Cluster
versions:
- additionalPrinterColumns:
- description: Indicates if the snapshot is ready to be used to restore a volume.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: Represents the complete size of the snapshot in bytes
jsonPath: .status.restoreSize
name: RestoreSize
type: integer
- description: Determines whether this VolumeSnapshotContent and its physical
snapshot on the underlying storage system should be deleted when its bound
VolumeSnapshot is deleted.
jsonPath: .spec.deletionPolicy
name: DeletionPolicy
type: string
- description: Name of the CSI driver used to create the physical snapshot on
the underlying storage system.
jsonPath: .spec.driver
name: Driver
type: string
- description: Name of the VolumeSnapshotClass to which this snapshot belongs.
jsonPath: .spec.volumeSnapshotClassName
name: VolumeSnapshotClass
type: string
- description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent
object is bound.
jsonPath: .spec.volumeSnapshotRef.name
name: VolumeSnapshot
type: string
- description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent
object is bound.
jsonPath: .spec.volumeSnapshotRef.namespace
name: VolumeSnapshotNamespace
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
VolumeSnapshotContent represents the actual "on-disk" 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
metadata:
type: object
spec:
description: |-
spec defines properties of a VolumeSnapshotContent created by the underlying storage system.
Required.
properties:
deletionPolicy:
description: |-
deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on
the underlying storage system should be deleted when its bound VolumeSnapshot is deleted.
Supported values are "Retain" and "Delete".
"Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept.
"Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted.
For dynamically provisioned snapshots, this field will automatically be filled in by the
CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding
VolumeSnapshotClass.
For pre-existing snapshots, users MUST specify this field when creating the
VolumeSnapshotContent object.
Required.
enum:
- Delete
- Retain
type: string
driver:
description: |-
driver is the name of the CSI driver used to create the physical 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:
snapshotHandle:
description: |-
snapshotHandle 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
x-kubernetes-validations:
- message: snapshotHandle is immutable
rule: self == oldSelf
volumeHandle:
description: |-
volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot
should be dynamically taken from.
This field is immutable.
type: string
x-kubernetes-validations:
- message: volumeHandle is immutable
rule: self == oldSelf
type: object
x-kubernetes-validations:
- message: volumeHandle is required once set
rule: '!has(oldSelf.volumeHandle) || has(self.volumeHandle)'
- message: snapshotHandle is required once set
rule: '!has(oldSelf.snapshotHandle) || has(self.snapshotHandle)'
- message: exactly one of volumeHandle and snapshotHandle must be
set
rule: (has(self.volumeHandle) && !has(self.snapshotHandle)) || (!has(self.volumeHandle)
&& has(self.snapshotHandle))
sourceVolumeMode:
description: |-
SourceVolumeMode is the mode of the volume whose snapshot is taken.
Can be either “Filesystem” or “Block”.
If not specified, it indicates the source volume's mode is unknown.
This field is immutable.
This field is an alpha field.
type: string
x-kubernetes-validations:
- message: sourceVolumeMode is immutable
rule: self == oldSelf
volumeSnapshotClassName:
description: |-
name of the VolumeSnapshotClass from which this snapshot was (or will be)
created.
Note that after provisioning, the VolumeSnapshotClass may be deleted or
recreated with different set of values, and as such, should not be referenced
post-snapshot creation.
type: string
volumeSnapshotRef:
description: |-
volumeSnapshotRef specifies the VolumeSnapshot object to which this
VolumeSnapshotContent object is bound.
VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to
this VolumeSnapshotContent's name for the bidirectional binding to be valid.
For a pre-existing VolumeSnapshotContent object, name and namespace of the
VolumeSnapshot 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
x-kubernetes-validations:
- message: both spec.volumeSnapshotRef.name and spec.volumeSnapshotRef.namespace
must be set
rule: has(self.name) && has(self.__namespace__)
required:
- deletionPolicy
- driver
- source
- volumeSnapshotRef
type: object
x-kubernetes-validations:
- message: sourceVolumeMode is required once set
rule: '!has(oldSelf.sourceVolumeMode) || has(self.sourceVolumeMode)'
status:
description: status represents the current information of a snapshot.
properties:
creationTime:
description: |-
creationTime is the timestamp when the point-in-time snapshot is taken
by the underlying storage system.
In dynamic snapshot creation case, this field will be filled in by the
CSI snapshotter sidecar with the "creation_time" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "creation_time"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
If not specified, it indicates the creation time is unknown.
The format of this field is a Unix nanoseconds time encoded as an int64.
On Unix, the command `date +%s%N` returns the current time in nanoseconds
since 1970-01-01 00:00:00 UTC.
format: int64
type: integer
error:
description: |-
error is the last observed error during 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 a snapshot is ready to be used to restore a volume.
In dynamic snapshot creation case, this field will be filled in by the
CSI snapshotter sidecar with the "ready_to_use" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "ready_to_use"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it,
otherwise, this field will be set to "True".
If not specified, it means the readiness of a snapshot is unknown.
type: boolean
restoreSize:
description: |-
restoreSize represents the complete size of the snapshot in bytes.
In dynamic snapshot creation case, this field will be filled in by the
CSI snapshotter sidecar with the "size_bytes" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "size_bytes"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
When restoring a volume from this snapshot, the size of the volume MUST NOT
be smaller than the restoreSize if it is specified, otherwise the restoration will fail.
If not specified, it indicates that the size is unknown.
format: int64
minimum: 0
type: integer
snapshotHandle:
description: |-
snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system.
If not specified, it indicates that dynamic snapshot creation has either failed
or it is still in progress.
type: string
volumeGroupSnapshotHandle:
description: |-
VolumeGroupSnapshotHandle is the CSI "group_snapshot_id" of a group snapshot
on the underlying storage system.
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
- additionalPrinterColumns:
- description: Indicates if the snapshot is ready to be used to restore a volume.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: Represents the complete size of the snapshot in bytes
jsonPath: .status.restoreSize
name: RestoreSize
type: integer
- description: Determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted.
jsonPath: .spec.deletionPolicy
name: DeletionPolicy
type: string
- description: Name of the CSI driver used to create the physical snapshot on the underlying storage system.
jsonPath: .spec.driver
name: Driver
type: string
- description: Name of the VolumeSnapshotClass to which this snapshot belongs.
jsonPath: .spec.volumeSnapshotClassName
name: VolumeSnapshotClass
type: string
- description: Name of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound.
jsonPath: .spec.volumeSnapshotRef.name
name: VolumeSnapshot
type: string
- description: Namespace of the VolumeSnapshot object to which this VolumeSnapshotContent object is bound.
jsonPath: .spec.volumeSnapshotRef.namespace
name: VolumeSnapshotNamespace
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
# This indicates the v1beta1 version of the custom resource is deprecated.
# API requests to this version receive a warning in the server response.
deprecated: true
# This overrides the default warning returned to clients making v1beta1 API requests.
deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshotContent is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshotContent"
schema:
openAPIV3Schema:
description: VolumeSnapshotContent represents the actual "on-disk" 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: spec defines properties of a VolumeSnapshotContent created by the underlying storage system. Required.
properties:
deletionPolicy:
description: deletionPolicy determines whether this VolumeSnapshotContent and its physical snapshot on the underlying storage system should be deleted when its bound VolumeSnapshot is deleted. Supported values are "Retain" and "Delete". "Retain" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are kept. "Delete" means that the VolumeSnapshotContent and its physical snapshot on underlying storage system are deleted. For dynamically provisioned snapshots, this field will automatically be filled in by the CSI snapshotter sidecar with the "DeletionPolicy" field defined in the corresponding VolumeSnapshotClass. For pre-existing snapshots, users MUST specify this field when creating the VolumeSnapshotContent object. Required.
enum:
- Delete
- Retain
type: string
driver:
description: driver is the name of the CSI driver used to create the physical 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:
snapshotHandle:
description: snapshotHandle 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
volumeHandle:
description: volumeHandle specifies the CSI "volume_id" of the volume from which a snapshot should be dynamically taken from. This field is immutable.
type: string
type: object
volumeSnapshotClassName:
description: name of the VolumeSnapshotClass from which this snapshot was (or will be) created. Note that after provisioning, the VolumeSnapshotClass may be deleted or recreated with different set of values, and as such, should not be referenced post-snapshot creation.
type: string
volumeSnapshotRef:
description: volumeSnapshotRef specifies the VolumeSnapshot object to which this VolumeSnapshotContent object is bound. VolumeSnapshot.Spec.VolumeSnapshotContentName field must reference to this VolumeSnapshotContent's name for the bidirectional binding to be valid. For a pre-existing VolumeSnapshotContent object, name and namespace of the VolumeSnapshot 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
required:
- deletionPolicy
- driver
- source
- volumeSnapshotRef
type: object
status:
description: status represents the current information of a snapshot.
properties:
creationTime:
description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it indicates the creation time is unknown. The format of this field is a Unix nanoseconds time encoded as an int64. On Unix, the command `date +%s%N` returns the current time in nanoseconds since 1970-01-01 00:00:00 UTC.
format: int64
type: integer
error:
description: error is the last observed error during 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 a snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown.
type: boolean
restoreSize:
description: restoreSize represents the complete size of the snapshot in bytes. In dynamic snapshot creation case, this field will be filled in by the CSI snapshotter sidecar with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not specified, it indicates that the size is unknown.
format: int64
minimum: 0
type: integer
snapshotHandle:
description: snapshotHandle is the CSI "snapshot_id" of a snapshot on the underlying storage system. If not specified, it indicates that dynamic snapshot creation has either failed or it is still in progress.
type: string
type: object
required:
- spec
type: object
served: false
storage: false
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,351 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshotter/pull/814"
name: volumesnapshots.snapshot.storage.k8s.io
spec:
group: snapshot.storage.k8s.io
names:
kind: VolumeSnapshot
listKind: VolumeSnapshotList
plural: volumesnapshots
shortNames:
- vs
singular: volumesnapshot
scope: Namespaced
versions:
- additionalPrinterColumns:
- description: Indicates if the snapshot is ready to be used to restore a volume.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: If a new snapshot needs to be created, this contains the name of
the source PVC from which this snapshot was (or will be) created.
jsonPath: .spec.source.persistentVolumeClaimName
name: SourcePVC
type: string
- description: If a snapshot already exists, this contains the name of the existing
VolumeSnapshotContent object representing the existing snapshot.
jsonPath: .spec.source.volumeSnapshotContentName
name: SourceSnapshotContent
type: string
- description: Represents the minimum size of volume required to rehydrate from
this snapshot.
jsonPath: .status.restoreSize
name: RestoreSize
type: string
- description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot.
jsonPath: .spec.volumeSnapshotClassName
name: SnapshotClass
type: string
- description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot
object intends to bind to. Please note that verification of binding actually
requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure
both are pointing at each other. Binding MUST be verified prior to usage of
this object.
jsonPath: .status.boundVolumeSnapshotContentName
name: SnapshotContent
type: string
- description: Timestamp when the point-in-time snapshot was taken by the underlying
storage system.
jsonPath: .status.creationTime
name: CreationTime
type: date
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1
schema:
openAPIV3Schema:
description: |-
VolumeSnapshot is a user's request for either creating a point-in-time
snapshot of a persistent volume, or binding to a pre-existing 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
metadata:
type: object
spec:
description: |-
spec defines the desired characteristics of a snapshot requested by a user.
More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots
Required.
properties:
source:
description: |-
source specifies where a snapshot will be created from.
This field is immutable after creation.
Required.
properties:
persistentVolumeClaimName:
description: |-
persistentVolumeClaimName specifies the name of the PersistentVolumeClaim
object representing the volume from which a snapshot should be created.
This PVC is assumed to be in the same namespace as the VolumeSnapshot
object.
This field should be set if the snapshot does not exists, and needs to be
created.
This field is immutable.
type: string
x-kubernetes-validations:
- message: persistentVolumeClaimName is immutable
rule: self == oldSelf
volumeSnapshotContentName:
description: |-
volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent
object representing an existing volume snapshot.
This field should be set if the snapshot already exists and only needs a representation in Kubernetes.
This field is immutable.
type: string
x-kubernetes-validations:
- message: volumeSnapshotContentName is immutable
rule: self == oldSelf
type: object
x-kubernetes-validations:
- message: persistentVolumeClaimName is required once set
rule: '!has(oldSelf.persistentVolumeClaimName) || has(self.persistentVolumeClaimName)'
- message: volumeSnapshotContentName is required once set
rule: '!has(oldSelf.volumeSnapshotContentName) || has(self.volumeSnapshotContentName)'
- message: exactly one of volumeSnapshotContentName and persistentVolumeClaimName
must be set
rule: (has(self.volumeSnapshotContentName) && !has(self.persistentVolumeClaimName))
|| (!has(self.volumeSnapshotContentName) && has(self.persistentVolumeClaimName))
volumeSnapshotClassName:
description: |-
VolumeSnapshotClassName is the name of the VolumeSnapshotClass
requested by the VolumeSnapshot.
VolumeSnapshotClassName may be left nil to indicate that the default
SnapshotClass should be used.
A given cluster may have multiple default Volume SnapshotClasses: one
default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass,
VolumeSnapshotSource will be checked to figure out what the associated
CSI Driver is, and the default VolumeSnapshotClass associated with that
CSI Driver will be used. If more than one VolumeSnapshotClass exist for
a given CSI Driver and more than one have been marked as default,
CreateSnapshot will fail and generate an event.
Empty string is not allowed for this field.
type: string
x-kubernetes-validations:
- message: volumeSnapshotClassName must not be the empty string when
set
rule: size(self) > 0
required:
- source
type: object
status:
description: |-
status represents the current information of a snapshot.
Consumers must verify binding between VolumeSnapshot and
VolumeSnapshotContent objects is successful (by validating that both
VolumeSnapshot and VolumeSnapshotContent point at each other) before
using this object.
properties:
boundVolumeSnapshotContentName:
description: |-
boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent
object to which this VolumeSnapshot object intends to bind to.
If not specified, it indicates that the VolumeSnapshot object has not been
successfully bound to a VolumeSnapshotContent object yet.
NOTE: To avoid possible security issues, consumers must verify binding between
VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that
both VolumeSnapshot and VolumeSnapshotContent point at each other) before using
this object.
type: string
creationTime:
description: |-
creationTime is the timestamp when the point-in-time snapshot is taken
by the underlying storage system.
In dynamic snapshot creation case, this field will be filled in by the
snapshot controller with the "creation_time" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "creation_time"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
If not specified, it may indicate that the creation time of the snapshot is unknown.
format: date-time
type: string
error:
description: |-
error is the last observed error during 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 snapshot to be created
based on the type of error reported.
The snapshot controller will keep retrying when an error occurs during the
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 the snapshot is ready to be used to restore a volume.
In dynamic snapshot creation case, this field will be filled in by the
snapshot controller with the "ready_to_use" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "ready_to_use"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it,
otherwise, this field will be set to "True".
If not specified, it means the readiness of a snapshot is unknown.
type: boolean
restoreSize:
type: string
description: |-
restoreSize represents the minimum size of volume required to create a volume
from this snapshot.
In dynamic snapshot creation case, this field will be filled in by the
snapshot controller with the "size_bytes" value returned from CSI
"CreateSnapshot" gRPC call.
For a pre-existing snapshot, this field will be filled with the "size_bytes"
value returned from the CSI "ListSnapshots" gRPC call if the driver supports it.
When restoring a volume from this snapshot, the size of the volume MUST NOT
be smaller than the restoreSize if it is specified, otherwise the restoration will fail.
If not 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
type: object
served: true
storage: true
subresources:
status: {}
- additionalPrinterColumns:
- description: Indicates if the snapshot is ready to be used to restore a volume.
jsonPath: .status.readyToUse
name: ReadyToUse
type: boolean
- description: If a new snapshot needs to be created, this contains the name of the source PVC from which this snapshot was (or will be) created.
jsonPath: .spec.source.persistentVolumeClaimName
name: SourcePVC
type: string
- description: If a snapshot already exists, this contains the name of the existing VolumeSnapshotContent object representing the existing snapshot.
jsonPath: .spec.source.volumeSnapshotContentName
name: SourceSnapshotContent
type: string
- description: Represents the minimum size of volume required to rehydrate from this snapshot.
jsonPath: .status.restoreSize
name: RestoreSize
type: string
- description: The name of the VolumeSnapshotClass requested by the VolumeSnapshot.
jsonPath: .spec.volumeSnapshotClassName
name: SnapshotClass
type: string
- description: Name of the VolumeSnapshotContent object to which the VolumeSnapshot object intends to bind to. Please note that verification of binding actually requires checking both VolumeSnapshot and VolumeSnapshotContent to ensure both are pointing at each other. Binding MUST be verified prior to usage of this object.
jsonPath: .status.boundVolumeSnapshotContentName
name: SnapshotContent
type: string
- description: Timestamp when the point-in-time snapshot was taken by the underlying storage system.
jsonPath: .status.creationTime
name: CreationTime
type: date
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
name: v1beta1
# This indicates the v1beta1 version of the custom resource is deprecated.
# API requests to this version receive a warning in the server response.
deprecated: true
# This overrides the default warning returned to clients making v1beta1 API requests.
deprecationWarning: "snapshot.storage.k8s.io/v1beta1 VolumeSnapshot is deprecated; use snapshot.storage.k8s.io/v1 VolumeSnapshot"
schema:
openAPIV3Schema:
description: VolumeSnapshot is a user's request for either creating a point-in-time snapshot of a persistent volume, or binding to a pre-existing 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: 'spec defines the desired characteristics of a snapshot requested by a user. More info: https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots Required.'
properties:
source:
description: source specifies where a snapshot will be created from. This field is immutable after creation. Required.
properties:
persistentVolumeClaimName:
description: persistentVolumeClaimName specifies the name of the PersistentVolumeClaim object representing the volume from which a snapshot should be created. This PVC is assumed to be in the same namespace as the VolumeSnapshot object. This field should be set if the snapshot does not exists, and needs to be created. This field is immutable.
type: string
volumeSnapshotContentName:
description: volumeSnapshotContentName specifies the name of a pre-existing VolumeSnapshotContent object representing an existing volume snapshot. This field should be set if the snapshot already exists and only needs a representation in Kubernetes. This field is immutable.
type: string
type: object
volumeSnapshotClassName:
description: 'VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by the VolumeSnapshot. VolumeSnapshotClassName may be left nil to indicate that the default SnapshotClass should be used. A given cluster may have multiple default Volume SnapshotClasses: one default per CSI Driver. If a VolumeSnapshot does not specify a SnapshotClass, VolumeSnapshotSource will be checked to figure out what the associated CSI Driver is, and the default VolumeSnapshotClass associated with that CSI Driver will be used. If more than one VolumeSnapshotClass exist for a given CSI Driver and more than one have been marked as default, CreateSnapshot will fail and generate an event. Empty string is not allowed for this field.'
type: string
required:
- source
type: object
status:
description: status represents the current information of a snapshot. Consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object.
properties:
boundVolumeSnapshotContentName:
description: 'boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent object to which this VolumeSnapshot object intends to bind to. If not specified, it indicates that the VolumeSnapshot object has not been successfully bound to a VolumeSnapshotContent object yet. NOTE: To avoid possible security issues, consumers must verify binding between VolumeSnapshot and VolumeSnapshotContent objects is successful (by validating that both VolumeSnapshot and VolumeSnapshotContent point at each other) before using this object.'
type: string
creationTime:
description: creationTime is the timestamp when the point-in-time snapshot is taken by the underlying storage system. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "creation_time" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "creation_time" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. If not specified, it may indicate that the creation time of the snapshot is unknown.
format: date-time
type: string
error:
description: error is the last observed error during 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 snapshot to be created based on the type of error reported. The snapshot controller will keep retrying when an error occurs during the 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 the snapshot is ready to be used to restore a volume. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "ready_to_use" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "ready_to_use" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it, otherwise, this field will be set to "True". If not specified, it means the readiness of a snapshot is unknown.
type: boolean
restoreSize:
type: string
description: restoreSize represents the minimum size of volume required to create a volume from this snapshot. In dynamic snapshot creation case, this field will be filled in by the snapshot controller with the "size_bytes" value returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be filled with the "size_bytes" value returned from the CSI "ListSnapshots" gRPC call if the driver supports it. When restoring a volume from this snapshot, the size of the volume MUST NOT be smaller than the restoreSize if it is specified, otherwise the restoration will fail. If not 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
type: object
required:
- spec
type: object
served: false
storage: false
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@ -0,0 +1,25 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
crds/README.md
Makefile
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@ -0,0 +1,20 @@
apiVersion: v2
appVersion: v8.2.0
description: |
Deploys a Snapshot Controller in a cluster. Snapshot Controllers are often bundled with the Kubernetes distribution,
this chart is meant for cases where it is not.
home: https://github.com/piraeusdatastore/helm-charts
icon: https://raw.githubusercontent.com/piraeusdatastore/piraeus/master/artwork/sandbox-artwork/icon/color.svg
keywords:
- storage
- snapshot
- validation
kubeVersion: '>= 1.25.0-0'
maintainers:
- name: The Piraeus Maintainers
url: https://github.com/piraeusdatastore/
name: rke2-snapshot-controller
sources:
- https://github.com/kubernetes-csi/external-snapshotter/
type: application
version: 4.0.001

View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,114 @@
# snapshot-controller
Deploys the [snapshot-controller](https://github.com/kubernetes-csi/external-snapshotter) in a cluster.
The controller is required for CSI snapshotting to work and is not specific to any CSI driver.
While many Kubernetes distributions already package this controller, some do not. If your cluster does ***NOT***
have the following CRDs, you likely also do not have a snapshot controller deployed:
```
kubectl get crd volumesnapshotclasses.snapshot.storage.k8s.io
kubectl get crd volumesnapshots.snapshot.storage.k8s.io
kubectl get crd volumesnapshotcontents.snapshot.storage.k8s.io
```
## Usage
See [below](#configuration) for available configuration options.
```
helm repo add piraeus-charts https://piraeus.io/helm-charts/
helm install snapshot-controller piraeus-charts/snapshot-controller
```
## Upgrades
Upgrades can be done using the normal Helm upgrade mechanism
```
helm repo update
helm upgrade snapshot-controller piraeus-charts/snapshot-controller
```
To enjoy all the latest features of the snapshot controller, you may want to upgrade your CRDs as well:
```
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v8.2.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
```
## Upgrade from older CRDs
In an effort to tighten validation, the CSI project started enforcing stricter requirements on `VolumeSnapshot` and
`VolumeSnapshotContent` resources when switching from `v1beta1` to `v1` CRDs. This validation webhook is part of
enforcing these requirements. When upgrading you [have to ensure non of your resources violate the requirements for `v1`].
The upgrade procedure can be summarized by the following steps:
1. Remove the old snapshot controller, if any (since you are upgrading, you probably already have one deployed manually).
2. Install the snapshot controller and the validation webhook using one of the [`3.x.x` releases]:
```
helm install piraeus-charts/snapshot-controller --set controller.image.tag=v3.0.3 --set webhook.image.tag=v3.0.3
```
3. Ensure that none of the resources are labelled as invalid:
```
kubectl get volumesnapshots --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
kubectl get volumesnapshotcontents --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
```
If the above commands output any resource, they have to be removed
4. Upgrade the CRDs
```
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/v5.0.0/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
```
5. Upgrade to the latest version:
```
helm upgrade piraeus-charts/snapshot-controller --set controller.image.tag=v5.0.0 --set webhook.image.tag=v5.0.0
```
## Configuration
### Snapshot controller
The following options are available:
| Option | Usage | Default |
|------------------------------------------|------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| `controller.enabled` | Toggle to disable the deployment of the snapshot controller. | `true` |
| `controller.fullnameOverride` | Set the base name of deployed resources. Defaults to `snapshot-controller`. | `""` |
| `controller.args` | Arguments to pass to the snapshot controller. Note: Keys will be converted to kebab-case, i.e. `oneArg` -> `--one-arg` | `...` |
| `controller.replicaCount` | Number of replicas to deploy. | `1` |
| `controller.revisionHistoryLimit` | Number of revisions to keep. | `10` |
| `controller.image.repository` | Repository to pull the image from. | `registry.k8s.io/sig-storage/snapshot-controller` |
| `controller.image.pullPolicy` | Pull policy to use. Possible values: `IfNotPresent`, `Always`, `Never` | `IfNotPresent` |
| `controller.image.tag` | Override the tag to pull. If not given, defaults to charts `AppVersion`. | `""` |
| `controller.imagePullSecrets` | Image pull secrets to add to the deployment. | `[]` |
| `controller.podAnnotations` | Annotations to add to every pod in the deployment. | `{}` |
| `controller.podLabels` | Labels to add to every pod in the deployment. | `{}` |
| `controller.podSecurityContext` | Security context to set on the webhook pod. | `{}` |
| `controller.priorityClassName` | Priority Class to set on the deployment pods. | `""` |
| `controller.securityContext` | Configure container security context. Defaults to dropping all capabilties and running as user 1000. | `{capabilities: {drop: [ALL]}, readOnlyRootFilesystem: true, runAsNonRoot: true, runAsUser: 1000}` |
| `controller.resources` | Resources to request and limit on the pod. | `{}` |
| `controller.nodeSelector` | Node selector to add to each webhook pod. | `{}` |
| `controller.tolerations` | Tolerations to add to each webhook pod. | `[]` |
| `controller.topologySpreadConstraints` | Topology spread constraints to set on each pod. | `[]` |
| `controller.affinity` | Affinity to set on each webhook pod. | `{}` |
| `controller.pdb` | PodDisruptionBudget to set on the webhook pod. | `{}` |
| `controller.rbac.create` | Create the necessary roles and bindings for the snapshot controller. | `true` |
| `controller.serviceAccount.create` | Create the service account resource | `true` |
| `controller.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` |
| `controller.hostNetwork` | Change `hostNetwork` to `true` when you want the pod to share its host's network namespace. | `false` |
| `controller.dnsConfig` | DNS settings for controller pod. | `{}` |
| `controller.dnsPolicy` | DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet`. | `ClusterFirst` |
[`3.x.x` releases]: https://github.com/kubernetes-csi/external-snapshotter/releases
[have to ensure non of your resources violate the requirements for `v1`]: https://github.com/kubernetes-csi/external-snapshotter#validating-webhook

View File

@ -0,0 +1,27 @@
{{- if .Values.controller.enabled }}
Volume Snapshot Controller installed.
{{- end }}
{{- if and (not (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1")) (not (.Capabilities.APIVersions.Has "snapshot.storage.k8s.io/v1beta") ) }}
Please install the snapshot CRDs, otherwise the controller will not run.
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
{{- else if .Release.IsUpgrade }}
It looks like you are upgrading from a previous release. Helm currently does not support upgrading CRDs, so to ensure
you have the latest CRDs applied, you can run the following commands:
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
kubectl replace -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/{{ .Chart.AppVersion }}/client/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
{{- end }}
If you already have volume snapshots deployed using a CRDs before v1, you should
verify that the existing snapshots are upgradable to v1 CRDs. The snapshot controller (>= v3.0.0)
will label any invalid snapshots it can find. Use the following commands to find any invalid snapshot
kubectl get volumesnapshots --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
kubectl get volumesnapshotcontents --selector=snapshot.storage.kubernetes.io/invalid-snapshot-resource="" --all-namespaces
If the above commands return any items, you need to remove them before upgrading to the newer v1 CRDs.

View File

@ -0,0 +1,69 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "snapshot-controller.name" -}}
{{- .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "snapshot-controller.fullname" -}}
{{- if .Values.controller.fullnameOverride -}}
{{- .Values.controller.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- if contains .Chart.Name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name .Chart.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "snapshot-controller.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "snapshot-controller.labels" -}}
helm.sh/chart: {{ include "snapshot-controller.chart" . }}
{{ include "snapshot-controller.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "snapshot-controller.selectorLabels" -}}
app.kubernetes.io/name: {{ include "snapshot-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "snapshot-controller.serviceAccountName" -}}
{{- if .Values.controller.serviceAccount.create -}}
{{ default (include "snapshot-controller.fullname" .) .Values.controller.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.controller.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{- define "system_default_registry" -}}
{{- if .Values.global.systemDefaultRegistry -}}
{{- printf "%s/" .Values.global.systemDefaultRegistry -}}
{{- else -}}
{{- "" -}}
{{- end }}
{{- end }}

View File

@ -0,0 +1,89 @@
{{- if .Values.controller.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.controller.replicaCount }}
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "snapshot-controller.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.controller.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "snapshot-controller.selectorLabels" . | nindent 8 }}
{{- with .Values.controller.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.controller.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "snapshot-controller.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.controller.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.controller.securityContext | nindent 12 }}
image: "{{ template "system_default_registry" . }}{{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.controller.image.pullPolicy }}
args:
{{- range $flag, $val := .Values.controller.args }}
- --{{ $flag | kebabcase }}={{ $val }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
port: http
path: /healthz/leader-election
scheme: HTTP
livenessProbe:
httpGet:
port: http
path: /healthz/leader-election
scheme: HTTP
env:
- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
resources:
{{- toYaml .Values.controller.resources | nindent 12 }}
{{- with .Values.controller.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.controller.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.controller.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.controller.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.controller.priorityClassName }}
priorityClassName: {{ .Values.controller.priorityClassName }}
{{- end }}
hostNetwork: {{ .Values.controller.hostNetwork }}
{{- with .Values.controller.dnsConfig }}
dnsConfig:
{{- toYaml . | nindent 8 }}
{{- end }}
dnsPolicy: {{ .Values.controller.dnsPolicy }}
{{- end }}

View File

@ -0,0 +1,13 @@
{{- if and .Values.controller.enabled .Values.controller.pdb }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "snapshot-controller.selectorLabels" . | nindent 6 }}
{{ toYaml .Values.controller.pdb | indent 2 }}
{{- end }}

View File

@ -0,0 +1,16 @@
{{- if and .Values.controller.enabled .Values.controller.serviceMonitor.create }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
clusterIP: None
ports:
- port: {{ (.Values.controller.args.httpEndpoint | split ":")._1 }}
targetPort: {{ (.Values.controller.args.httpEndpoint | split ":")._1 }}
name: http
selector:
{{- include "snapshot-controller.selectorLabels" . | nindent 4 }}
{{- end }}

View File

@ -0,0 +1,96 @@
{{- if .Values.controller.enabled }}
{{- if .Values.controller.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "snapshot-controller.serviceAccountName" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
{{- end }}
---
{{- if .Values.controller.rbac.create }}
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "snapshot-controller.fullname" . }}
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: [""]
resources: ["events"]
verbs: ["list", "watch", "create", "update", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete", "patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshotcontents/status"]
verbs: ["patch"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots"]
verbs: ["create", "get", "list", "watch", "update", "patch", "delete"]
- apiGroups: ["snapshot.storage.k8s.io"]
resources: ["volumesnapshots/status"]
verbs: ["update", "patch"]
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshotclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshotcontents"]
verbs: ["create", "get", "list", "watch", "update", "delete", "patch"]
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshotcontents/status"]
verbs: ["patch"]
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshots"]
verbs: ["get", "list", "watch", "update", "patch"]
- apiGroups: ["groupsnapshot.storage.k8s.io"]
resources: ["volumegroupsnapshots/status"]
verbs: ["update", "patch"]
{{- if get .Values.controller.args "enableDistributedSnapshotting" }}
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
{{- end }}
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "snapshot-controller.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "snapshot-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ include "snapshot-controller.fullname" . }}
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "snapshot-controller.fullname" . }}
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "watch", "list", "delete", "update", "create"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "snapshot-controller.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "snapshot-controller.serviceAccountName" . }}
roleRef:
kind: Role
name: {{ include "snapshot-controller.fullname" . }}
apiGroup: rbac.authorization.k8s.io
{{- end }}
{{- end }}

View File

@ -0,0 +1,15 @@
{{- if and .Values.controller.enabled .Values.controller.serviceMonitor.create }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "snapshot-controller.fullname" . }}
labels:
{{- include "snapshot-controller.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "snapshot-controller.selectorLabels" . | nindent 6 }}
endpoints:
- port: http
path: /metrics
{{- end }}

View File

@ -0,0 +1,19 @@
#{{- if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}}
# {{- $found := dict -}}
# {{- set $found "groupsnapshot.storage.k8s.io/v1beta1/VolumeGroupSnapshotClass" false -}}
# {{- set $found "groupsnapshot.storage.k8s.io/v1beta1/VolumeGroupSnapshotContent" false -}}
# {{- set $found "groupsnapshot.storage.k8s.io/v1beta1/VolumeGroupSnapshot" false -}}
# {{- set $found "snapshot.storage.k8s.io/v1/VolumeSnapshotClass" false -}}
# {{- set $found "snapshot.storage.k8s.io/v1/VolumeSnapshotContent" false -}}
# {{- set $found "snapshot.storage.k8s.io/v1/VolumeSnapshot" false -}}
# {{- range .Capabilities.APIVersions -}}
# {{- if hasKey $found (toString .) -}}
# {{- set $found (toString .) true -}}
# {{- end -}}
# {{- end -}}
# {{- range $_, $exists := $found -}}
# {{- if (eq $exists false) -}}
# {{- required "Required CRDs are missing. Please install the corresponding CRD chart before installing this chart." "" -}}
# {{- end -}}
# {{- end -}}
#{{- end -}}

View File

@ -0,0 +1,22 @@
{{- if .Values.controller.enabled }}
{{- range .Values.controller.volumeSnapshotClasses }}
---
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
metadata:
name: {{ .name }}
{{- with .annotations }}
annotations: {{- . | toYaml | trim | nindent 4 }}
{{- end }}
labels:
{{- include "snapshot-controller.labels" $ | nindent 4 }}
{{- with .labels }}
{{- . | toYaml | trim | nindent 4 }}
{{- end }}
driver: {{ .driver }}
deletionPolicy: {{ .deletionPolicy }}
{{- with .parameters }}
parameters: {{- . | toYaml | trim | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,92 @@
controller:
enabled: true
replicaCount: 1
revisionHistoryLimit: 10
args:
leaderElection: true
leaderElectionNamespace: "$(NAMESPACE)"
httpEndpoint: ":8080"
image:
repository: rancher/mirrored-sig-storage-snapshot-validation-webhook
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
imagePullSecrets: []
podAnnotations: {}
podLabels: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 1000
resources: {}
nodeSelector:
kubernetes.io/os: linux
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
- key: "node-role.kubernetes.io/etcd"
operator: "Exists"
effect: "NoExecute"
affinity: {}
## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
##
pdb: {}
topologySpreadConstraints: []
rbac:
# Specifies whether RBAC resources should be created
create: true
serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
name: ""
serviceMonitor:
# Specifies whether a ServiceMonitor should be created
create: false
volumeSnapshotClasses: []
# - name: linstor-csi-delete
# annotations:
# snapshot.storage.kubernetes.io/is-default-class: "true"
# labels:
# velero.io/csi-volumesnapshot-class: "true"
# driver: linstor.csi.linbit.com
# deletionPolicy: Delete
priorityClassName: ""
# Specifies wether a Priority Class should be attached to deployment pods
# Change `hostNetwork` to `true` when you want the pod to share its host's network namespace.
hostNetwork: false
# DNS settings for the controller pod. https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config
dnsConfig: {}
# DNS Policy for controller pod. For Pods running with hostNetwork, set to `ClusterFirstWithHostNet`
# For further reference: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy.
dnsPolicy: ClusterFirst
global:
systemDefaultRegistry: ""

View File

@ -16182,6 +16182,30 @@ entries:
- assets/rke2-runtimeclasses/rke2-runtimeclasses-0.1.000.tgz
version: 0.1.000
rke2-snapshot-controller:
- apiVersion: v2
appVersion: v8.2.0
created: "2025-01-08T21:12:53.755341902Z"
description: |
Deploys a Snapshot Controller in a cluster. Snapshot Controllers are often bundled with the Kubernetes distribution,
this chart is meant for cases where it is not.
digest: cf09013d7b346e18c256a5f555c376aa4485acffd73932a16b7d751bb5a1af47
home: https://github.com/piraeusdatastore/helm-charts
icon: https://raw.githubusercontent.com/piraeusdatastore/piraeus/master/artwork/sandbox-artwork/icon/color.svg
keywords:
- storage
- snapshot
- validation
kubeVersion: '>= 1.25.0-0'
maintainers:
- name: The Piraeus Maintainers
url: https://github.com/piraeusdatastore/
name: rke2-snapshot-controller
sources:
- https://github.com/kubernetes-csi/external-snapshotter/
type: application
urls:
- assets/rke2-snapshot-controller/rke2-snapshot-controller-4.0.001.tgz
version: 4.0.001
- apiVersion: v2
appVersion: v8.1.0
created: "2024-10-17T03:43:10.458081411Z"
@ -16310,6 +16334,16 @@ entries:
- assets/rke2-snapshot-controller/rke2-snapshot-controller-1.7.200.tgz
version: 1.7.200
rke2-snapshot-controller-crd:
- apiVersion: v1
appVersion: v8.2.0
created: "2025-01-08T21:12:53.757733171Z"
description: Installs the CRDs for rke2-snapshot-controller
digest: 9bdb5aa4ca585c6d8b04b5e25b62b1183f46289717613e23a4c77e77861da099
name: rke2-snapshot-controller-crd
type: application
urls:
- assets/rke2-snapshot-controller/rke2-snapshot-controller-crd-4.0.001.tgz
version: 4.0.001
- apiVersion: v1
appVersion: v8.1.0
created: "2024-10-17T03:43:10.459764399Z"