diff --git a/barbican/values.yaml b/barbican/values.yaml index 592855d04b..4d12672d5b 100644 --- a/barbican/values.yaml +++ b/barbican/values.yaml @@ -26,6 +26,12 @@ images: pull_policy: "IfNotPresent" pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: barbican_api: init_container: null diff --git a/ceph/templates/deployment-mds.yaml b/ceph/templates/deployment-mds.yaml index c2dfd4071d..deb3f7c3bf 100644 --- a/ceph/templates/deployment-mds.yaml +++ b/ceph/templates/deployment-mds.yaml @@ -28,6 +28,8 @@ spec: labels: {{ tuple $envAll "ceph" "mds" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "ceph" "mds" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.mds.node_selector_key }}: {{ .Values.labels.mds.node_selector_value }} initContainers: diff --git a/ceph/templates/deployment-moncheck.yaml b/ceph/templates/deployment-moncheck.yaml index 2d4e46441b..95009ba3ac 100644 --- a/ceph/templates/deployment-moncheck.yaml +++ b/ceph/templates/deployment-moncheck.yaml @@ -27,6 +27,8 @@ spec: labels: {{ tuple $envAll "ceph" "moncheck" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "ceph" "moncheck" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.mon.node_selector_key }}: {{ .Values.labels.mon.node_selector_value }} initContainers: diff --git a/ceph/templates/deployment-rgw.yaml b/ceph/templates/deployment-rgw.yaml index 5ab2648c90..2c61afe45d 100644 --- a/ceph/templates/deployment-rgw.yaml +++ b/ceph/templates/deployment-rgw.yaml @@ -28,9 +28,11 @@ spec: labels: {{ tuple $envAll "ceph" "rgw" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "ceph" "rgw" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.rgw.node_selector_key }}: {{ .Values.labels.rgw.node_selector_value }} - initContainers: + initContainers: {{ tuple $envAll $dependencies "" | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} serviceAccount: default containers: diff --git a/ceph/values.yaml b/ceph/values.yaml index c45ad09a88..5824fafd8e 100644 --- a/ceph/values.yaml +++ b/ceph/values.yaml @@ -50,6 +50,12 @@ labels: node_selector_value: enabled pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname resources: enabled: false osd: diff --git a/cinder/values.yaml b/cinder/values.yaml index 70b8034f82..f6cfe2fa3b 100644 --- a/cinder/values.yaml +++ b/cinder/values.yaml @@ -39,6 +39,12 @@ images: pull_policy: "IfNotPresent" pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: cinder_api: init_container: null diff --git a/etcd/templates/deployment.yaml b/etcd/templates/deployment.yaml index f789a4c05f..e77fab7c3b 100644 --- a/etcd/templates/deployment.yaml +++ b/etcd/templates/deployment.yaml @@ -26,6 +26,8 @@ spec: labels: {{ tuple $envAll "etcd" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: + affinity: +{{ tuple $envAll "etcd" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} containers: diff --git a/etcd/values.yaml b/etcd/values.yaml index ef569188db..50d7521d3d 100644 --- a/etcd/values.yaml +++ b/etcd/values.yaml @@ -30,6 +30,12 @@ network: port: 2379 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname replicas: etcd: 1 lifecycle: diff --git a/glance/values.yaml b/glance/values.yaml index 577a506f47..bdbf37acd0 100644 --- a/glance/values.yaml +++ b/glance/values.yaml @@ -305,6 +305,12 @@ endpoints: default: 5672 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: glance_api: init_container: null diff --git a/heat/values.yaml b/heat/values.yaml index f0e29f64ed..cabab5b5ab 100644 --- a/heat/values.yaml +++ b/heat/values.yaml @@ -325,6 +325,12 @@ endpoints: default: 5672 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: heat_api: init_container: null diff --git a/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl b/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl index 6fc572c26a..18e0d1e15b 100644 --- a/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl +++ b/helm-toolkit/templates/snippets/_kubernetes_pod_anti_affinity.tpl @@ -16,8 +16,10 @@ {{- $envAll := index . 0 -}} {{- $application := index . 1 -}} {{- $component := index . 2 -}} +{{- $antiAffinityType := index $envAll.Values.pod.affinity.anti.type $component | default $envAll.Values.pod.affinity.anti.type.default }} +{{- $antiAffinityKey := index $envAll.Values.pod.affinity.anti.topologyKey $component | default $envAll.Values.pod.affinity.anti.topologyKey.default }} podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: + {{ $antiAffinityType }}: - podAffinityTerm: labelSelector: matchExpressions: @@ -33,6 +35,6 @@ podAntiAffinity: operator: In values: - {{ $component }} - topologyKey: kubernetes.io/hostname + topologyKey: {{ $antiAffinityKey }} weight: 10 {{- end -}} diff --git a/horizon/values.yaml b/horizon/values.yaml index 0dca7fc2ae..030a18ed00 100644 --- a/horizon/values.yaml +++ b/horizon/values.yaml @@ -17,8 +17,6 @@ # Declare name/value pairs to be passed into your templates. # name: value - - images: db_init: docker.io/kolla/ubuntu-source-horizon:4.0.0 db_sync: docker.io/kolla/ubuntu-source-horizon:4.0.0 @@ -62,6 +60,12 @@ dependencies: endpoint: internal pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: horizon_db_init: init_container: null diff --git a/ingress/templates/deployment-ingress.yaml b/ingress/templates/deployment-ingress.yaml index 43fc0d2725..7d679628b8 100644 --- a/ingress/templates/deployment-ingress.yaml +++ b/ingress/templates/deployment-ingress.yaml @@ -35,6 +35,10 @@ spec: labels: app: ingress-api spec: +{{- if eq .Values.deployment_type "Deployment" }} + affinity: +{{ tuple $envAll "ingress" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{- end }} nodeSelector: {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} {{- if .Values.network.host_namespace }} diff --git a/ingress/values.yaml b/ingress/values.yaml index a54af99220..e37fe606db 100644 --- a/ingress/values.yaml +++ b/ingress/values.yaml @@ -25,6 +25,12 @@ images: pull_policy: "IfNotPresent" pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname replicas: ingress: 1 error_page: 1 diff --git a/keystone/values.yaml b/keystone/values.yaml index 03bd0ac5f7..285d514d6e 100644 --- a/keystone/values.yaml +++ b/keystone/values.yaml @@ -83,6 +83,12 @@ dependencies: endpoint: internal pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: keystone_db_init: init_container: null diff --git a/magnum/values.yaml b/magnum/values.yaml index 8e8a34a64a..db0df3292c 100644 --- a/magnum/values.yaml +++ b/magnum/values.yaml @@ -206,6 +206,12 @@ endpoints: default: 5672 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: magnum_api: init_container: null diff --git a/mariadb/values.yaml b/mariadb/values.yaml index a473326c38..46acd094a3 100644 --- a/mariadb/values.yaml +++ b/mariadb/values.yaml @@ -15,6 +15,12 @@ force_bootstrap: false pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname replicas: server: 3 lifecycle: diff --git a/memcached/values.yaml b/memcached/values.yaml index d87c1ffca2..d4631b0a22 100644 --- a/memcached/values.yaml +++ b/memcached/values.yaml @@ -22,6 +22,12 @@ images: pull_policy: "IfNotPresent" pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname replicas: server: 1 lifecycle: diff --git a/mistral/values.yaml b/mistral/values.yaml index d5e435473a..51178d0f06 100644 --- a/mistral/values.yaml +++ b/mistral/values.yaml @@ -237,6 +237,12 @@ conf: auth_version: v3 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: mistral_api: init_container: null diff --git a/neutron/values.yaml b/neutron/values.yaml index f4bfd7b7b0..add3565e86 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -184,6 +184,12 @@ dependencies: endpoint: internal pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: neutron_server: init_container: null diff --git a/nova/values.yaml b/nova/values.yaml index fb6e2f202d..1cbd58b3b2 100644 --- a/nova/values.yaml +++ b/nova/values.yaml @@ -516,6 +516,12 @@ endpoints: public: 80 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: nova_compute: init_container: null diff --git a/rabbitmq/values.yaml b/rabbitmq/values.yaml index 9e50f382c0..8fd8559b0c 100644 --- a/rabbitmq/values.yaml +++ b/rabbitmq/values.yaml @@ -22,6 +22,12 @@ labels: node_selector_value: enabled pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname replicas: server: 3 lifecycle: diff --git a/senlin/values.yaml b/senlin/values.yaml index da649dd78c..56b3c5b2c8 100644 --- a/senlin/values.yaml +++ b/senlin/values.yaml @@ -206,6 +206,12 @@ endpoints: default: 5672 pod: + affinity: + anti: + type: + default: preferredDuringSchedulingIgnoredDuringExecution + topologyKey: + default: kubernetes.io/hostname mounts: senlin_api: init_container: null