From 7853fb430ca816604956c270ea9dcfc07a6c99c1 Mon Sep 17 00:00:00 2001 From: Joseph Ang Date: Fri, 25 Oct 2024 02:42:30 +0800 Subject: [PATCH 1/3] Add PriorityClassName and Affinity Signed-off-by: Joseph Ang --- charts/pvc-autoresizer/README.md | 2 ++ .../templates/controller/deployment.yaml | 7 +++++ charts/pvc-autoresizer/values.yaml | 27 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/charts/pvc-autoresizer/README.md b/charts/pvc-autoresizer/README.md index 72878e2..bb61ad8 100644 --- a/charts/pvc-autoresizer/README.md +++ b/charts/pvc-autoresizer/README.md @@ -32,6 +32,7 @@ helm upgrade --create-namespace --namespace pvc-autoresizer -i pvc-autoresizer - | Key | Type | Default | Description | |-----|------|---------|-------------| | cert-manager.enabled | bool | `false` | Install cert-manager together. # ref: https://cert-manager.io/docs/installation/helm/#installing-with-helm | +| controller.affinity | object | `{}` | Affinity for controller deployment. | | controller.annotations | object | `{}` | Annotations to be added to controller deployment. | | controller.args.additionalArgs | list | `[]` | Specify additional args. | | controller.args.interval | string | `"10s"` | Specify interval to monitor pvc capacity. Used as "--interval" option | @@ -39,6 +40,7 @@ helm upgrade --create-namespace --namespace pvc-autoresizer -i pvc-autoresizer - | controller.args.prometheusURL | string | `"http://prometheus-prometheus-oper-prometheus.prometheus.svc:9090"` | Specify Prometheus URL to query volume stats. Used as "--prometheus-url" option | | controller.args.useK8sMetricsApi | bool | `false` | Use Kubernetes metrics API instead of Prometheus. Used as "--use-k8s-metrics-api" option | | controller.nodeSelector | object | `{}` | Map of key-value pairs for scheduling pods on specific nodes. | +| controller.priorityClassName | string | `""` | Priority class name to be applied to the controller pods. | | controller.podAnnotations | object | `{}` | Annotations to be added to controller pods. | | controller.podLabels | object | `{}` | Pod labels to be added to controller pods. | | controller.podSecurityContext | object | `{}` | Security Context to be applied to the controller pods. | diff --git a/charts/pvc-autoresizer/templates/controller/deployment.yaml b/charts/pvc-autoresizer/templates/controller/deployment.yaml index a875e68..a43fde1 100644 --- a/charts/pvc-autoresizer/templates/controller/deployment.yaml +++ b/charts/pvc-autoresizer/templates/controller/deployment.yaml @@ -98,3 +98,10 @@ spec: {{- end }} securityContext: {{- toYaml .Values.controller.podSecurityContext | nindent 8 }} + {{- with .Values.controller.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- if .Values.controller.priorityClassName }} + priorityClassName: {{ .Values.controller.priorityClassName }} + {{- end }} diff --git a/charts/pvc-autoresizer/values.yaml b/charts/pvc-autoresizer/values.yaml index fd74873..d6a9f6e 100644 --- a/charts/pvc-autoresizer/values.yaml +++ b/charts/pvc-autoresizer/values.yaml @@ -72,6 +72,33 @@ controller: # controller.nodeSelector -- Map of key-value pairs for scheduling pods on specific nodes. nodeSelector: {} + # controller.affinity -- Affinity for controller deployment. + affinity: {} + # podAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # - labelSelector: + # matchExpressions: + # - key: app.kubernetes.io/name: pvc-autoresizer + # operator: In + # values: + # - pvc-autoresizer + # topologyKey: topology.kubernetes.io/zone + # podAntiAffinity: + # preferredDuringSchedulingIgnoredDuringExecution: + # - weight: 100 + # podAffinityTerm: + # labelSelector: + # matchExpressions: + # - key: app.kubernetes.io/name: pvc-autoresizer + # operator: In + # values: + # - pvc-autoresizer + # topologyKey: topology.kubernetes.io/zone + + # controller.priorityClassName -- riority class name to be applied to the controller pods. + priorityClassName: "" + # priorityClassName: system-cluster-critical + # -- deploy a PodMonitor. This is not tested in CI so make sure to test it yourself. podMonitor: # podMonitor.enabled -- If true, creates a Prometheus Operator PodMonitor. From 25c340d9eeb3a8662ce30f11d5ff244066fcaf41 Mon Sep 17 00:00:00 2001 From: Joseph Ang Date: Mon, 28 Oct 2024 18:29:36 +0800 Subject: [PATCH 2/3] Update example values indentation and priorityClassName clause Signed-off-by: Joseph Ang --- .../templates/controller/deployment.yaml | 4 +-- charts/pvc-autoresizer/values.yaml | 32 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/charts/pvc-autoresizer/templates/controller/deployment.yaml b/charts/pvc-autoresizer/templates/controller/deployment.yaml index a43fde1..1c58be5 100644 --- a/charts/pvc-autoresizer/templates/controller/deployment.yaml +++ b/charts/pvc-autoresizer/templates/controller/deployment.yaml @@ -102,6 +102,6 @@ spec: affinity: {{- toYaml . | nindent 8 }} {{- end }} - {{- if .Values.controller.priorityClassName }} - priorityClassName: {{ .Values.controller.priorityClassName }} + {{- with .Values.controller.priorityClassName }} + priorityClassName: {{ . }} {{- end }} diff --git a/charts/pvc-autoresizer/values.yaml b/charts/pvc-autoresizer/values.yaml index d6a9f6e..94a1c5e 100644 --- a/charts/pvc-autoresizer/values.yaml +++ b/charts/pvc-autoresizer/values.yaml @@ -75,27 +75,27 @@ controller: # controller.affinity -- Affinity for controller deployment. affinity: {} # podAffinity: - # requiredDuringSchedulingIgnoredDuringExecution: - # - labelSelector: + # requiredDuringSchedulingIgnoredDuringExecution: + # - labelSelector: + # matchExpressions: + # - key: app.kubernetes.io/name + # operator: In + # values: + # - pvc-autoresizer + # topologyKey: topology.kubernetes.io/zone + # podAntiAffinity: + # preferredDuringSchedulingIgnoredDuringExecution: + # - weight: 100 + # podAffinityTerm: + # labelSelector: # matchExpressions: - # - key: app.kubernetes.io/name: pvc-autoresizer + # - key: app.kubernetes.io/name # operator: In # values: # - pvc-autoresizer # topologyKey: topology.kubernetes.io/zone - # podAntiAffinity: - # preferredDuringSchedulingIgnoredDuringExecution: - # - weight: 100 - # podAffinityTerm: - # labelSelector: - # matchExpressions: - # - key: app.kubernetes.io/name: pvc-autoresizer - # operator: In - # values: - # - pvc-autoresizer - # topologyKey: topology.kubernetes.io/zone - - # controller.priorityClassName -- riority class name to be applied to the controller pods. + + # controller.priorityClassName -- priority class name to be applied to the controller pods. priorityClassName: "" # priorityClassName: system-cluster-critical From 3763af26d8c93362552b6f35c53ef013ea9976a8 Mon Sep 17 00:00:00 2001 From: Joseph Ang Date: Wed, 30 Oct 2024 00:35:24 +0800 Subject: [PATCH 3/3] Generate Helm Docs Signed-off-by: Joseph Ang --- charts/pvc-autoresizer/README.md | 2 +- charts/pvc-autoresizer/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/pvc-autoresizer/README.md b/charts/pvc-autoresizer/README.md index bb61ad8..4387682 100644 --- a/charts/pvc-autoresizer/README.md +++ b/charts/pvc-autoresizer/README.md @@ -40,10 +40,10 @@ helm upgrade --create-namespace --namespace pvc-autoresizer -i pvc-autoresizer - | controller.args.prometheusURL | string | `"http://prometheus-prometheus-oper-prometheus.prometheus.svc:9090"` | Specify Prometheus URL to query volume stats. Used as "--prometheus-url" option | | controller.args.useK8sMetricsApi | bool | `false` | Use Kubernetes metrics API instead of Prometheus. Used as "--use-k8s-metrics-api" option | | controller.nodeSelector | object | `{}` | Map of key-value pairs for scheduling pods on specific nodes. | -| controller.priorityClassName | string | `""` | Priority class name to be applied to the controller pods. | | controller.podAnnotations | object | `{}` | Annotations to be added to controller pods. | | controller.podLabels | object | `{}` | Pod labels to be added to controller pods. | | controller.podSecurityContext | object | `{}` | Security Context to be applied to the controller pods. | +| controller.priorityClassName | string | `""` | Priority class name to be applied to the controller pods. | | controller.replicas | int | `1` | Specify the number of replicas of the controller Pod. | | controller.resources | object | `{"requests":{"cpu":"100m","memory":"20Mi"}}` | Specify resources. | | controller.securityContext | object | `{}` | Security Context to be applied to the controller container within controller pods. | diff --git a/charts/pvc-autoresizer/values.yaml b/charts/pvc-autoresizer/values.yaml index 94a1c5e..265b556 100644 --- a/charts/pvc-autoresizer/values.yaml +++ b/charts/pvc-autoresizer/values.yaml @@ -95,7 +95,7 @@ controller: # - pvc-autoresizer # topologyKey: topology.kubernetes.io/zone - # controller.priorityClassName -- priority class name to be applied to the controller pods. + # controller.priorityClassName -- Priority class name to be applied to the controller pods. priorityClassName: "" # priorityClassName: system-cluster-critical