From 918cb84cc274a4515914b2e50c4d5e5064dfde05 Mon Sep 17 00:00:00 2001 From: Eric Shen <ericshenyuhao@outlook.com> Date: Thu, 19 Dec 2024 19:08:37 +0800 Subject: [PATCH] fix: support some missing configs on console, vault and grafana components (#1193) * fix: support some missting configs Signed-off-by: ericsyh <ericshenyuhao@outlook.com> * update Signed-off-by: ericsyh <ericshenyuhao@outlook.com> * apply on sn-platform Signed-off-by: ericsyh <ericshenyuhao@outlook.com> * support vault init jobs Signed-off-by: ericsyh <ericshenyuhao@outlook.com> * fix lint Signed-off-by: ericsyh <ericshenyuhao@outlook.com> --------- Signed-off-by: ericsyh <ericshenyuhao@outlook.com> (cherry picked from commit f82fc0a7bdb6ee545b55abbdc64314346448415f) --- .../templates/grafana/grafana-deployment.yaml | 2 ++ .../streamnative-console-initialize.yaml | 8 ++++++++ .../streamnative-console-statefulset.yaml | 2 ++ charts/sn-platform-slim/values.yaml | 16 +++++++++++++++- .../templates/grafana/grafana-statefulset.yaml | 2 ++ .../streamnative-console-initialize.yaml | 8 ++++++++ .../streamnative-console-statefulset.yaml | 2 ++ .../vault/vault-initialize-public-key.yaml | 13 +++++++++++++ .../templates/vault/vault-initialize.yaml | 10 ++++++++++ charts/sn-platform/values.yaml | 16 +++++++++++++++- 10 files changed, 77 insertions(+), 2 deletions(-) diff --git a/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml b/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml index 27ebc3126..1484ffdcb 100644 --- a/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml +++ b/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml @@ -65,6 +65,8 @@ spec: tolerations: {{ toYaml .Values.grafana.tolerations | indent 8 }} {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.grafana.affinity "Component" .Values.grafana.component "Release" .Release "Chart" .Chart) | indent 8 }} terminationGracePeriodSeconds: {{ .Values.grafana.gracePeriod }} containers: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.grafana.component }}" diff --git a/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-initialize.yaml b/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-initialize.yaml index 12784de2d..25902e157 100644 --- a/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-initialize.yaml +++ b/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-initialize.yaml @@ -36,6 +36,14 @@ spec: {{- if .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }} {{- end }} + {{- if .Values.streamnative_console.nodeSelector }} + nodeSelector: {{- toYaml .Values.streamnative_console.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.streamnative_console.tolerations }} + tolerations: {{- toYaml .Values.streamnative_console.tolerations | nindent 8 }} + {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.streamnative_console.affinity "Component" .Values.streamnative_console.component "Release" .Release "Chart" .Chart) | indent 8 }} {{- if not .Values.istio.enabled }} initContainers: # This init container will wait for broker to be ready before diff --git a/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-statefulset.yaml b/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-statefulset.yaml index 8d309ec05..229dd2808 100644 --- a/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-statefulset.yaml +++ b/charts/sn-platform-slim/templates/streamnative-console/streamnative-console-statefulset.yaml @@ -67,6 +67,8 @@ spec: tolerations: {{ toYaml .Values.streamnative_console.tolerations | indent 8 }} {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.streamnative_console.affinity "Component" .Values.streamnative_console.component "Release" .Release "Chart" .Chart) | indent 8 }} terminationGracePeriodSeconds: {{ .Values.streamnative_console.gracePeriod }} {{- if not .Values.istio.enabled }} initContainers: diff --git a/charts/sn-platform-slim/values.yaml b/charts/sn-platform-slim/values.yaml index e5b7aec04..c71e5ec51 100644 --- a/charts/sn-platform-slim/values.yaml +++ b/charts/sn-platform-slim/values.yaml @@ -1725,7 +1725,6 @@ prometheus: requests: memory: 256Mi cpu: 0.1 - # Definition of the serviceAccount used to run brokers. affinity: anti_affinity: true zone_anti_affinity: true @@ -1733,6 +1732,7 @@ prometheus: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution + # Definition of the serviceAccount used to run brokers. serviceAccount: # Specifies whether to use a service account to run this component use: true @@ -1885,6 +1885,13 @@ grafana: requests: memory: 250Mi cpu: 0.1 + affinity: + anti_affinity: true + zone_anti_affinity: true + # Set the anti affinity type. Valid values: + # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica + # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee + type: preferredDuringSchedulingIgnoredDuringExecution volumes: # use a persistent volume or emptyDir persistence: true @@ -2040,6 +2047,13 @@ streamnative_console: limits: {} # memory: "1Gi" # cpu: "0.4" + affinity: + anti_affinity: true + zone_anti_affinity: true + # Set the anti affinity type. Valid values: + # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica + # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee + type: preferredDuringSchedulingIgnoredDuringExecution volumes: # use a persistent volume or emptyDir persistence: true diff --git a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml index 3ffcbc307..45cd20d61 100644 --- a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml +++ b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml @@ -63,6 +63,8 @@ spec: tolerations: {{ toYaml .Values.grafana.tolerations | indent 8 }} {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.grafana.affinity "Component" .Values.grafana.component "Release" .Release "Chart" .Chart) | indent 8 }} terminationGracePeriodSeconds: {{ .Values.grafana.gracePeriod }} {{- if .Values.grafana.volumes.securityContext }} securityContext: diff --git a/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml b/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml index 725fcb415..811865102 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml @@ -36,6 +36,14 @@ spec: {{- if .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }} {{- end }} + {{- if .Values.streamnative_console.nodeSelector }} + nodeSelector: {{- toYaml .Values.streamnative_console.nodeSelector | nindent 8 }} + {{- end }} + {{- if .Values.streamnative_console.tolerations }} + tolerations: {{- toYaml .Values.streamnative_console.tolerations | nindent 8 }} + {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.streamnative_console.affinity "Component" .Values.streamnative_console.component "Release" .Release "Chart" .Chart) | indent 8 }} {{- if not .Values.istio.enabled }} initContainers: # This init container will wait for broker to be ready before diff --git a/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml b/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml index 9c4a58189..50406506d 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml @@ -67,6 +67,8 @@ spec: tolerations: {{ toYaml .Values.streamnative_console.tolerations | indent 8 }} {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.streamnative_console.affinity "Component" .Values.streamnative_console.component "Release" .Release "Chart" .Chart) | indent 8 }} terminationGracePeriodSeconds: {{ .Values.streamnative_console.gracePeriod }} {{- if not .Values.istio.enabled }} initContainers: diff --git a/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml b/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml index 098256362..b50370de8 100644 --- a/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml +++ b/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml @@ -41,6 +41,19 @@ spec: {{- end }} spec: serviceAccountName: {{ template "pulsar.vault.serviceAccount" . }} + {{- if .Values.global.imagePullSecrets }} + imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }} + {{- end }} + {{- if .Values.vault.tolerations }} + tolerations: + {{ toYaml .Values.vault.tolerations | indent 8 }} + {{- end }} + {{- if .Values.vault.nodeSelector }} + nodeSelector: + {{ toYaml .Values.vault.nodeSelector | indent 8 }} + {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.vault.affinity "Component" .Values.vault.component "Release" .Release "Chart" .Chart) | indent 8 }} containers: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.vault.component }}-init" image: "{{ .Values.images.vault_init.repository }}:{{ .Values.images.vault_init.tag }}" diff --git a/charts/sn-platform/templates/vault/vault-initialize.yaml b/charts/sn-platform/templates/vault/vault-initialize.yaml index 7761ca142..0be312c02 100644 --- a/charts/sn-platform/templates/vault/vault-initialize.yaml +++ b/charts/sn-platform/templates/vault/vault-initialize.yaml @@ -44,6 +44,16 @@ spec: {{- if .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }} {{- end }} + {{- if .Values.vault.tolerations }} + tolerations: + {{ toYaml .Values.vault.tolerations | indent 8 }} + {{- end }} + {{- if .Values.vault.nodeSelector }} + nodeSelector: + {{ toYaml .Values.vault.nodeSelector | indent 8 }} + {{- end }} + affinity: + {{- include "pulsar.antiAffinityRules" (dict "Values" .Values "thisAffinity" .Values.vault.affinity "Component" .Values.vault.component "Release" .Release "Chart" .Chart) | indent 8 }} containers: - name: "{{ template "pulsar.fullname" . }}-{{ .Values.vault.component }}-init" image: "{{ .Values.images.vault_init.repository }}:{{ .Values.images.vault_init.tag }}" diff --git a/charts/sn-platform/values.yaml b/charts/sn-platform/values.yaml index 79e53ae55..c8b9e70cb 100644 --- a/charts/sn-platform/values.yaml +++ b/charts/sn-platform/values.yaml @@ -1806,7 +1806,6 @@ prometheus: requests: memory: 256Mi cpu: 0.1 - # Definition of the serviceAccount used to run brokers. affinity: anti_affinity: true zone_anti_affinity: true @@ -1814,6 +1813,7 @@ prometheus: # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee type: preferredDuringSchedulingIgnoredDuringExecution + # Definition of the serviceAccount used to run brokers. serviceAccount: # Specifies whether to use a service account to run this component use: true @@ -1966,6 +1966,13 @@ grafana: labels: {} annotations: {} tolerations: [] + affinity: + anti_affinity: true + zone_anti_affinity: true + # Set the anti affinity type. Valid values: + # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica + # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee + type: preferredDuringSchedulingIgnoredDuringExecution gracePeriod: 0 port: 3000 resources: @@ -2119,6 +2126,13 @@ streamnative_console: podLabels: {} podAnnotations: {} tolerations: [] + affinity: + anti_affinity: true + zone_anti_affinity: true + # Set the anti affinity type. Valid values: + # requiredDuringSchedulingIgnoredDuringExecution - rules must be met for pod to be scheduled (hard) requires at least one node per replica + # preferredDuringSchedulingIgnoredDuringExecution - scheduler will try to enforce but not guranentee + type: preferredDuringSchedulingIgnoredDuringExecution gracePeriod: 0 # Resources requests/limits for both init containers and app containers # See https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#resources