From cf5f094219239e10fd9832618addbbd1618ce45b Mon Sep 17 00:00:00 2001 From: Lis Date: Tue, 15 Nov 2022 20:06:04 +0800 Subject: [PATCH] fix(installer): add pod affinity (#2176) Co-authored-by: root --- .../tke-platform/templates/tke-platform-api.yaml | 11 +++++++++++ .../templates/tke-platform-controller.yaml | 11 +++++++++++ .../tke-application-api/tke-application-api.yaml | 11 +++++++++++ .../tke-application-controller.yaml | 11 +++++++++++ .../manifests/tke-audit-api/tke-audit-api.yaml | 11 +++++++++++ .../manifests/tke-business-api/tke-business-api.yaml | 11 +++++++++++ .../tke-business-controller.yaml | 11 +++++++++++ .../manifests/tke-logagent-api/tke-logagent-api.yaml | 11 +++++++++++ .../tke-logagent-controller.yaml | 11 +++++++++++ .../manifests/tke-mesh-api/tke-mesh-api.yaml | 11 +++++++++++ .../tke-mesh-controller/tke-mesh-controller.yaml | 11 +++++++++++ .../manifests/tke-monitor-api/tke-monitor-api.yaml | 11 +++++++++++ .../tke-monitor-controller.yaml | 11 +++++++++++ .../manifests/tke-notify-api/tke-notify-api.yaml | 11 +++++++++++ .../tke-notify-controller/tke-notify-controller.yaml | 11 +++++++++++ 15 files changed, 165 insertions(+) diff --git a/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-api.yaml b/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-api.yaml index 636c53cbb..533881d3b 100644 --- a/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-api.yaml @@ -57,6 +57,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-platform-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-platform-api image: {{ .Values.api.image }} diff --git a/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-controller.yaml b/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-controller.yaml index f9798711a..9c7b85a62 100644 --- a/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/charts/tke-platform/templates/tke-platform-controller.yaml @@ -26,6 +26,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-platform-controller + topologyKey: kubernetes.io/hostname + weight: 1 initContainers: - command: - sh diff --git a/cmd/tke-installer/app/installer/manifests/tke-application-api/tke-application-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-application-api/tke-application-api.yaml index 420ecc10c..0c37a55b3 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-application-api/tke-application-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-application-api/tke-application-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-application-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-application-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-application-controller/tke-application-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-application-controller/tke-application-controller.yaml index ab5e9a3db..dd3a8cf7b 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-application-controller/tke-application-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-application-controller/tke-application-controller.yaml @@ -26,6 +26,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-application-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-application-controller image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-audit-api/tke-audit-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-audit-api/tke-audit-api.yaml index 0a94bc3ed..934e73c9e 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-audit-api/tke-audit-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-audit-api/tke-audit-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-audit-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-audit-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-business-api/tke-business-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-business-api/tke-business-api.yaml index 2047da149..2ef0f74f0 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-business-api/tke-business-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-business-api/tke-business-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-business-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-business-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-business-controller/tke-business-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-business-controller/tke-business-controller.yaml index 94727fb54..a8d0e3ed9 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-business-controller/tke-business-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-business-controller/tke-business-controller.yaml @@ -26,6 +26,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-business-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-business-controller image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-logagent-api/tke-logagent-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-logagent-api/tke-logagent-api.yaml index 1e0c61048..f414fe91f 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-logagent-api/tke-logagent-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-logagent-api/tke-logagent-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-logagent-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-logagent-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-logagent-controller/tke-logagent-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-logagent-controller/tke-logagent-controller.yaml index 574d4c7a6..e45ecf0d8 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-logagent-controller/tke-logagent-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-logagent-controller/tke-logagent-controller.yaml @@ -26,6 +26,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-logagent-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-logagent-controller image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-mesh-api/tke-mesh-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-mesh-api/tke-mesh-api.yaml index 9577c2ded..97aff0e1c 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-mesh-api/tke-mesh-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-mesh-api/tke-mesh-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-mesh-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-mesh-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-mesh-controller/tke-mesh-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-mesh-controller/tke-mesh-controller.yaml index f24140cb9..f6121bb0c 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-mesh-controller/tke-mesh-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-mesh-controller/tke-mesh-controller.yaml @@ -29,6 +29,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-mesh-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-mesh-controller image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-monitor-api/tke-monitor-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-monitor-api/tke-monitor-api.yaml index fe14985a9..cc4815cc1 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-monitor-api/tke-monitor-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-monitor-api/tke-monitor-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-monitor-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-monitor-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-monitor-controller/tke-monitor-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-monitor-controller/tke-monitor-controller.yaml index 0e45437a4..483b4e9cd 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-monitor-controller/tke-monitor-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-monitor-controller/tke-monitor-controller.yaml @@ -29,6 +29,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-monitor-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-monitor-controller image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-notify-api/tke-notify-api.yaml b/cmd/tke-installer/app/installer/manifests/tke-notify-api/tke-notify-api.yaml index d33fe4e83..dcb9ee5e7 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-notify-api/tke-notify-api.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-notify-api/tke-notify-api.yaml @@ -42,6 +42,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-notify-api + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-notify-api image: {{ .Image }} diff --git a/cmd/tke-installer/app/installer/manifests/tke-notify-controller/tke-notify-controller.yaml b/cmd/tke-installer/app/installer/manifests/tke-notify-controller/tke-notify-controller.yaml index d64dbcd03..eb11f402f 100644 --- a/cmd/tke-installer/app/installer/manifests/tke-notify-controller/tke-notify-controller.yaml +++ b/cmd/tke-installer/app/installer/manifests/tke-notify-controller/tke-notify-controller.yaml @@ -26,6 +26,17 @@ spec: - matchExpressions: - key: node-role.kubernetes.io/master operator: Exists + podAntiAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - podAffinityTerm: + labelSelector: + matchExpressions: + - key: app + operator: In + values: + - tke-notify-controller + topologyKey: kubernetes.io/hostname + weight: 1 containers: - name: tke-notify-controller image: {{ .Image }}