1 {{/* vim: set filetype=mustache: */}}
3 # Copyright © 2020 Bitnami, Orange
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
19 Return a soft nodeAffinity definition
20 {{ include "common.affinities.nodes.soft" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
22 {{- define "common.affinities.nodes.soft" -}}
23 preferredDuringSchedulingIgnoredDuringExecution:
36 Return a hard nodeAffinity definition
37 {{ include "common.affinities.nodes.hard" (dict "key" "FOO" "values" (list "BAR" "BAZ")) -}}
39 {{- define "common.affinities.nodes.hard" -}}
40 requiredDuringSchedulingIgnoredDuringExecution:
52 Return a nodeAffinity definition
53 {{ include "common.affinities.nodes" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
55 {{- define "common.affinities.nodes" -}}
56 {{- if eq .type "soft" }}
57 {{- include "common.affinities.nodes.soft" . -}}
58 {{- else if eq .type "hard" }}
59 {{- include "common.affinities.nodes.hard" . -}}
64 Return a soft podAffinity/podAntiAffinity definition
65 {{ include "common.affinities.pods.soft" (dict "component" "FOO" "context" $) -}}
67 {{- define "common.affinities.pods.soft" -}}
68 {{- $component := default "" .component -}}
69 preferredDuringSchedulingIgnoredDuringExecution:
72 matchLabels: {{- (include "common.matchLabels" (dict "dot" .context "matchLabels" (dict))) | nindent 10 }}
73 {{- if not (empty $component) }}
74 {{ printf "app.kubernetes.io/component: %s" $component }}
77 - {{ include "common.namespace" .context }}
78 topologyKey: kubernetes.io/hostname
83 Return a hard podAffinity/podAntiAffinity definition
84 {{ include "common.affinities.pods.hard" (dict "component" "FOO" "context" $) -}}
86 {{- define "common.affinities.pods.hard" -}}
87 {{- $component := default "" .component -}}
88 requiredDuringSchedulingIgnoredDuringExecution:
90 matchLabels: {{- (include "common.matchLabels" (dict "dot" .context "matchLabels" (dict))) | nindent 8 }}
91 {{- if not (empty $component) }}
92 {{ printf "app.kubernetes.io/component: %s" $component }}
95 - {{ include "common.namespace" .context }}
96 topologyKey: kubernetes.io/hostname
100 Return a podAffinity/podAntiAffinity definition
101 {{ include "common.affinities.pods" (dict "type" "soft" "key" "FOO" "values" (list "BAR" "BAZ")) -}}
103 {{- define "common.affinities.pods" -}}
104 {{- if eq .type "soft" }}
105 {{- include "common.affinities.pods.soft" . -}}
106 {{- else if eq .type "hard" }}
107 {{- include "common.affinities.pods.hard" . -}}