github.com/replicatedcom/ship@v0.50.0/integration/init/istio/expected/.ship/upstream/templates/_affinity.tpl (about)

     1  {{/* affinity - https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ */}}
     2  
     3  {{- define "nodeaffinity" }}
     4    nodeAffinity:
     5      requiredDuringSchedulingIgnoredDuringExecution:
     6      {{- include "nodeAffinityRequiredDuringScheduling" . }}
     7      preferredDuringSchedulingIgnoredDuringExecution:
     8      {{- include "nodeAffinityPreferredDuringScheduling" . }}
     9  {{- end }}
    10  
    11  {{- define "nodeAffinityRequiredDuringScheduling" }}
    12        nodeSelectorTerms:
    13        - matchExpressions:
    14          - key: beta.kubernetes.io/arch
    15            operator: In
    16            values:
    17          {{- range $key, $val := .Values.global.arch }}
    18            {{- if gt ($val | int) 0 }}
    19            - {{ $key }}
    20            {{- end }}
    21          {{- end }}
    22  {{- end }}
    23  
    24  {{- define "nodeAffinityPreferredDuringScheduling" }}
    25    {{- range $key, $val := .Values.global.arch }}
    26      {{- if gt ($val | int) 0 }}
    27      - weight: {{ $val | int }}
    28        preference:
    29          matchExpressions:
    30          - key: beta.kubernetes.io/arch
    31            operator: In
    32            values:
    33            - {{ $key }}
    34      {{- end }}
    35    {{- end }}
    36  {{- end }}