From 2dd99e8b13d6fb9aecfe2fc6ba0a03d6138c25ce Mon Sep 17 00:00:00 2001 From: Markus Pesch Date: Tue, 26 Nov 2024 19:48:20 +0100 Subject: [PATCH] fix(deployment): restartPolicy --- README.md | 1 + templates/prometheus-postgres-exporter/deployment.yaml | 2 ++ unittests/deployment/deployment.yaml | 10 ++++++++++ values.yaml | 3 +++ 4 files changed, 16 insertions(+) diff --git a/README.md b/README.md index ee1b4d6..2cfe566 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ replaced: | `deployment.nodeSelector` | NodeSelector of the postgres-exporter deployment. | `{}` | | `deployment.priorityClassName` | PriorityClassName of the postgres-exporter deployment. | `""` | | `deployment.replicaCount` | Number of replicas for the postgres-exporter deployment. | `1` | +| `deployment.restartPolicy` | Restart policy of the postgres-exporter deployment. | `""` | | `deployment.securityContext` | Security context of the postgres-exporter deployment. | `{}` | | `deployment.strategy.type` | Strategy type - `Recreate` or `Rollingupdate`. | `Recreate` | | `deployment.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods during a rolling update. | `1` | diff --git a/templates/prometheus-postgres-exporter/deployment.yaml b/templates/prometheus-postgres-exporter/deployment.yaml index 67f360f..b5f5e4e 100644 --- a/templates/prometheus-postgres-exporter/deployment.yaml +++ b/templates/prometheus-postgres-exporter/deployment.yaml @@ -95,7 +95,9 @@ spec: {{- if .Values.deployment.priorityClassName }} priorityClassName: {{ .Values.deployment.priorityClassName }} {{- end }} + {{- if .Values.deployment.restartPolicy }} restartPolicy: {{ .Values.deployment.restartPolicy }} + {{- end }} {{- with .Values.deployment.securityContext }} securityContext: {{- toYaml . | nindent 8 }} diff --git a/unittests/deployment/deployment.yaml b/unittests/deployment/deployment.yaml index 228a305..606fa9d 100644 --- a/unittests/deployment/deployment.yaml +++ b/unittests/deployment/deployment.yaml @@ -79,6 +79,8 @@ tests: path: spec.template.spec.nodeSelector - notExists: path: spec.template.spec.priorityClassName + - notExists: + path: spec.template.spec.restartPolicy - notExists: path: spec.template.spec.subdomain @@ -283,6 +285,14 @@ tests: path: spec.template.spec.priorityClassName value: my-priority +- it: Test restartPolicy + set: + deployment.restartPolicy: Always + asserts: + - equal: + path: spec.template.spec.restartPolicy + value: Always + - it: Test additional volumeMounts and volumes set: deployment.postgresExporter.volumeMounts: diff --git a/values.yaml b/values.yaml index 9c81675..dc541f0 100644 --- a/values.yaml +++ b/values.yaml @@ -204,6 +204,9 @@ deployment: ## @param deployment.replicaCount Number of replicas for the postgres-exporter deployment. replicaCount: 1 + ## @param deployment.restartPolicy Restart policy of the postgres-exporter deployment. + restartPolicy: "" + ## @param deployment.securityContext Security context of the postgres-exporter deployment. securityContext: {} # fsGroup: 2000