Skip to content

Commit

Permalink
make topology spread constraints fully configurable (#87)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bueti authored Nov 24, 2023
1 parent 47156de commit 58d1ed7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/kubeconform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions charts/imaginary/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions charts/imaginary/README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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

Expand Down
14 changes: 4 additions & 10 deletions charts/imaginary/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
13 changes: 11 additions & 2 deletions charts/imaginary/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 58d1ed7

Please sign in to comment.