1package v1beta1
2
3import "time"
4
5// VolumeSnapshot is a user's request for either creating a point-in-time
6// snapshot of a persistent volume, or binding to a pre-existing snapshot.
7#VolumeSnapshot: {
8 _embeddedResource
9
10 // APIVersion defines the versioned schema of this representation of an object.
11 // Servers should convert recognized schemas to the latest internal value, and
12 // may reject unrecognized values. More info:
13 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
14 "apiVersion"?: string
15
16 // Kind is a string value representing the REST resource this object represents.
17 // Servers may infer this from the endpoint the client submits requests to.
18 // Cannot be updated. In CamelCase. More info:
19 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
20 "kind"?: string
21
22 // spec defines the desired characteristics of a snapshot requested by a user.
23 // More info:
24 // https://kubernetes.io/docs/concepts/storage/volume-snapshots#volumesnapshots
25 // Required.
26 "spec"!: {
27 // source specifies where a snapshot will be created from. This field is
28 // immutable after creation. Required.
29 "source"!: {
30 // persistentVolumeClaimName specifies the name of the PersistentVolumeClaim
31 // object representing the volume from which a snapshot should be created. This
32 // PVC is assumed to be in the same namespace as the VolumeSnapshot object.
33 // This field should be set if the snapshot does not exists, and needs to be
34 // created. This field is immutable.
35 "persistentVolumeClaimName"?: string
36
37 // volumeSnapshotContentName specifies the name of a pre-existing
38 // VolumeSnapshotContent object representing an existing volume snapshot. This
39 // field should be set if the snapshot already exists and only needs a
40 // representation in Kubernetes. This field is immutable.
41 "volumeSnapshotContentName"?: string
42 }
43
44 // VolumeSnapshotClassName is the name of the VolumeSnapshotClass requested by
45 // the VolumeSnapshot. VolumeSnapshotClassName may be left nil to indicate that
46 // the default SnapshotClass should be used. A given cluster may have multiple
47 // default Volume SnapshotClasses: one default per CSI Driver. If a
48 // VolumeSnapshot does not specify a SnapshotClass, VolumeSnapshotSource will
49 // be checked to figure out what the associated CSI Driver is, and the default
50 // VolumeSnapshotClass associated with that CSI Driver will be used. If more
51 // than one VolumeSnapshotClass exist for a given CSI Driver and more than one
52 // have been marked as default, CreateSnapshot will fail and generate an event.
53 // Empty string is not allowed for this field.
54 "volumeSnapshotClassName"?: string
55 }
56
57 // status represents the current information of a snapshot. Consumers must
58 // verify binding between VolumeSnapshot and VolumeSnapshotContent objects is
59 // successful (by validating that both VolumeSnapshot and VolumeSnapshotContent
60 // point at each other) before using this object.
61 "status"?: {
62 // boundVolumeSnapshotContentName is the name of the VolumeSnapshotContent
63 // object to which this VolumeSnapshot object intends to bind to. If not
64 // specified, it indicates that the VolumeSnapshot object has not been
65 // successfully bound to a VolumeSnapshotContent object yet. NOTE: To avoid
66 // possible security issues, consumers must verify binding between
67 // VolumeSnapshot and VolumeSnapshotContent objects is successful (by
68 // validating that both VolumeSnapshot and VolumeSnapshotContent point at each
69 // other) before using this object.
70 "boundVolumeSnapshotContentName"?: string
71
72 // creationTime is the timestamp when the point-in-time snapshot is taken by the
73 // underlying storage system. In dynamic snapshot creation case, this field
74 // will be filled in by the snapshot controller with the "creation_time" value
75 // returned from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot,
76 // this field will be filled with the "creation_time" value returned from the
77 // CSI "ListSnapshots" gRPC call if the driver supports it. If not specified,
78 // it may indicate that the creation time of the snapshot is unknown.
79 "creationTime"?: time.Time
80
81 // error is the last observed error during snapshot creation, if any. This field
82 // could be helpful to upper level controllers(i.e., application controller) to
83 // decide whether they should continue on waiting for the snapshot to be
84 // created based on the type of error reported. The snapshot controller will
85 // keep retrying when an error occurs during the snapshot creation. Upon
86 // success, this error field will be cleared.
87 "error"?: {
88 // message is a string detailing the encountered error during snapshot creation
89 // if specified. NOTE: message may be logged, and it should not contain
90 // sensitive information.
91 "message"?: string
92
93 // time is the timestamp when the error was encountered.
94 "time"?: time.Time
95 }
96
97 // readyToUse indicates if the snapshot is ready to be used to restore a volume.
98 // In dynamic snapshot creation case, this field will be filled in by the
99 // snapshot controller with the "ready_to_use" value returned from CSI
100 // "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field will be
101 // filled with the "ready_to_use" value returned from the CSI "ListSnapshots"
102 // gRPC call if the driver supports it, otherwise, this field will be set to
103 // "True". If not specified, it means the readiness of a snapshot is unknown.
104 "readyToUse"?: bool
105
106 // restoreSize represents the minimum size of volume required to create a volume
107 // from this snapshot. In dynamic snapshot creation case, this field will be
108 // filled in by the snapshot controller with the "size_bytes" value returned
109 // from CSI "CreateSnapshot" gRPC call. For a pre-existing snapshot, this field
110 // will be filled with the "size_bytes" value returned from the CSI
111 // "ListSnapshots" gRPC call if the driver supports it. When restoring a volume
112 // from this snapshot, the size of the volume MUST NOT be smaller than the
113 // restoreSize if it is specified, otherwise the restoration will fail. If not
114 // specified, it indicates that the size is unknown.
115 "restoreSize"?:
116 =~"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$"
117 }
118
119 _embeddedResource: {
120 "apiVersion"!: string
121 "kind"!: string
122 "metadata"?: {...}
123 }
124 apiVersion: "snapshot.storage.k8s.io/v1beta1"
125 kind: "VolumeSnapshot"
126 metadata!: {
127 "name"!: string
128 "namespace"!: string
129 "labels"?: {[string]: string}
130 "annotations"?: {[string]: string}
131 ...
132 }
133}