Skip to content

Commit 30ebb99

Browse files
authored
[cinder-csi-plugin] Add example for generic epehemeral support (kubernetes#1594)
1 parent 905e989 commit 30ebb99

File tree

5 files changed

+46
-4
lines changed

5 files changed

+46
-4
lines changed

docs/cinder-csi-plugin/examples.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ index.html lost+found
102102

103103
## Deploy app using Inline volumes
104104

105-
Sample App definition on using Inline volumes can be found at [here](../../examples/cinder-csi-plugin/inline/inline-example.yaml)
105+
Sample App definition on using Inline volumes can be found at [here](../../examples/cinder-csi-plugin/ephemeral/csi-ephemeral-volumes-example.yaml)
106106

107107
Prerequisites:
108108
* Deploy CSI Driver, with both volumeLifecycleModes enabled as specified [here](../../manifests/cinder-csi-plugin/csi-cinder-driver.yaml)
109109

110110
Create a pod with inline volume
111111
```
112-
$ kubectl create -f examples/cinder-csi-plugin/inline/inline-example.yaml
112+
$ kubectl create -f examples/cinder-csi-plugin/ephemeral/csi-ephemeral-volumes-example.yaml
113113
```
114114
Get the pod description, verify created volume in Volumes section.
115115
```

docs/cinder-csi-plugin/features.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ This feature enables creating volume snapshots and restore volume from snapshot.
6666
* To avail the feature. deploy the snapshot-controller and CRDs as part of their Kubernetes cluster management process (independent of any CSI Driver) . For more info, refer [Snapshot Controller](https://kubernetes-csi.github.io/docs/snapshot-controller.html)
6767
* For example on using snapshot feature, refer [sample app](./examples#snapshot-create-and-restore)
6868

69-
## Inline Volumes
69+
## Ephemeral Volumes
70+
71+
Two different Kubernetes features allow volumes to follow the Pod's lifecycle: CSI Ephemeral Volumes and Generic Ephemeral Volumes
72+
73+
### CSI Ephemeral Volumes
7074

7175
This feature allows CSI volumes to be directly embedded in the Pod specification instead of a PersistentVolume. Volumes specified in this way are ephemeral and do not persist across Pod restarts.
7276

@@ -75,6 +79,12 @@ This feature allows CSI volumes to be directly embedded in the Pod specification
7579
* `podInfoOnMount` must be `true` to use this feature.
7680
* For usage, refer [sample app](./examples.md#deploy-app-using-inline-volumes)
7781

82+
### Generic Ephemeral Volumes
83+
84+
As of Kubernetes v1.21, this is beta feature and enabled by default.
85+
86+
The key design idea is that the parameters for a volume claim are allowed inside a volume source of the Pod. For sample app, refer [here](../../examples/cinder-csi-plugin/ephemeral/generic-ephemeral-volumes.yaml)
87+
7888
## Volume Cloning
7989

8090
This feature enables cloning a volume from existing PVCs in Kubernetes. As of Kubernetes v1.16, volume cloning is beta feature and enabled by default.

docs/cinder-csi-plugin/using-cinder-csi-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ helm install --namespace kube-system --name cinder-csi ./charts/cinder-csi-plugi
228228
* [Volume Expansion](./features.md#volume-expansion)
229229
* [Volume Cloning](./features.md#volume-cloning)
230230
* [Volume Snapshots](./features.md#volume-snapshots)
231-
* [Inline Volumes](./features.md#inline-volumes)
231+
* [Ephemeral Volumes](./features.md#inline-volumes)
232232
* [Multiattach Volumes](./features.md#multi-attach-volumes)
233233
* [Liveness probe](./features.md#liveness-probe)
234234

File renamed without changes.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apiVersion: storage.k8s.io/v1
2+
kind: StorageClass
3+
metadata:
4+
name: scratch-storage-class
5+
provisioner: cinder.csi.openstack.org
6+
7+
---
8+
apiVersion: v1
9+
kind: Pod
10+
metadata:
11+
name: ephemeral-example
12+
spec:
13+
containers:
14+
- image: nginx
15+
imagePullPolicy: IfNotPresent
16+
name: nginx-inline
17+
volumeMounts:
18+
- name: scratch-volume
19+
mountPath: /var/lib/www/html
20+
volumes:
21+
- name: scratch-volume
22+
ephemeral:
23+
volumeClaimTemplate:
24+
metadata:
25+
labels:
26+
type: my-frontend-volume
27+
spec:
28+
accessModes: [ "ReadWriteOnce" ]
29+
storageClassName: scratch-storage-class
30+
resources:
31+
requests:
32+
storage: 1Gi

0 commit comments

Comments
 (0)