From 58d1ed7a6723a1b591b716cc8c48feb876b6ce2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=BCtikofer?= Date: Fri, 24 Nov 2023 14:19:03 +0100 Subject: [PATCH] make topology spread constraints fully configurable (#87) * make topology spread constraints fully configurable * update k8s versions used in ci * update k8s versions used in ci * update k8s versions used in ci * update k8s versions used in ci * update k8s versions used in ci * update k8s versions used in ci * update k8s versions used in ci * update kind action * custom values * custom values * custom values * custom values * custom values --- .github/kubeconform.sh | 2 +- .github/workflows/ci.yaml | 10 +++++----- charts/imaginary/Chart.yaml | 5 ++--- charts/imaginary/README.md | 4 ++-- charts/imaginary/templates/deployment.yaml | 14 ++++---------- charts/imaginary/values.yaml | 13 +++++++++++-- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.github/kubeconform.sh b/.github/kubeconform.sh index a938aff..b8fca6c 100755 --- a/.github/kubeconform.sh +++ b/.github/kubeconform.sh @@ -2,7 +2,7 @@ set -euo pipefail CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | grep '[cC]hart.yaml' | sed -e 's#/[Cc]hart.yaml##g')" -KUBECONFORM_VERSION="v0.6.3" +KUBECONFORM_VERSION="v0.6.4" # install kubeval curl --silent --show-error --fail --location --output /tmp/kubeconform-linux-amd64.tar.gz https://github.com/yannh/kubeconform/releases/download/"${KUBECONFORM_VERSION}"/kubeconform-linux-amd64.tar.gz diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 40de279..1a85a17 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,7 +57,7 @@ jobs: - name: Create kind cluster if: steps.list-changed.outputs.changed == 'true' - uses: helm/kind-action@v1.7.0 + uses: helm/kind-action@v1.8.0 - name: Run chart-testing (install) if: steps.list-changed.outputs.changed == 'true' @@ -77,10 +77,10 @@ jobs: strategy: matrix: k8s: - - 1.24.16 - - 1.25.12 - - 1.26.7 - - 1.27.4 + - 1.25.16 + - 1.26.9 + - 1.27.8 + - 1.28.4 steps: - name: Checkout uses: actions/checkout@v1 diff --git a/charts/imaginary/Chart.yaml b/charts/imaginary/Chart.yaml index f549af9..db50f21 100644 --- a/charts/imaginary/Chart.yaml +++ b/charts/imaginary/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "1.2.4" description: Deploy imaginary to process pictures on the fly name: imaginary -version: 0.2.0 +version: 0.2.1 home: https://github.com/h2non/imaginary sources: - https://github.com/ricardo-ch/helm-charts/tree/main/charts/imaginary @@ -15,8 +15,7 @@ keywords: - h2non annotations: artifacthub.io/changes: | - - Add TopologySpreadConstraints to the deployment - - Add Topology Aware Hints to the service + - Make TopologySpreadConstraints fully configurable artifacthub.io/images: | - name: imaginary image: h2non/imaginary:1.2.4 diff --git a/charts/imaginary/README.md b/charts/imaginary/README.md index 6e32c6e..dcab6c1 100644 --- a/charts/imaginary/README.md +++ b/charts/imaginary/README.md @@ -1,6 +1,6 @@ # imaginary -![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE) +![Version: 0.2.1](https://img.shields.io/badge/Version-0.2.1-informational?style=flat-square) ![AppVersion: 1.2.4](https://img.shields.io/badge/AppVersion-1.2.4-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE) This chart installs [Imaginary](https://github.com/h2non/imaginary). @@ -52,7 +52,7 @@ Simply add this Chart repository to Helm: | tls.privateKey | string | `""` | Base64 encoded private key file for TLS certificate. | | tolerations | list | `[]` | A toleration | | topologyAware | string | `"auto"` | Configures Toplogy Aware Hints | -| topologyKey | string | `"topology.kubernetes.io/zone"` | Configures the key for topology spread constraints | +| topologySpreadConstraints | list | `[]` | Configures the topology spread constraints | ## Source Code diff --git a/charts/imaginary/templates/deployment.yaml b/charts/imaginary/templates/deployment.yaml index 5642592..7a5f148 100644 --- a/charts/imaginary/templates/deployment.yaml +++ b/charts/imaginary/templates/deployment.yaml @@ -37,6 +37,10 @@ spec: {{- if .Values.tolerations }} tolerations: {{ toYaml .Values.tolerations | indent 8 }} + {{- end }} + {{- if .Values.topologySpreadConstraints }} + topologySpreadConstraints: +{{ toYaml .Values.topologySpreadConstraints | indent 8 }} {{- end }} {{- if .Values.nodeSelector }} nodeSelector: @@ -46,16 +50,6 @@ spec: - name: "imaginary" image: {{ .Values.image | quote }} imagePullPolicy: {{ .Values.imagePullPolicy }} - topologySpreadConstraints: - - labelSelector: - matchExpressions: - - key: app.kubernetes.io/name - operator: In - values: - - {{ .Release.Name | quote }} - maxSkew: 1 - topologyKey: {{ .Values.topologyKey | quote }} - whenUnsatisfiable: DoNotSchedule env: - name: PORT value: {{ .Values.httpPort | quote }} diff --git a/charts/imaginary/values.yaml b/charts/imaginary/values.yaml index c4892ba..cc098b3 100644 --- a/charts/imaginary/values.yaml +++ b/charts/imaginary/values.yaml @@ -95,5 +95,14 @@ hpa: # -- Configures Toplogy Aware Hints topologyAware: auto -# -- Configures the key for topology spread constraints -topologyKey: topology.kubernetes.io/zone +# -- Configures the topology spread constraints +topologySpreadConstraints: [] + # - labelSelector: + # matchExpressions: + # - key: app.kubernetes.io/name + # operator: In + # values: + # - "imaginary" + # maxSkew: 1 + # topologyKey: topology.kubernetes.io/zone + # whenUnsatisfiable: DoNotSchedule