From d40a1070fa23398d02848a1bbe227980d4b2b2f0 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Tue, 4 Mar 2025 07:26:58 +0100 Subject: [PATCH] Add affinity configuration to Kubernetes pod template This commit adds support for specifying pod affinity settings in the Kubernetes pod template for the Artemis broker Helm chart. The changes include a new conditional block in the `_pod.tpl` template file that allows users to define affinity rules in the `values.yaml` file under the `affinity` key. The addition was necessary to provide users with more flexibility in scheduling their pods based on node characteristics, which is essential for optimizing resource allocation and achieving desired deployment strategies. No breaking changes were introduced, and the default `affinity` configuration remains empty, ensuring backward compatibility. --- artemis-broker/templates/_pod.tpl | 4 ++++ artemis-broker/values.yaml | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/artemis-broker/templates/_pod.tpl b/artemis-broker/templates/_pod.tpl index de5a826..fccab08 100644 --- a/artemis-broker/templates/_pod.tpl +++ b/artemis-broker/templates/_pod.tpl @@ -1,5 +1,9 @@ {{- define "amq.pod" -}} {{- if eq .Values.platform "kubernetes" -}} +{{- with .Values.affinity }} +affinity: +{{- toYaml . | nindent 2 -}} +{{- end }} imagePullSecrets: - name: {{ .Values.application.pullSecretName }} {{- end }} diff --git a/artemis-broker/values.yaml b/artemis-broker/values.yaml index b7fe305..62c1156 100644 --- a/artemis-broker/values.yaml +++ b/artemis-broker/values.yaml @@ -225,3 +225,13 @@ resources: {} # memory: 1000Mi # +# k8s affinity +affinity: {} +# nodeAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# nodeSelectorTerms: +# - matchExpressions: +# - key: disktype +# operator: In +# values: +# - ssd \ No newline at end of file