1
0

Compare commits

...

77 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
4f955d1a21 Merge pull request #130 from crookedstorm/master
helm chart: allow persistentVolumeClaim in psp or pod never launches
2021-08-04 08:27:24 -07:00
Kubernetes Prow Robot
5f97c83a65 Merge pull request #111 from koivunen/patch-1
Describe NFS limitations
2021-08-01 12:13:21 -07:00
Brooke Storm
1271831fbd bump chart version 2021-07-31 20:42:33 -07:00
Brooke Storm
b74a204cda helm chart: allow persistentVolumeClaim in psp or pod never launches
Simple fix, but if you have podsecuritypolicy in your cluster, this
chart doesn't work without this change.
2021-07-30 16:35:33 -07:00
Koivunen
7b9f0e8db2 Update README.md 2021-06-30 15:38:57 +03:00
Kubernetes Prow Robot
e289a21201 Merge pull request #108 from larisoncarvalho/larisoncarvalho-patch-1
Update sed command for OpenShift in README.md
2021-06-28 20:54:40 -07:00
Kubernetes Prow Robot
5c0dd02dfb Merge pull request #100 from yonatankahana/podlabels
Use podLabels with user defined labels in deployment pod template
2021-06-28 20:52:40 -07:00
Yonatan Kahana
6b5f99c430 Bump chart version to 4.0.12
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-06-13 18:13:42 +03:00
Kubernetes Prow Robot
65ce8894da Merge pull request #110 from equinix-ms/master
chart: Add option to set nfs root volume name.
2021-06-13 08:09:02 -07:00
Robin Elfrink
23c664fd54 chart: Add option to set nfs root volume name.
Signed-off-by: Robin Elfrink <robin.elfrink@eu.equinix.com>
2021-06-10 07:17:06 +02:00
Koivunen
c848d9c7ce Describe NFS limitations 2021-06-03 19:46:29 +03:00
Larison Carvalho
f552bc6a79 Update README.md
Replace namespace in `./deploy/deployment.yaml` as well for OpenShift deployments
2021-06-02 12:31:02 +05:30
Kubernetes Prow Robot
5e1b342945 Merge pull request #92 from yonatankahana/no-staging-in-readme
Update the README file with stable image repository
2021-05-13 11:28:39 -07:00
Yonatan Kahana
4ee25693f5 Use podLabels with user defined labels in deployment pod template
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-05-13 21:03:24 +03:00
Kubernetes Prow Robot
ba1654f02c Merge pull request #65 from johnsimcall/patch-1
Fix README.md
2021-05-11 09:54:37 -07:00
John Call
09a32a7aad also remove the command that creates an unnecessary SCC 2021-05-11 10:43:59 -06:00
Kubernetes Prow Robot
ae50b6da6c Merge pull request #71 from khalsa-ji/bugfix/provisioningFails-storageclassWith-WaitForFirstConsumer
PV provisioning fails when storageclass has volumeBindingMode as 'WaitForFirstConsumer'
2021-04-29 12:16:12 -07:00
Ravikiran Singh
2cad8da61c PV provisioning fails when storageclass has volumeBindingMode as 'WaitForFirstConsumer':
1. Adds RBAC permissions to get nodes in the cluster.
2. Bumps the chart version
2021-04-28 13:03:50 +05:30
Yonatan Kahana
d8db2d111e Update the README file with stable image repository
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-04-25 22:43:05 +03:00
Kubernetes Prow Robot
7947697c42 Merge pull request #72 from yonatankahana/chart-labels-and-annotations
Helm chart labels and annotations and add missing image pull secrets in documentation
2021-04-23 06:24:02 -07:00
Yonatan Kahana
1cafa67771 Merge branch 'master' of https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner into chart-labels-and-annotations 2021-04-22 14:44:40 +03:00
Kubernetes Prow Robot
48e51b160c Merge pull request #89 from yonatankahana/promoted-4.0.2
Update image location after v4.0.2 promoted from the temporary staging repository
2021-04-14 09:36:40 -07:00
Yonatan Kahana
9a5d466349 Update image location after v4.0.2 promoted from the temporary staging repository
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-04-14 15:01:34 +03:00
yonatankahana
466cf8be73 Update storageclass.yaml to include annotations even when defaultClass is false
Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
2021-04-13 18:04:36 +03:00
Yonatan Kahana
172cab36f1 Merge branch 'chart-labels-and-annotations' of github.com:yonatankahana/nfs-subdir-external-provisioner into chart-labels-and-annotations 2021-04-07 19:15:18 +03:00
Yonatan Kahana
a3f57e1527 Merge branch 'master' of github.com:kubernetes-sigs/nfs-subdir-external-provisioner into chart-labels-and-annotations 2021-04-07 19:15:01 +03:00
Kubernetes Prow Robot
eae7143d98 Merge pull request #83 from MiaoZhou/fixEmptyCustomPath
prevent mounting of root directory
2021-04-01 22:16:11 -07:00
Kubernetes Prow Robot
888d6dbd39 Merge pull request #82 from yonatankahana/v4.0.2-prep
Bump version to 4.0.2
2021-04-01 22:10:11 -07:00
zhoumiao
b8e203661b prevent mounting of root directory
If storageClass enable pathPattern like:

`pathPattern: "${.PVC.annotations.nfs.io/storage-path}"`

but pvc without annotation would make empty `customPath` and create a pv with nfs root path.
2021-03-31 21:23:20 +08:00
Yonatan Kahana
cadce2dbc9 Bump version to 4.0.2
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-30 11:04:36 +03:00
Kubernetes Prow Robot
fab8b5623e Merge pull request #79 from yonatankahana/v4.0.1-prep
Bump helm chart version to release v4.0.1
2021-03-27 05:04:43 -07:00
Yonatan Kahana
b668ec9f74 Update cloudbuild with multiarch platforms
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-26 12:51:34 +03:00
Yonatan Kahana
b5b2918215 Remove old cloudbuild symlink
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-26 12:44:46 +03:00
Yonatan Kahana
2bee3e0f77 Merge branch 'master' of github.com:kubernetes-sigs/nfs-subdir-external-provisioner into v4.0.1-prep 2021-03-26 12:41:00 +03:00
Yonatan Kahana
f86551598e Bump helm chart version to release v4.0.1
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-24 17:53:09 +02:00
Kubernetes Prow Robot
522d8f83d5 Merge pull request #76 from yonatankahana/v4.0.1-prep
Release v4.0.1
2021-03-23 18:54:05 -07:00
yonatankahana
012a016471 Update charts/nfs-subdir-external-provisioner/templates/_helpers.tpl
Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
2021-03-22 16:48:19 +02:00
Kubernetes Prow Robot
5364f1b4bf Merge pull request #68 from mustache1up/helm-ondelete-support
Helm storageClass.onDelete parameter support
2021-03-21 08:53:43 -07:00
mustache1up
7417303508 enhance onDelete description on values.yaml 2021-03-21 02:08:03 -03:00
Yonatan Kahana
c53f80160a Use selectorLabels in deployment pod template
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-17 19:03:49 +02:00
Yonatan Kahana
9affea2658 Bump helm chart to 4.0.1
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-17 18:59:02 +02:00
Yonatan Kahana
8c82a35627 Add changelog for 4.0.1
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-14 20:07:23 +02:00
Kubernetes Prow Robot
863e96984b Merge pull request #74 from yonatankahana/owners-yonatankahana
Add yonatankahana to OWNERS file
2021-03-12 10:34:22 -08:00
Yonatan Kahana
a5117cbedb Helm chart labels and annotations and add missing image pull secrets in documentation
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-12 00:34:45 +02:00
Yonatan Kahana
681319b3bd Merge branch 'master' of github.com:kubernetes-sigs/nfs-subdir-external-provisioner into chart-labels-and-annotations 2021-03-12 00:31:02 +02:00
Yonatan Kahana
74123487f2 Helm chart labels and annotations support
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-12 00:28:49 +02:00
Yonatan Kahana
e5d160f03e Add yonatankahana to OWNERS file
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-11 20:14:30 +02:00
mustache1up
8b8d398b53 Bump chart version 2021-03-10 17:55:58 -03:00
mustache1up
707f140b76 Merge branch 'master' of https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner into helm-ondelete-support 2021-03-10 17:52:58 -03:00
Kubernetes Prow Robot
da1c2a6e3e Merge pull request #69 from yonatankahana/helm-linter-fix
Fix the helm chart linter test failure
2021-03-09 20:17:14 -08:00
mustache1up
8e20383b4c Standardize chart param 'PVC's as uppercase and accepted values with code markdown 2021-03-09 18:22:44 -03:00
Yonatan Kahana
21815a26f4 Fix the helm chart linter test failure by disabling maintainers validation and remove trailing spaces
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-09 20:19:55 +02:00
mustache1up
b33cad598a adapt values.yaml for linter removing trailling spaces on empty params 2021-03-05 23:48:41 -03:00
mustache1up
c50d1aea01 document valid values for storageClass.onDelete chart param 2021-03-05 23:44:59 -03:00
mustache1up
5fda156007 Merge branch 'master' into helm-ondelete-support 2021-03-05 19:37:36 -03:00
Kubernetes Prow Robot
f08caa228c Merge pull request #66 from yonatankahana/helm-chart-lint
Setup chart linter as github action
2021-03-05 09:24:22 -08:00
Kubernetes Prow Robot
f491425b8b Merge pull request #61 from yonatankahana/helmchart4.0.3
Bump helm chart to 4.0.3
2021-03-05 09:22:22 -08:00
mustache1up
1e913d1ade Bump chart version 2021-03-05 01:50:46 -03:00
mustache1up
a57db9a5a7 Document storageClass.onDelete param for the helm chart 2021-03-05 01:50:45 -03:00
mustache1up
819f6d382d Add onDelete support to helm chart 2021-03-05 01:50:41 -03:00
Yonatan Kahana
221db2f021 Setup chart linter as github action
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-04 23:51:33 +02:00
John Call
0869cb9ec6 Fix README.md
The previous `oc adm policy add-role-to-user use-scc-hostmount-anyuid` command was incorrect.  Replacing it with the correct one
2021-03-04 12:26:13 -07:00
Yonatan Kahana
b7b4412004 Bump helm chart to 4.0.3
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-03-03 22:51:40 +02:00
Kubernetes Prow Robot
487b9092a6 Merge pull request #56 from ariksidney/helm-pathpattern-support
Helm pathpattern support
2021-03-03 09:29:20 -08:00
Kubernetes Prow Robot
a99f3dafb1 Merge pull request #59 from petermicuch/restore_delete_folder_name
Preserve name of the PV directory name during archiving
2021-03-03 07:55:20 -08:00
ariksidney
571aadd47e Clarify usage of pathPattern parameter 2021-02-27 11:17:33 +01:00
Peter Micuch
9b9ac9aa8d Preserve name of the PV directory name during archiving 2021-02-25 10:10:50 +01:00
Kubernetes Prow Robot
6b7372c8cd Merge pull request #58 from yonatankahana/arm
Add arm7 to multiarch build
2021-02-22 20:44:03 -08:00
Yonatan Kahana
5f8f90d71a Add arm7 to multiarch build
Signed-off-by: Yonatan Kahana <yonatankahana.il@gmail.com>
2021-02-21 20:41:25 +02:00
Kubernetes Prow Robot
f4f3c572b2 Merge pull request #54 from rombert/origin/chart-leader-election-fix
helm chart: fix leader election flag
2021-02-17 10:59:06 -08:00
ariksidney
8da26f952b Update README to describe new pathPattern parameter 2021-02-17 13:15:45 +01:00
ariksidney
f716044142 Add pathPattern support to Helmchart 2021-02-17 13:14:59 +01:00
Robert Munteanu
54ea552d39 helm chart: fix leader election flag
env var values need to be string, not boolean.
2021-02-16 22:16:57 +01:00
Kubernetes Prow Robot
0a66252619 Merge pull request #52 from rombert/origin/chart-leader-election
Update chart to surface leader election flag
2021-02-16 12:11:09 -08:00
Robert Munteanu
11566f6795 Bump chart version 2021-02-16 11:03:59 +01:00
Robert Munteanu
8903a7c073 Document leaderElection.enabled flag for the helm chart 2021-02-16 10:21:09 +01:00
Robert Munteanu
099ddce5cc Update chart to surface leader election flag 2021-02-15 20:40:57 +01:00
25 changed files with 211 additions and 89 deletions

View File

@@ -1 +0,0 @@
./release-tools/cloudbuild.sh

21
.cloudbuild.sh Executable file
View File

@@ -0,0 +1,21 @@
#! /bin/bash
# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
: ${CSI_PROW_BUILD_PLATFORMS:="linux amd64; linux arm -arm; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x"}
# shellcheck disable=SC1091
. release-tools/cloudbuild.sh

18
.github/workflows/helm-chart-lint.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Lint Helm Charts
on: pull_request
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1
- name: Run chart-testing (lint)
run: ct lint --validate-maintainers=false

View File

@@ -1,3 +1,9 @@
# v4.0.2
- Add arm7 (32bit) support (https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/pull/58)
# v4.0.1
- Preserve name of the PV directory name during archiving (https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner/pull/59)
# v4.0.0
- Remove redundant field in the rbac.yaml (https://github.com/kubernetes-retired/external-storage/pull/970)
- Use `kubernetes-sigs/sig-storage-lib-external-provisioner` instead of `incubator/external-storage/lib` (https://github.com/kubernetes-retired/external-storage/pull/1026)

View File

@@ -17,4 +17,4 @@ all: build
include release-tools/build.make
BUILD_PLATFORMS=linux amd64; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x
BUILD_PLATFORMS=linux amd64; linux arm -arm; linux arm64 -arm64; linux ppc64le -ppc64le; linux s390x -s390x

1
OWNERS
View File

@@ -6,3 +6,4 @@ approvers:
- kmova
- jackielii
- ashishranjan738
- yonatankahana

View File

@@ -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 `k8s.gcr.io/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.
@@ -58,10 +58,9 @@ On OpenShift the service account used to bind volumes does not have the necessar
```sh
# Set the subject of the RBAC objects to the current namespace where the provisioner is being deployed
$ NAMESPACE=`oc project -q`
$ sed -i'' "s/namespace:.*/namespace: $NAMESPACE/g" ./deploy/rbac.yaml
$ sed -i'' "s/namespace:.*/namespace: $NAMESPACE/g" ./deploy/rbac.yaml ./deploy/deployment.yaml
$ oc create -f deploy/rbac.yaml
$ oc create role use-scc-hostmount-anyuid --verb=use --resource=scc --resource-name=hostmount-anyuid -n $NAMESPACE
$ oc adm policy add-role-to-user use-scc-hostmount-anyuid system:serviceaccount:$NAMESPACE:nfs-client-provisioner
$ oc adm policy add-scc-to-user hostmount-anyuid system:serviceaccount:$NAMESPACE:nfs-client-provisioner
```
**Step 4: Configure the NFS subdir external provisioner**
@@ -90,7 +89,7 @@ spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0
image: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes
@@ -120,7 +119,7 @@ To disable leader election, define an env variable named ENABLE_LEADER_ELECTION
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------: |
| onDelete | If it exists and has a delete value, delete the directory, if it exists and has a retain value, save the directory. | will be archived with name on the share: `archived-<volume.Name>` |
| archiveOnDelete | If it exists and has a false value, delete the directory. if `onDelete` exists, `archiveOnDelete` will be ignored. | will be archived with name on the share: `archived-<volume.Name>` |
| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.}`: `${PVC.namespace}` | n/a |
| pathPattern | Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace. To specify metadata use `${.PVC.<metadata>}`. Example: If folder should be named like `<pvc-namespace>-<pvc-name>`, use `${.PVC.namespace}-${.PVC.name}` as pathPattern. | n/a |
This is `deploy/class.yaml` which defines the NFS subdir external provisioner's Kubernetes Storage Class:
@@ -207,4 +206,7 @@ The pipeline adds several labels:
* You also need to provide the `DOCKER_IMAGE` secret specifying your Docker image name, e.g., `quay.io/[username]/nfs-subdir-external-provisioner`.
## NFS provisioner limitations/pitfalls
* The provisioned storage is not guaranteed. You may allocate more than the NFS share's total size. The share may also not have enough storage space left to actually accommodate the request.
* The provisioned storage limit is not enforced. The application can expand to use all the available storage regardless of the provisioned size.
* Storage resize/expansion operations are not presently supported in any form. You will end up in an error state: `Ignoring the PVC: didn't find a plugin capable of expanding the volume; waiting for an external controller to process this PVC.`

View File

@@ -1,9 +1,9 @@
apiVersion: v1
appVersion: 4.0.0
appVersion: 4.0.2
description: nfs-subdir-external-provisioner is an automatic provisioner that used your *already configured* NFS server, automatically creating Persistent Volumes.
name: nfs-subdir-external-provisioner
home: https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner
version: 4.0.0
version: 4.0.13
kubeVersion: ">=1.9.0-0"
sources:
- https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner

View File

@@ -48,29 +48,38 @@ The command removes all the Kubernetes components associated with the chart and
The following tables lists the configurable parameters of this chart and their default values.
| Parameter | Description | Default |
| ----------------------------------- | ----------------------------------------------------------- | ------------------------------------------------- |
| `replicaCount` | Number of provisioner instances to deployed | `1` |
| `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` |
| `image.repository` | Provisioner image | `gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner` |
| `image.tag` | Version of provisioner image | `v4.0.0` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `storageClass.name` | Name of the storageClass | `nfs-client` |
| `storageClass.defaultClass` | Set as the default StorageClass | `false` |
| `storageClass.allowVolumeExpansion` | Allow expanding the volume | `true` |
| `storageClass.reclaimPolicy` | Method used to reclaim an obsoleted volume | `Delete` |
| `storageClass.provisionerName` | Name of the provisionerName | null |
| `storageClass.archiveOnDelete` | Archive pvc when deleting | `true` |
| `storageClass.accessModes` | Set access mode for PV | `ReadWriteOnce` |
| `nfs.server` | Hostname of the NFS server (required) | null (ip or hostname) |
| `nfs.path` | Basepath of the mount point to be used | `/nfs-storage` |
| `nfs.mountOptions` | Mount options (e.g. 'nfsvers=3') | null |
| `resources` | Resources required (e.g. CPU, memory) | `{}` |
| `rbac.create` | Use Role-based Access Control | `true` |
| `podSecurityPolicy.enabled` | Create & use Pod Security Policy resources | `false` |
| `priorityClassName` | Set pod priorityClassName | null |
| `serviceAccount.create` | Should we create a ServiceAccount | `true` |
| `serviceAccount.name` | Name of the ServiceAccount to use | null |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `affinity` | Affinity settings | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| Parameter | Description | Default |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `replicaCount` | Number of provisioner instances to deployed | `1` |
| `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` |
| `image.repository` | Provisioner image | `k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner` |
| `image.tag` | Version of provisioner image | `v4.0.2` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `imagePullSecrets` | Image pull secrets | `[]` |
| `storageClass.name` | Name of the storageClass | `nfs-client` |
| `storageClass.defaultClass` | Set as the default StorageClass | `false` |
| `storageClass.allowVolumeExpansion` | Allow expanding the volume | `true` |
| `storageClass.reclaimPolicy` | Method used to reclaim an obsoleted volume | `Delete` |
| `storageClass.provisionerName` | Name of the provisionerName | null |
| `storageClass.archiveOnDelete` | Archive PVC when deleting | `true` |
| `storageClass.onDelete` | Strategy on PVC deletion. Overrides archiveOnDelete when set to lowercase values 'delete' or 'retain' | null |
| `storageClass.pathPattern` | Specifies a template for the directory name | null |
| `storageClass.accessModes` | Set access mode for PV | `ReadWriteOnce` |
| `storageClass.annotations` | Set additional annotations for the StorageClass | `{}` |
| `leaderElection.enabled` | Enables or disables leader election | `true` |
| `nfs.server` | Hostname of the NFS server (required) | null (ip or hostname) |
| `nfs.path` | Basepath of the mount point to be used | `/nfs-storage` |
| `nfs.mountOptions` | Mount options (e.g. 'nfsvers=3') | null |
| `nfs.volumeName` | Volume name used inside the pods | `nfs-subdir-external-provisioner-root` |
| `resources` | Resources required (e.g. CPU, memory) | `{}` |
| `rbac.create` | Use Role-based Access Control | `true` |
| `podSecurityPolicy.enabled` | Create & use Pod Security Policy resources | `false` |
| `podAnnotations` | Additional annotations for the Pods | `{}` |
| `priorityClassName` | Set pod priorityClassName | null |
| `serviceAccount.create` | Should we create a ServiceAccount | `true` |
| `serviceAccount.name` | Name of the ServiceAccount to use | null |
| `serviceAccount.annotations` | Additional annotations for the ServiceAccount | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `affinity` | Affinity settings | `{}` |
| `tolerations` | List of node taints to tolerate | `[]` |
| `labels` | Additional labels for any resource created | `{}` |

View File

@@ -59,4 +59,34 @@ Return the appropriate apiVersion for podSecurityPolicy.
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "nfs-subdir-external-provisioner.labels" -}}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
{{ include "nfs-subdir-external-provisioner.selectorLabels" . }}
{{- with .Values.labels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}
{{/*
Pod template labels
*/}}
{{- define "nfs-subdir-external-provisioner.podLabels" -}}
{{ include "nfs-subdir-external-provisioner.selectorLabels" . }}
{{- with .Values.labels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "nfs-subdir-external-provisioner.selectorLabels" -}}
app: {{ template "nfs-subdir-external-provisioner.name" . }}
release: {{ .Release.Name }}
{{- end }}

View File

@@ -3,12 +3,12 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
name: {{ template "nfs-subdir-external-provisioner.fullname" . }}-runner
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]

View File

@@ -3,10 +3,7 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
name: run-{{ template "nfs-subdir-external-provisioner.fullname" . }}
subjects:
- kind: ServiceAccount

View File

@@ -3,27 +3,25 @@ kind: Deployment
metadata:
name: {{ template "nfs-subdir-external-provisioner.fullname" . }}
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
strategy:
type: {{ .Values.strategyType }}
selector:
matchLabels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and (.Values.tolerations) (semverCompare "<1.6-0" .Capabilities.KubeVersion.GitVersion) }}
scheduler.alpha.kubernetes.io/tolerations: '{{ toJson .Values.tolerations }}'
{{- end }}
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.podLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ template "nfs-subdir-external-provisioner.serviceAccountName" . }}
{{- if .Values.nodeSelector }}
@@ -37,16 +35,16 @@ spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.imagePullSecrets }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: nfs-subdir-external-provisioner-root
- name: {{ .Values.nfs.volumeName }}
mountPath: /persistentvolumes
env:
- name: PROVISIONER_NAME
@@ -55,12 +53,16 @@ spec:
value: {{ .Values.nfs.server }}
- name: NFS_PATH
value: {{ .Values.nfs.path }}
{{- if eq .Values.leaderElection.enabled false }}
- name: ENABLE_LEADER_ELECTION
value: "false"
{{- end }}
{{- with .Values.resources }}
resources:
{{ toYaml . | indent 12 }}
{{- end }}
volumes:
- name: nfs-subdir-external-provisioner-root
- name: {{ .Values.nfs.volumeName }}
{{- if .Values.buildMode }}
emptyDir: {}
{{- else if .Values.nfs.mountOptions }}

View File

@@ -4,6 +4,7 @@ kind: PersistentVolume
metadata:
name: pv-{{ template "nfs-subdir-external-provisioner.fullname" . }}
labels:
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
nfs-subdir-external-provisioner: {{ template "nfs-subdir-external-provisioner.fullname" . }}
spec:
capacity:

View File

@@ -3,6 +3,8 @@ kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc-{{ template "nfs-subdir-external-provisioner.fullname" . }}
labels:
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
spec:
accessModes:
- {{ .Values.storageClass.accessModes }}

View File

@@ -4,10 +4,7 @@ kind: PodSecurityPolicy
metadata:
name: {{ template "nfs-subdir-external-provisioner.fullname" . }}
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
spec:
privileged: false
allowPrivilegeEscalation: false
@@ -16,6 +13,7 @@ spec:
volumes:
- 'secret'
- 'nfs'
- 'persistentVolumeClaim'
hostNetwork: false
hostIPC: false
hostPID: false

View File

@@ -3,10 +3,7 @@ kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
name: leader-locking-{{ template "nfs-subdir-external-provisioner.fullname" . }}
rules:
- apiGroups: [""]

View File

@@ -3,10 +3,7 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
name: leader-locking-{{ template "nfs-subdir-external-provisioner.fullname" . }}
subjects:
- kind: ServiceAccount

View File

@@ -3,9 +3,10 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "nfs-subdir-external-provisioner.serviceAccountName" . }}
{{- end -}}

View File

@@ -3,20 +3,26 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
labels:
app: {{ template "nfs-subdir-external-provisioner.name" . }}
chart: {{ template "nfs-subdir-external-provisioner.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }}
name: {{ .Values.storageClass.name }}
{{- if .Values.storageClass.defaultClass }}
annotations:
{{- if .Values.storageClass.defaultClass }}
storageclass.kubernetes.io/is-default-class: "true"
{{- end }}
{{- end }}
{{- with .Values.storageClass.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
provisioner: {{ template "nfs-subdir-external-provisioner.provisionerName" . }}
allowVolumeExpansion: {{ .Values.storageClass.allowVolumeExpansion }}
reclaimPolicy: {{ .Values.storageClass.reclaimPolicy }}
parameters:
archiveOnDelete: "{{ .Values.storageClass.archiveOnDelete }}"
{{- if .Values.storageClass.pathPattern }}
pathPattern: "{{ .Values.storageClass.pathPattern }}"
{{- end }}
{{- if .Values.storageClass.onDelete }}
onDelete: "{{ .Values.storageClass.onDelete }}"
{{- end }}
{{- if .Values.nfs.mountOptions }}
mountOptions:
{{- range .Values.nfs.mountOptions }}

View File

@@ -2,14 +2,16 @@ replicaCount: 1
strategyType: Recreate
image:
repository: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner
tag: v4.0.0
repository: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner
tag: v4.0.2
pullPolicy: IfNotPresent
imagePullSecrets: []
nfs:
server:
path: /nfs-storage
mountOptions:
volumeName: nfs-subdir-external-provisioner-root
# For creating the StorageClass automatically:
storageClass:
@@ -35,9 +37,25 @@ storageClass:
# When set to false your PVs will not be archived by the provisioner upon deletion of the PVC.
archiveOnDelete: true
# If it exists and has 'delete' value, delete the directory. If it exists and has 'retain' value, save the directory.
# Overrides archiveOnDelete.
# Ignored if value not set.
onDelete:
# Specifies a template for creating a directory path via PVC metadata's such as labels, annotations, name or namespace.
# Ignored if value not set.
pathPattern:
# Set access mode - ReadWriteOnce, ReadOnlyMany or ReadWriteMany
accessModes: ReadWriteOnce
# Storage class annotations
annotations: {}
leaderElection:
# When set to false leader election will be disabled
enabled: true
## For RBAC support:
rbac:
# Specifies whether RBAC resources should be created
@@ -48,6 +66,9 @@ rbac:
podSecurityPolicy:
enabled: false
# Deployment pod annotations
podAnnotations: {}
## Set pod priorityClassName
# priorityClassName: ""
@@ -55,6 +76,9 @@ serviceAccount:
# Specifies whether a ServiceAccount should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the ServiceAccount to use.
# If not set and create is true, a name is generated using the fullname template
name:
@@ -72,3 +96,6 @@ nodeSelector: {}
tolerations: []
affinity: {}
# Additional labels for any resource created
labels: {}

View File

@@ -104,8 +104,10 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
pathPattern, exists := options.StorageClass.Parameters["pathPattern"]
if exists {
customPath := metadata.stringParser(pathPattern)
path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
if customPath != "" {
path = filepath.Join(p.path, customPath)
fullPath = filepath.Join(mountPath, customPath)
}
}
glog.V(4).Infof("creating path %s", fullPath)
@@ -139,8 +141,8 @@ func (p *nfsProvisioner) Provision(ctx context.Context, options controller.Provi
func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume) error {
path := volume.Spec.PersistentVolumeSource.NFS.Path
relativePath := strings.Replace(path, p.path, "", 1)
oldPath := filepath.Join(mountPath, relativePath)
basePath := filepath.Base(path)
oldPath := filepath.Join(mountPath, basePath)
if _, err := os.Stat(oldPath); os.IsNotExist(err) {
glog.Warningf("path %s does not exist, deletion skipped", oldPath)
@@ -179,7 +181,7 @@ func (p *nfsProvisioner) Delete(ctx context.Context, volume *v1.PersistentVolume
}
}
archivePath := filepath.Join(mountPath, "archived-"+volume.Name)
archivePath := filepath.Join(mountPath, "archived-"+basePath)
glog.V(4).Infof("archiving path %s to %s", oldPath, archivePath)
return os.Rename(oldPath, archivePath)
}

View File

@@ -21,7 +21,7 @@ spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0
image: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes

View File

@@ -3,6 +3,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]

View File

@@ -14,7 +14,7 @@ spec:
serviceAccountName: nfs-client-provisioner
containers:
- name: nfs-client-provisioner
image: gcr.io/k8s-staging-sig-storage/nfs-subdir-external-provisioner:v4.0.0
image: k8s.gcr.io/sig-storage/nfs-subdir-external-provisioner:v4.0.2
volumeMounts:
- name: nfs-client-root
mountPath: /persistentvolumes

View File

@@ -10,6 +10,9 @@ apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]