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

snapshot/v1/VolumeSnapshot.cue raw

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