@@ -157,6 +157,33 @@ type VolumeSource struct {
157
157
// CSI (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature).
158
158
// +optional
159
159
CSI * CSIVolumeSource
160
+ // Ephemeral represents a volume that is handled by a cluster storage driver (Alpha feature).
161
+ // The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts,
162
+ // and deleted when the pod is removed.
163
+ //
164
+ // Use this if:
165
+ // a) the volume is only needed while the pod runs,
166
+ // b) features of normal volumes like restoring from snapshot or capacity
167
+ // tracking are needed,
168
+ // c) the storage driver is specified through a storage class, and
169
+ // d) the storage driver supports dynamic volume provisioning through
170
+ // a PersistentVolumeClaim (see EphemeralVolumeSource for more
171
+ // information on the connection between this volume type
172
+ // and PersistentVolumeClaim).
173
+ //
174
+ // Use PersistentVolumeClaim or one of the vendor-specific
175
+ // APIs for volumes that persist for longer than the lifecycle
176
+ // of an individual pod.
177
+ //
178
+ // Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to
179
+ // be used that way - see the documentation of the driver for
180
+ // more information.
181
+ //
182
+ // A pod can use both types of ephemeral volumes and
183
+ // persistent volumes at the same time.
184
+ //
185
+ // +optional
186
+ Ephemeral * EphemeralVolumeSource
160
187
}
161
188
162
189
// PersistentVolumeSource is similar to VolumeSource but meant for the administrator who creates PVs.
@@ -1670,6 +1697,53 @@ type CSIVolumeSource struct {
1670
1697
NodePublishSecretRef * LocalObjectReference
1671
1698
}
1672
1699
1700
+ // EphemeralVolumeSource represents an ephemeral volume that is handled by a normal storage driver.
1701
+ type EphemeralVolumeSource struct {
1702
+ // VolumeClaimTemplate will be used to create a stand-alone PVC to provision the volume.
1703
+ // The pod in which this EphemeralVolumeSource is embedded will be the
1704
+ // owner of the PVC, i.e. the PVC will be deleted together with the
1705
+ // pod. The name of the PVC will be `<pod name>-<volume name>` where
1706
+ // `<volume name>` is the name from the `PodSpec.Volumes` array
1707
+ // entry. Pod validation will reject the pod if the concatenated name
1708
+ // is not valid for a PVC (for example, too long).
1709
+ //
1710
+ // An existing PVC with that name that is not owned by the pod
1711
+ // will *not* be used for the pod to avoid using an unrelated
1712
+ // volume by mistake. Starting the pod is then blocked until
1713
+ // the unrelated PVC is removed. If such a pre-created PVC is
1714
+ // meant to be used by the pod, the PVC has to updated with an
1715
+ // owner reference to the pod once the pod exists. Normally
1716
+ // this should not be necessary, but it may be useful when
1717
+ // manually reconstructing a broken cluster.
1718
+ //
1719
+ // This field is read-only and no changes will be made by Kubernetes
1720
+ // to the PVC after it has been created.
1721
+ //
1722
+ // Required, must not be nil.
1723
+ VolumeClaimTemplate * PersistentVolumeClaimTemplate
1724
+
1725
+ // ReadOnly specifies a read-only configuration for the volume.
1726
+ // Defaults to false (read/write).
1727
+ // +optional
1728
+ ReadOnly bool
1729
+ }
1730
+
1731
+ // PersistentVolumeClaimTemplate is used to produce
1732
+ // PersistentVolumeClaim objects as part of an EphemeralVolumeSource.
1733
+ type PersistentVolumeClaimTemplate struct {
1734
+ // ObjectMeta may contain labels and annotations that will be copied into the PVC
1735
+ // when creating it. No other fields are allowed and will be rejected during
1736
+ // validation.
1737
+ // +optional
1738
+ metav1.ObjectMeta
1739
+
1740
+ // Spec for the PersistentVolumeClaim. The entire content is
1741
+ // copied unchanged into the PVC that gets created from this
1742
+ // template. The same fields as in a PersistentVolumeClaim
1743
+ // are also valid here.
1744
+ Spec PersistentVolumeClaimSpec
1745
+ }
1746
+
1673
1747
// ContainerPort represents a network port in a single container
1674
1748
type ContainerPort struct {
1675
1749
// Optional: If specified, this must be an IANA_SVC_NAME Each named port
0 commit comments