From 8af604bdc7e8076b8482b1652b7c139abb1659a9 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 17 Feb 2023 10:49:37 +0000 Subject: [PATCH 1/8] add a simple PDB if the replicaCount > 1 --- charts/nfs-subdir-external-provisioner/Chart.yaml | 2 +- .../templates/poddisruptionbudget.yaml | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml diff --git a/charts/nfs-subdir-external-provisioner/Chart.yaml b/charts/nfs-subdir-external-provisioner/Chart.yaml index 886674ac..2c26611c 100644 --- a/charts/nfs-subdir-external-provisioner/Chart.yaml +++ b/charts/nfs-subdir-external-provisioner/Chart.yaml @@ -3,7 +3,7 @@ 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.17 +version: 4.0.18 kubeVersion: ">=1.9.0-0" sources: - https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner diff --git a/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml new file mode 100644 index 00000000..dae204f1 --- /dev/null +++ b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml @@ -0,0 +1,14 @@ +{{ if gt .Values.replicaCount 1.0}} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + labels: + {{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }} + name: {{ template "nfs-subdir-external-provisioner.fullname" . }} + namespace: {{ .Release.Namespace }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "nfs-subdir-external-provisioner.selectorLabels" . | nindent 6 }} +{{ end }} From cc084df759a98dca7dfb4da01d4a8599a96a041b Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 20 Feb 2023 10:15:54 +0000 Subject: [PATCH 2/8] integrate suggestions for PDB enhancements --- .../templates/_helpers.tpl | 11 +++++++++++ .../templates/poddisruptionbudget.yaml | 9 ++++----- charts/nfs-subdir-external-provisioner/values.yaml | 4 ++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl index c6c4f79f..5c76a13a 100644 --- a/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl +++ b/charts/nfs-subdir-external-provisioner/templates/_helpers.tpl @@ -61,6 +61,17 @@ Return the appropriate apiVersion for podSecurityPolicy. {{- end -}} {{- end -}} +{{/* +Return the appropriate apiVersion for podDisruptionBudget. +*/}} +{{- define "podDisruptionBudget.apiVersion" -}} +{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}} +{{- print "policy/v1" -}} +{{- else -}} +{{- print "policy/v1beta1" -}} +{{- end -}} +{{- end -}} + {{/* Common labels */}} diff --git a/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml index dae204f1..a6d2a885 100644 --- a/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml @@ -1,14 +1,13 @@ -{{ if gt .Values.replicaCount 1.0}} -apiVersion: policy/v1 +{{- if .Values.podDisruptionBudget.enabled }} +apiVersion: {{ template "podDisruptionBudget.apiVersion" . }} kind: PodDisruptionBudget metadata: labels: {{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }} name: {{ template "nfs-subdir-external-provisioner.fullname" . }} - namespace: {{ .Release.Namespace }} spec: - maxUnavailable: 1 + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }} selector: matchLabels: {{- include "nfs-subdir-external-provisioner.selectorLabels" . | nindent 6 }} -{{ end }} +{{- end }} diff --git a/charts/nfs-subdir-external-provisioner/values.yaml b/charts/nfs-subdir-external-provisioner/values.yaml index f6260238..d21d0d1d 100644 --- a/charts/nfs-subdir-external-provisioner/values.yaml +++ b/charts/nfs-subdir-external-provisioner/values.yaml @@ -108,3 +108,7 @@ affinity: {} # Additional labels for any resource created labels: {} + +podDisruptionBudget: + enabled: false + maxUnavailable: 1 \ No newline at end of file From 35d0a6b7c6f293a308e313a6d461e419839ac5b3 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 20 Feb 2023 10:18:06 +0000 Subject: [PATCH 3/8] line endings --- charts/nfs-subdir-external-provisioner/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nfs-subdir-external-provisioner/values.yaml b/charts/nfs-subdir-external-provisioner/values.yaml index d21d0d1d..6b13c7f3 100644 --- a/charts/nfs-subdir-external-provisioner/values.yaml +++ b/charts/nfs-subdir-external-provisioner/values.yaml @@ -111,4 +111,4 @@ labels: {} podDisruptionBudget: enabled: false - maxUnavailable: 1 \ No newline at end of file + maxUnavailable: 1 From 6fd66db3547ff221807aad4a8748b45805738869 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 27 Feb 2023 10:36:35 +0000 Subject: [PATCH 4/8] update Chart README with PDB values --- charts/nfs-subdir-external-provisioner/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index 9e58ffb7..a860c5e3 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -85,6 +85,8 @@ The following tables lists the configurable parameters of this chart and their d | `affinity` | Affinity settings | `{}` | | `tolerations` | List of node taints to tolerate | `[]` | | `labels` | Additional labels for any resource created | `{}` | +| `podDisruptionBudget.enabled` | Create & use Pod Disruption Budget | `false` | +| `podDisruptionBudget.maxUnavailable`| Set maximum unavailable pods in the Pod Disruption Budget | `1` | ## Install Multiple Provisioners From ff5803a052952697a87fc44b9a42a2fc9284ef39 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 7 Mar 2023 07:17:14 -0500 Subject: [PATCH 5/8] rebase and reformat chart Readme --- .../nfs-subdir-external-provisioner/README.md | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index a860c5e3..7d103a1b 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -48,45 +48,45 @@ 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 | `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.volumeBindingMode` | Set volume binding mode for Storage Class | `Immediate` | -| `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` | -| `nfs.reclaimPolicy` | Reclaim policy for the main nfs volume used for subdir provisioning | `Retain` | -| `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 | `{}` | -| `podDisruptionBudget.enabled` | Create & use Pod Disruption Budget | `false` | -| `podDisruptionBudget.maxUnavailable`| Set maximum unavailable pods in the Pod Disruption Budget | `1` | +| 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 | `registry.k8s.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.volumeBindingMode` | Set volume binding mode for Storage Class | `Immediate` | +| `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` | +| `nfs.reclaimPolicy` | Reclaim policy for the main nfs volume used for subdir provisioning | `Retain` | +| `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 | `{}` | +| `podDisruptionBudget.enabled` | Create and use Pod Disruption Budget | `false` | +| `podDisruptionBudget.maxUnavailable` | Set maximum unavailable pods in the Pod Disruption Budget | `1` | ## Install Multiple Provisioners @@ -99,3 +99,9 @@ helm install second-nfs-subdir-external-provisioner nfs-subdir-external-provisio --set storageClass.name=second-nfs-client \ --set storageClass.provisionerName=k8s-sigs.io/second-nfs-subdir-external-provisioner ``` + + + + + + From 9f37ddea3417e17c02b52d6f90a9a31e4340ccf6 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 7 Mar 2023 07:18:30 -0500 Subject: [PATCH 6/8] realign title of table in chart Readme --- charts/nfs-subdir-external-provisioner/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index 7d103a1b..7a1d20db 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -48,7 +48,7 @@ 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 | +| Parameter | Description | Default | | ------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | | `replicaCount` | Number of provisioner instances to deployed | `1` | | `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` | From 915f227a52ecd1a7321983cf7f097b3b2cfc46f4 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 13 Mar 2023 18:55:33 +0000 Subject: [PATCH 7/8] fix syntax issues --- charts/nfs-subdir-external-provisioner/README.md | 1 - .../templates/poddisruptionbudget.yaml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index 7a1d20db..2f8e9d1b 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -104,4 +104,3 @@ helm install second-nfs-subdir-external-provisioner nfs-subdir-external-provisio - diff --git a/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml index a6d2a885..b3f9d403 100644 --- a/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml +++ b/charts/nfs-subdir-external-provisioner/templates/poddisruptionbudget.yaml @@ -6,7 +6,7 @@ metadata: {{- include "nfs-subdir-external-provisioner.labels" . | nindent 4 }} name: {{ template "nfs-subdir-external-provisioner.fullname" . }} spec: - maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }} selector: matchLabels: {{- include "nfs-subdir-external-provisioner.selectorLabels" . | nindent 6 }} From 63586f94128d11445161127cb0768dcc98ec5eb7 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 13 Mar 2023 18:56:33 +0000 Subject: [PATCH 8/8] remove all the extraneous newlines --- charts/nfs-subdir-external-provisioner/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/charts/nfs-subdir-external-provisioner/README.md b/charts/nfs-subdir-external-provisioner/README.md index 2f8e9d1b..eb4e41e5 100644 --- a/charts/nfs-subdir-external-provisioner/README.md +++ b/charts/nfs-subdir-external-provisioner/README.md @@ -99,8 +99,3 @@ helm install second-nfs-subdir-external-provisioner nfs-subdir-external-provisio --set storageClass.name=second-nfs-client \ --set storageClass.provisionerName=k8s-sigs.io/second-nfs-subdir-external-provisioner ``` - - - - -