Skip to content

Commit

Permalink
Ephemeral volumes support
Browse files Browse the repository at this point in the history
Added support for provisioning of ephemeral/csi-inline volumes. This only works
in Kubernetes v1.15+.

Kubernetes v1.15 does not provide any additional information about 'ephemeral'
volumes in NodePublishVolume() call. So, to address this issue, we assume to
create ephemeral volume if the following all cases are met:
  - Volume with given volume-id is not found
  - Missing StagingTargetPath in the NodePublishRequest
  - No provisioner information in NodePlubishRequest.VolumeContext

Added sample application deployment to illustrate ephemeral volume usage.

TODO: Extend e2e tests to ephemeral volumes.
  • Loading branch information
avalluri committed Aug 22, 2019
1 parent 418d804 commit 626d908
Show file tree
Hide file tree
Showing 20 changed files with 277 additions and 157 deletions.
11 changes: 7 additions & 4 deletions README.md
Expand Up @@ -325,7 +325,7 @@ can reuse existing local data when restarting.
Volume | Kubernetes | PMEM-CSI | Limitations
--- | --- | --- | ---
Persistent | supported | supported | topology aware scheduling<sup>1</sup>
Ephemeral | [in design](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md#proposal) | in design | topology aware scheduling<sup>1</sup>, resource constraints<sup>2</sup>
Ephemeral | supported | supported | resource constraints<sup>2</sup>
Cache | supported | supported | topology aware scheduling<sup>1</sup>

<sup>1 </sup>[Topology aware
Expand All @@ -344,8 +344,8 @@ the node cannot start until resources become available.

#### Usage on Kubernetes

Kubernetes cluster administrators can expose above mentioned [volume
persistency types](#volume-persistency) to applications using
Kubernetes cluster administrators can expose above mentioned Persistent and Cache volumes
to applications using
[`StorageClass
Parameters`](https://kubernetes.io/docs/concepts/storage/storage-classes/#parameters). An
optional `persistencyModel` parameter differentiates how the
Expand Down Expand Up @@ -400,6 +400,9 @@ application](deploy/common/pmem-app-cache.yaml) example.
* A node is only chosen the first time a pod starts. After that it will always restart
on that node, because that is where the persistent volume was created.

Volume requests embedded in Pod spec are provisioned as Ephemeral volumes. Check with
provided [example application](deploy/kubernetes-1.15/pmem-app-ephemeral.yaml) for
ephemeral volume usage.
## Prerequisites

### Software required
Expand Down Expand Up @@ -515,7 +518,7 @@ Kubernetes cluster has been verified on:
|-------------------|--------------------------------|------------------------------- |
| devel | Kubernetes 1.13 | CSINodeInfo, CSIDriverRegistry |
| devel | Kubernetes 1.14 | |
| devel | Kubernetes 1.15 | |
| devel | Kubernetes 1.15 | CSIInlineVolume |

## Setup

Expand Down
22 changes: 22 additions & 0 deletions deploy/common/pmem-app-ephemeral.yaml
@@ -0,0 +1,22 @@
# This demonstrates how to use inline pmem csi volumes
kind: Pod
apiVersion: v1
metadata:
name: my-csi-app-inline-volume
spec:
containers:
- name: my-frontend
image: busybox
command: [ "sleep", "100000" ]
volumeMounts:
- mountPath: "/data"
name: my-csi-volume
volumes:
- name: my-csi-volume
csi:
driver: pmem-csi.intel.com
fsType: "xfs"
volumeAttributes:
size: "2Gi"
nsmode: "fsdax"

1 change: 0 additions & 1 deletion deploy/kubernetes-1.15

This file was deleted.

1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-app-cache.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-app-ephemeral.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-app-late-binding.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-app.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-pvc-cache.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-pvc-late-binding.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-pvc.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-storageclass-cache.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-storageclass-ext4.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-storageclass-late-binding.yaml
1 change: 1 addition & 0 deletions deploy/kubernetes-1.15/pmem-storageclass-xfs.yaml
6 changes: 3 additions & 3 deletions pkg/pmem-csi-driver/controllerserver-master.go
Expand Up @@ -37,9 +37,9 @@ const (
pmemParameterKeyPersistencyModel = "persistencyModel"
pmemParameterKeyCacheSize = "cacheSize"

pmemPersistencyModelNone PmemPersistencyModel = "none"
pmemPersistencyModelCache PmemPersistencyModel = "cache"
//pmemPersistencyModelEphemeral PmemPersistencyModel = "ephemeral"
pmemPersistencyModelNone PmemPersistencyModel = "none"
pmemPersistencyModelCache PmemPersistencyModel = "cache"
pmemPersistencyModelEphemeral PmemPersistencyModel = "ephemeral"
)

type PmemPersistencyModel string
Expand Down

0 comments on commit 626d908

Please sign in to comment.