From 462836232f86b676524f991f6ff786b3228a894f Mon Sep 17 00:00:00 2001 From: Gatschknoedel <59611122+Gatschknoedel@users.noreply.github.com> Date: Tue, 7 May 2024 18:45:52 +0200 Subject: [PATCH] =?UTF-8?q?Added=20extraConfig=20helm=20field,=20so=20conf?= =?UTF-8?q?iguration=20can=20be=20better=20describe=E2=80=A6=20(#25)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added extraConfig helm field, so configuration can be better described declaratively * Switched to single quotes for the exclude namespaces configmap field, since these namespaces can be regex, which results in wrong escaping with double quotes * removed blank between exclude namespace items * adjusted README --------- Co-authored-by: gmi Co-authored-by: Johannes Thiem --- chart/Chart.yaml | 2 +- chart/README.md | 3 ++- chart/templates/configmap.yaml | 5 ++++- chart/values.yaml | 7 +++++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index f1b2822..78d685e 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -3,5 +3,5 @@ name: py-kube-downscaler description: A Helm chart for deploying py-kube-downscaler type: application -version: 0.1.1 +version: 0.2.0 appVersion: "24.4.0" diff --git a/chart/README.md b/chart/README.md index 8ea395c..accadf2 100644 --- a/chart/README.md +++ b/chart/README.md @@ -9,10 +9,11 @@ This repository offers a Helm chart for the `py-kube-downscaler`. | image.tag | string | `"23.2.0@sha256:4129e7e7551eb451ee2b43680ef818f3057304ad50888f79ec9722afab6c29ff"` | Tag of the image to use | | arguments | list | `[--interval=60,--include-resources=deployments,statefulsets,horizontalpodautoscalers,scaledobjects]` | Arguments to pass to the kube-downscaler binary | | excludedNamespaces | list | `["namespace-a", "namespace-b"]` | Namespaces to exclude from downscaling | +| extraConfig | string | `"DOWNSCALE_PERIOD: 'Mon-Sun 19:00-20:00 Europe/Berlin'"` | Additional configuration in ConfigMap format | # Deploy py-kube-downscaler using Helm chart -This directory contains tutorial to deploy py-kube-downscaler. +This directory contains a tutorial to deploy py-kube-downscaler. ## Configuring your Deployment to downscale diff --git a/chart/templates/configmap.yaml b/chart/templates/configmap.yaml index 8764211..536b464 100644 --- a/chart/templates/configmap.yaml +++ b/chart/templates/configmap.yaml @@ -4,4 +4,7 @@ metadata: name: {{ include "py-kube-downscaler.name" . }} data: # downscale for non-work hours - EXCLUDE_NAMESPACES: "{{- join ", " .Values.excludedNamespaces }}" + EXCLUDE_NAMESPACES: '{{- join "," .Values.excludedNamespaces }}' + {{- if .Values.extraConfig }} + {{- tpl .Values.extraConfig . | nindent 2 }} + {{- end }} \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml index 83154e7..2e4bf05 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -71,3 +71,10 @@ configMapName: py-kube-downscaler excludedNamespaces: - py-kube-downscaler - kube-system + +# Additional config in the configmap. +# Add configmap lines via the multiline Operator | +# e.g.: +# extraConfig: | +# DOWNSCALE_PERIOD: "Mon-Sun 19:00-20:00 Europe/Berlin" +extraConfig: "" \ No newline at end of file