From 3158a07d0a90ec233fcdd3e7bdab2c5a5a67320b Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Wed, 14 Apr 2021 13:33:07 +0200 Subject: [PATCH 1/9] Add Kustomize support --- deploy/kustomization.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 deploy/kustomization.yml diff --git a/deploy/kustomization.yml b/deploy/kustomization.yml new file mode 100644 index 00000000..cb813863 --- /dev/null +++ b/deploy/kustomization.yml @@ -0,0 +1,4 @@ +resources: + - class.yaml + - rbac.yaml + - deployment.yaml From 71bb338ca856a7435e028c4551e75de1a52e76d3 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Wed, 14 Apr 2021 14:15:48 +0200 Subject: [PATCH 2/9] Change extension to .yaml --- deploy/{kustomization.yml => kustomization.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename deploy/{kustomization.yml => kustomization.yaml} (100%) diff --git a/deploy/kustomization.yml b/deploy/kustomization.yaml similarity index 100% rename from deploy/kustomization.yml rename to deploy/kustomization.yaml From 0d5e4147f5c3955842194e9264ed9ef8ced99e9d Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 15 Apr 2021 09:28:12 +0200 Subject: [PATCH 3/9] Add Kustomize instructions to README --- README.md | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 113 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f57b09a4..8b6360de 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,119 @@ $ helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/n --set nfs.path=/exported/path ``` -### Without Helm +### With Kustomize + +**Step 1: Get connection information for your NFS server** + +Make sure your NFS server is accessible from your Kubernetes cluster and get the information you need to connect to it. At a minimum you will need its hostname. + +**Step 2: Add the base resource** + +Create a `kustomization.yaml` file in a directory of your choice, and add the [deploy](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/master/deploy) directory as a resource. This will use the kustomization file within that folder as our base. + +```yaml +namespace: nfs-provisioner +resources: + - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy +``` + +**Step 3: Create namespace resource** + +Create a file with your namespace resource. The name can be anything as it will get overwritten by the namespace in your kustomization file. +```yaml +# namespace.yaml +apiVersion: v1 +kind: Namespace +metadata: + name: nfs-provisioner +``` + +**Step 4: Configure deployment** + +To configure the deployment, you will need to patch the it's container variables with the connection information for your NFS Server. + +```yaml +# patch_nfs_details.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: nfs-client-provisioner + name: nfs-client-provisioner +spec: + template: + spec: + containers: + - name: nfs-client-provisioner + env: + - name: NFS_SERVER + value: + - name: NFS_PATH + value: + volumes: + - name: nfs-client-root + nfs: + server: + path: +``` + +Replace occurrences of `` and `` with your connection information. + +**Step 5: Add resources and deploy** + +Add the namespace resource and patch you created in earlier steps. +```yaml +namespace: nfs-provisioner +resources: + - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy + - namespace.yaml +patchesStrategicMerge: + - patch_nfs_details.yaml +``` +Deploy (run inside folder with your kustomization file): +```sh +kubectl -k . +``` + +**Step 6: Finally, test your environment!** + +Now we'll test your NFS subdir external provisioner. + +Deploy: + +```sh +$ kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-claim.yaml -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-pod.yaml +``` + +Now check your NFS Server for the file `SUCCESS`. + +```sh +$ kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-claim.yaml -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-pod.yaml +``` + +Now check the folder has been deleted. + +**Step 7: Deploying your own PersistentVolumeClaims** + +To deploy your own PVC, make sure that you have the correct `storageClassName` (by default `managed-nfs-storage`). You can also patch the StorageClass resource to change it, like so: + +```yaml +# kustomization.yaml +namespace: nfs-provisioner +resources: + - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy + - namespace.yaml +patches: +- target: + kind: StorageClass + name: managed-nfs-storage + patch: |- + - op: replace + path: /metadata/name + value: +``` + +### Manually **Step 1: Get connection information for your NFS server** From eee6810fe93a53294407bf35b4e366c142d56198 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 15 Apr 2021 13:21:34 +0200 Subject: [PATCH 4/9] Fix instructions to comply with MD031 (blanks-around-fences) --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 8b6360de..24f4a10a 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ resources: **Step 3: Create namespace resource** Create a file with your namespace resource. The name can be anything as it will get overwritten by the namespace in your kustomization file. + ```yaml # namespace.yaml apiVersion: v1 @@ -85,6 +86,7 @@ Replace occurrences of `` and `` with **Step 5: Add resources and deploy** Add the namespace resource and patch you created in earlier steps. + ```yaml namespace: nfs-provisioner resources: @@ -93,7 +95,9 @@ resources: patchesStrategicMerge: - patch_nfs_details.yaml ``` + Deploy (run inside folder with your kustomization file): + ```sh kubectl -k . ``` From 7560b5ea3bebe9892efcb6ace2af4fbd94407912 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 15 Apr 2021 13:25:00 +0200 Subject: [PATCH 5/9] Trim whitespaces in README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 24f4a10a..b68aa74b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **NFS subdir external provisioner** is an automatic provisioner that use your _existing and already configured_ NFS server to support dynamic provisioning of Kubernetes Persistent Volumes via Persistent Volume Claims. Persistent volumes are provisioned as `${namespace}-${pvcName}-${pvName}`. Note: This repository is migrated from https://github.com/kubernetes-incubator/external-storage/tree/master/nfs-client. As part of the migration: -- The container image name and repository has changed to `gcr.io/k8s-staging-sig-storage` and `nfs-subdir-external-provisioner` respectively. +- The container image name and repository has changed to `gcr.io/k8s-staging-sig-storage` and `nfs-subdir-external-provisioner` respectively. - To maintain backward compatibility with earlier deployment files, the naming of NFS Client Provisioner is retained as `nfs-client-provisioner` in the deployment YAMLs. - One of the pending areas for development on this repository is to add automated e2e tests. If you would like to contribute, please raise an issue or reach us on the Kubernetes slack #sig-storage channel. @@ -28,7 +28,7 @@ $ helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/n **Step 1: Get connection information for your NFS server** -Make sure your NFS server is accessible from your Kubernetes cluster and get the information you need to connect to it. At a minimum you will need its hostname. +Make sure your NFS server is accessible from your Kubernetes cluster and get the information you need to connect to it. At a minimum you will need its hostname. **Step 2: Add the base resource** @@ -54,7 +54,7 @@ metadata: **Step 4: Configure deployment** -To configure the deployment, you will need to patch the it's container variables with the connection information for your NFS Server. +To configure the deployment, you will need to patch the it's container variables with the connection information for your NFS Server. ```yaml # patch_nfs_details.yaml @@ -76,7 +76,7 @@ spec: value: volumes: - name: nfs-client-root - nfs: + nfs: server: path: ``` @@ -98,7 +98,7 @@ patchesStrategicMerge: Deploy (run inside folder with your kustomization file): -```sh +```sh kubectl -k . ``` @@ -298,7 +298,7 @@ To build your own custom container image from this repository, you will have to ```sh make build make container -# `nfs-subdir-external-provisioner:latest` will be created. +# `nfs-subdir-external-provisioner:latest` will be created. # Note: This will build a single-arch image that matches the machine on which container is built. # To upload this to your custom registry, say `quay.io/myorg` and arch as amd64, you can use # docker tag nfs-subdir-external-provisioner:latest quay.io/myorg/nfs-subdir-external-provisioner-amd64:latest From ee3f908c60d0fd267c60fb83ff4d5b3eabd6317e Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 15 Apr 2021 13:41:52 +0200 Subject: [PATCH 6/9] Change some instructions text --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b68aa74b..eeb8a11e 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,11 @@ $ helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/n **Step 1: Get connection information for your NFS server** -Make sure your NFS server is accessible from your Kubernetes cluster and get the information you need to connect to it. At a minimum you will need its hostname. +Make sure your NFS server is accessible from your Kubernetes cluster and get the information you need to connect to it. At a minimum you will need its hostname and exported share path. **Step 2: Add the base resource** -Create a `kustomization.yaml` file in a directory of your choice, and add the [deploy](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/master/deploy) directory as a resource. This will use the kustomization file within that folder as our base. +Create a `kustomization.yaml` file in a directory of your choice, and add the [deploy](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/master/deploy) directory as a resource. This will use the kustomization file within that directory as our base. ```yaml namespace: nfs-provisioner @@ -54,7 +54,7 @@ metadata: **Step 4: Configure deployment** -To configure the deployment, you will need to patch the it's container variables with the connection information for your NFS Server. +To configure the deployment, you will need to patch it's container variables with the connection information for your NFS Server. ```yaml # patch_nfs_details.yaml @@ -96,7 +96,7 @@ patchesStrategicMerge: - patch_nfs_details.yaml ``` -Deploy (run inside folder with your kustomization file): +Deploy (run inside directory with your kustomization file): ```sh kubectl -k . @@ -104,21 +104,21 @@ kubectl -k . **Step 6: Finally, test your environment!** -Now we'll test your NFS subdir external provisioner. +Now we'll test your NFS subdir external provisioner by creating a persistent volume claim and a pod that writes a test file to the volume. This will make sure that the provisioner is provisioning and that the NFS server is reachable and writable. -Deploy: +Deploy the test resources: ```sh $ kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-claim.yaml -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-pod.yaml ``` -Now check your NFS Server for the file `SUCCESS`. +Now check your NFS Server for the `SUCCESS` inside the PVC's directory. ```sh $ kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-claim.yaml -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-pod.yaml ``` -Now check the folder has been deleted. +Now check the PVC's directory has been deleted. **Step 7: Deploying your own PersistentVolumeClaims** From cedae1fee699e7fc769633910dfe2e24cc08b123 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 15 Apr 2021 13:43:50 +0200 Subject: [PATCH 7/9] Clarify test resource deletion command --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index eeb8a11e..e1204413 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,8 @@ $ kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir Now check your NFS Server for the `SUCCESS` inside the PVC's directory. +Delete the test resources: + ```sh $ kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-claim.yaml -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-subdir-external-provisioner/master/deploy/test-pod.yaml ``` From 8cd434fc327fe2d8f1af1aef6c24ab6cb21d96cd Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 17 Jun 2021 17:53:42 +0200 Subject: [PATCH 8/9] Fix apply command --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe57f75b..9892e545 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ patchesStrategicMerge: Deploy (run inside directory with your kustomization file): ```sh -kubectl -k . +kubectl apply -k . ``` **Step 6: Finally, test your environment!** From aff7adcdde2104aaa521fdb6bfca173a18218fc8 Mon Sep 17 00:00:00 2001 From: Weilbyte Date: Thu, 26 May 2022 12:29:47 +0200 Subject: [PATCH 9/9] Move bases to bases instead of resources --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9892e545..dd7c15b7 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ Make sure your NFS server is accessible from your Kubernetes cluster and get the **Step 2: Add the base resource** -Create a `kustomization.yaml` file in a directory of your choice, and add the [deploy](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/master/deploy) directory as a resource. This will use the kustomization file within that directory as our base. +Create a `kustomization.yaml` file in a directory of your choice, and add the [deploy](https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/tree/master/deploy) directory as a base. This will use the kustomization file within that directory as our base. ```yaml namespace: nfs-provisioner -resources: +bases: - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy ``` @@ -89,8 +89,9 @@ Add the namespace resource and patch you created in earlier steps. ```yaml namespace: nfs-provisioner -resources: +bases: - github.com/kubernetes-sigs/nfs-subdir-external-provisioner//deploy +resources: - namespace.yaml patchesStrategicMerge: - patch_nfs_details.yaml