Skip to content

Commit

Permalink
README.md: fix and clarify examples
Browse files Browse the repository at this point in the history
The previous `kubectl create -f examples` no longer worked as intended
after adding several more example yamls, in particular because
csi-app-inline.yaml reused the pod name.

When selecting files explicitly, the previous example works again as
before. The pod name in csi-app-inline.yaml gets changed such that it
can be used in parallel.

This approach was chosen instead of moving files into sub-directories
because csi-storageclass.yaml is needed by more than one example. When
using "kubectl apply" instead of "kubectl create" we
could (theoretically) re-use files in different examples without
causing errors. In practice, the raw block example is currently not
explicitly called out in the README.md.

The snapshotting example however can't be used stand-alone and depends
on the simple PVC.
  • Loading branch information
pohly committed Jul 8, 2019
1 parent 7d4b674 commit cd0f09f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ csi-hostpathplugin-0 2/2 Running 0 5m45s
From the root directory, deploy the application pods including a storage class, a PVC, and a pod which mounts a volume using the Hostpath driver found in directory `./examples`:

```shell
$ kubectl create -f ./examples
$ for i in ./examples/csi-storageclass.yaml ./examples/csi-pvc.yaml ./examples/csi-app.yaml; do kubectl apply -f $i; done
pod/my-csi-app created
persistentvolumeclaim/csi-pvc created
storageclass.storage.k8s.io/csi-hostpath-sc created
Expand Down Expand Up @@ -234,9 +234,10 @@ Since volume snapshot is an alpha feature starting in Kubernetes v1.12, you need
> Events: <none>
> ```
Use the volume snapshot class to dynamically create a volume snapshot:
After having created the `csi-pvc` as described in the example above,
use the volume snapshot class to dynamically create a volume snapshot:
> $ kubectl create -f examples/csi-snapshot.yaml
> $ kubectl apply -f examples/csi-snapshot.yaml
> ```
> volumesnapshot.snapshot.storage.k8s.io/new-snapshot-demo created
> ```
Expand Down Expand Up @@ -324,7 +325,7 @@ Use the volume snapshot class to dynamically create a volume snapshot:
Follow the following example to create a volume from a volume snapshot:
> $ kubectl create -f examples/csi-restore.yaml
> $ kubectl apply -f examples/csi-restore.yaml
> `persistentvolumeclaim/hpvc-restore created`
>
> $ kubectl get pvc
Expand Down
2 changes: 1 addition & 1 deletion examples/csi-app-inline.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: Pod
apiVersion: v1
metadata:
name: my-csi-app
name: my-csi-app-inline
spec:
containers:
- name: my-frontend
Expand Down

0 comments on commit cd0f09f

Please sign in to comment.