Skip to content

Commit

Permalink
[kube-state-metrics] tpl for affinity (#5231)
Browse files Browse the repository at this point in the history
* [kube-state-metrics] tpl affinity

Signed-off-by: TheRealNoob <[email protected]>

* update values.yaml

Signed-off-by: TheRealNoob <[email protected]>

* Update charts/kube-state-metrics/values.yaml

Signed-off-by: David Calvert <[email protected]>

* Update charts/kube-state-metrics/values.yaml

Signed-off-by: David Calvert <[email protected]>

---------

Signed-off-by: TheRealNoob <[email protected]>
Signed-off-by: David Calvert <[email protected]>
Co-authored-by: David Calvert <[email protected]>
  • Loading branch information
TheRealNoob and dotdc authored Jan 29, 2025
1 parent dc431ff commit 19b7e97
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/kube-state-metrics/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords:
- prometheus
- kubernetes
type: application
version: 5.28.0
version: 5.28.1
appVersion: 2.14.0
home: https://github.com/kubernetes/kube-state-metrics/
sources:
Expand Down
6 changes: 5 additions & 1 deletion charts/kube-state-metrics/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ spec:
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- if kindIs "map" .Values.affinity }}
{{- toYaml .Values.affinity | nindent 8 }}
{{- else }}
{{- tpl .Values.affinity $ | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
8 changes: 8 additions & 0 deletions charts/kube-state-metrics/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,16 @@ containerSecurityContext:
nodeSelector: {}

## Affinity settings for pod assignment
## Can be defined as either a dict or string. String is useful for `tpl` templating.
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
affinity: {}
# affinity: |
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchLabels:
# {{- include "kube-state-metrics.selectorLabels" . | indent 10 }}
# topologyKey: kubernetes.io/hostname

## Tolerations for pod assignment
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Expand Down

0 comments on commit 19b7e97

Please sign in to comment.