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

snapshot/v1beta1/VolumeSnapshot.cue raw

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