1 {{/* vim: set filetype=mustache: */}}
4 Return a soft nodeAffinity definition
5 {{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
7 {{- define "common.affinities.nodes.soft" -}}
8 preferredDuringSchedulingIgnoredDuringExecution:
21 Return a hard nodeAffinity definition
22 {{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
24 {{- define "common.affinities.nodes.hard" -}}
25 requiredDuringSchedulingIgnoredDuringExecution:
37 Return a nodeAffinity definition
38 {{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
40 {{- define "common.affinities.nodes" -}}
41 {{- if eq .type "soft" }}
42 {{- include "common.affinities.nodes.soft" . -}}
43 {{- else if eq .type "hard" }}
44 {{- include "common.affinities.nodes.hard" . -}}
49 Return a soft podAffinity/podAntiAffinity definition
50 {{ include "common.affinities.pods.soft" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
52 {{- define "common.affinities.pods.soft" -}}
53 {{- $component := default "" .component -}}
54 {{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
55 preferredDuringSchedulingIgnoredDuringExecution:
58 matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 10 }}
59 {{- if not (empty $component) }}
60 {{ printf "app.kubernetes.io/component: %s" $component }}
62 {{- range $key, $value := $extraMatchLabels }}
63 {{ $key }}: {{ $value | quote }}
66 - {{ include "common.names.namespace" .context | quote }}
67 topologyKey: kubernetes.io/hostname
72 Return a hard podAffinity/podAntiAffinity definition
73 {{ include "common.affinities.pods.hard" (dict "component" "FOO" "extraMatchLabels" .Values.extraMatchLabels "context" $) -}}
75 {{- define "common.affinities.pods.hard" -}}
76 {{- $component := default "" .component -}}
77 {{- $extraMatchLabels := default (dict) .extraMatchLabels -}}
78 requiredDuringSchedulingIgnoredDuringExecution:
80 matchLabels: {{- (include "common.labels.matchLabels" .context) | nindent 8 }}
81 {{- if not (empty $component) }}
82 {{ printf "app.kubernetes.io/component: %s" $component }}
84 {{- range $key, $value := $extraMatchLabels }}
85 {{ $key }}: {{ $value | quote }}
88 - {{ include "common.names.namespace" .context | quote }}
89 topologyKey: kubernetes.io/hostname
93 Return a podAffinity/podAntiAffinity definition
94 {{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
96 {{- define "common.affinities.pods" -}}
97 {{- if eq .type "soft" }}
98 {{- include "common.affinities.pods.soft" . -}}
99 {{- else if eq .type "hard" }}
100 {{- include "common.affinities.pods.hard" . -}}