From f32f0720129dd5027f079c18e9132e003fcf7836 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 24 Jan 2025 15:08:26 +1100 Subject: [PATCH] Add updateStrategy controls (#12) --- .gitignore | 1 + README.md | 33 +++++++++++++++++---------------- templates/deployment.yaml | 3 +++ values.yaml | 5 +++++ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index e7a8868..c722d72 100644 --- a/.gitignore +++ b/.gitignore @@ -258,3 +258,4 @@ __debug_bin # Other /.run/ +/temp/ diff --git a/README.md b/README.md index c7b84d2..40fd212 100644 --- a/README.md +++ b/README.md @@ -104,22 +104,23 @@ following topics: ### Deployment configuration -| Name | Description | Value | -| --------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ------ | -| `affinity` | Affinity for pod assignment | `{}` | -| `extraEnvVars` | Extra environment variables to be set on Cyral Sidecar containers | `[]` | -| `extraEnvVarsCM` | ConfigMap with extra environment variables | `""` | -| `extraEnvVarsSecret` | Secret with extra environment variables | `""` | -| `extraVolumes` | Array of extra volumes to be added to the Cyral Sidecar deployment (evaluated as template). Requires setting `extraVolumeMounts` | `[]` | -| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` | -| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | -| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` | -| `nodeSelector` | Node labels for pod assignment. Evaluated as a template. | `{}` | -| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | -| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `hard` | -| `replicaCount` | Number of Cyral Sidecar replicas to deploy | `1` | -| `resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | -| `tolerations` | Tolerations for pod assignment. Evaluated as a template. | `[]` | +| Name | Description | Value | +| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | ------ | +| `affinity` | Affinity for pod assignment | `{}` | +| `extraEnvVars` | Extra environment variables to be set on Cyral Sidecar containers | `[]` | +| `extraEnvVarsCM` | ConfigMap with extra environment variables | `""` | +| `extraEnvVarsSecret` | Secret with extra environment variables | `""` | +| `extraVolumes` | Array of extra volumes to be added to the Cyral Sidecar deployment (evaluated as template). Requires setting `extraVolumeMounts` | `[]` | +| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` | +| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` | +| `nodeSelector` | Node labels for pod assignment. Evaluated as a template. | `{}` | +| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `hard` | +| `replicaCount` | Number of Cyral Sidecar replicas to deploy | `1` | +| `resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | +| `tolerations` | Tolerations for pod assignment. Evaluated as a template. | `[]` | +| `updateStrategy.rollingUpdate` | Deployment rolling update configuration parameters. | `{}` | ### Image configuration diff --git a/templates/deployment.yaml b/templates/deployment.yaml index f699147..c1769f9 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -14,6 +14,9 @@ metadata: {{- end }} spec: replicas: {{ .Values.replicaCount }} + {{- if .Values.updateStrategy }} + strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.podLabels .Values.commonLabels ) "context" . ) }} selector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} diff --git a/values.yaml b/values.yaml index 7b8e29b..d82b8a0 100644 --- a/values.yaml +++ b/values.yaml @@ -189,6 +189,11 @@ extraEnvVarsCM: "" extraEnvVarsSecret: "" replicaCount: 1 +## ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy +## +updateStrategy: + type: RollingUpdate + rollingUpdate: {} ## Example: ## resources: ## requests: