Browse Source

Add pod affinity to Shipyard and Airflow

This PS adds pod anti-affinity to airflow/shipyard pods,
so that the scheduler can constrain pods against labels on other pods
running on the node.   The default soft rule is in place so that if
the scheduler can’t satisfy the the requirement, the pod will still
be scheduled, and is overridable.


Change-Id: I67d0792a1f624044f8975c9540ab691f4e638b3f
changes/93/659893/3
anthony.bellino 2 years ago
committed by Anthony Bellino
parent
commit
89a8eda43e
  1. 2
      charts/shipyard/templates/deployment-airflow-scheduler.yaml
  2. 2
      charts/shipyard/templates/deployment-shipyard.yaml
  3. 2
      charts/shipyard/templates/statefulset-airflow-worker.yaml
  4. 6
      charts/shipyard/values.yaml

2
charts/shipyard/templates/deployment-airflow-scheduler.yaml

@ -47,6 +47,8 @@ spec:
configmap-etc-hash: {{ tuple "configmap-airflow-etc.yaml" . | include "helm-toolkit.utils.hash" }}
spec:
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "airflow" "scheduler" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.airflow.node_selector_key }}: {{ .Values.labels.airflow.node_selector_value }}
restartPolicy: Always

2
charts/shipyard/templates/deployment-shipyard.yaml

@ -42,6 +42,8 @@ spec:
spec:
{{ dict "envAll" $envAll "application" "shipyard" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "shipyard" "api" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.shipyard.node_selector_key }}: {{ .Values.labels.shipyard.node_selector_value }}
terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.shipyard.timeout | default "30" }}

2
charts/shipyard/templates/statefulset-airflow-worker.yaml

@ -75,6 +75,8 @@ spec:
{{ tuple $envAll "airflow" "worker" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
affinity:
{{ tuple $envAll "airflow" "worker" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
nodeSelector:
{{ .Values.labels.airflow.node_selector_key }}: {{ .Values.labels.airflow.node_selector_value }}
initContainers:

6
charts/shipyard/values.yaml

@ -734,6 +734,12 @@ pod:
shipyard_db_sync:
init_container: null
shipyard_db_sync:
affinity:
anti:
type:
default: preferredDuringSchedulingIgnoredDuringExecution
topologyKey:
default: kubernetes.io/hostname
replicas:
shipyard:
api: 2

Loading…
Cancel
Save