cue.dev/x/crd/k8s.io/storage@v0.1.0

snapshot/v1/VolumeSnapshot.cue raw

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