From 26e818896bc082ea2a780538dc4c27869f7dde44 Mon Sep 17 00:00:00 2001 From: ericsyh Date: Tue, 26 Nov 2024 13:35:59 +0800 Subject: [PATCH 1/5] fix: support some missting configs Signed-off-by: ericsyh --- .../templates/grafana/grafana-deployment.yaml | 2 ++ .../streamnative-console-initialize.yaml | 3 +++ .../streamnative-console-statefulset.yaml | 2 ++ charts/sn-platform-slim/values.yaml | 16 +++++++++++++++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml b/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml index 33073324e..d32bd09f5 100644 --- a/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml +++ b/charts/sn-platform-slim/templates/grafana/grafana-deployment.yaml @@ -50,6 +50,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 70395e616..02970a562 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 @@ -21,6 +21,9 @@ 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 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 610b6815a..0d32258ef 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 @@ -288,6 +288,8 @@ spec: {{- if .Values.streamnative_console.serviceAccount.use }} serviceAccountName: {{ template "pulsar.streamnative_console.serviceAccount" . }} {{- 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 or .Values.streamnative_console.volumes.data.storageClass .Values.streamnative_console.volumes.data.storageClassName }} volumeClaimTemplates: - metadata: diff --git a/charts/sn-platform-slim/values.yaml b/charts/sn-platform-slim/values.yaml index 5bf2d1ce8..6015d527d 100644 --- a/charts/sn-platform-slim/values.yaml +++ b/charts/sn-platform-slim/values.yaml @@ -1703,7 +1703,6 @@ prometheus: requests: memory: 256Mi cpu: 0.1 - # Definition of the serviceAccount used to run brokers. affinity: anti_affinity: true zone_anti_affinity: true @@ -1711,6 +1710,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 @@ -1863,6 +1863,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 @@ -2018,6 +2025,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 From 50cccb65033db271800a91ce9d61a238befc0500 Mon Sep 17 00:00:00 2001 From: ericsyh Date: Tue, 26 Nov 2024 13:41:33 +0800 Subject: [PATCH 2/5] update Signed-off-by: ericsyh --- .../streamnative-console-initialize.yaml | 5 +++++ .../streamnative-console-statefulset.yaml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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 02970a562..ca9fb8a67 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 @@ -24,6 +24,11 @@ spec: {{- 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 0d32258ef..e1d23068b 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 @@ -52,6 +52,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: @@ -288,8 +290,6 @@ spec: {{- if .Values.streamnative_console.serviceAccount.use }} serviceAccountName: {{ template "pulsar.streamnative_console.serviceAccount" . }} {{- 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 or .Values.streamnative_console.volumes.data.storageClass .Values.streamnative_console.volumes.data.storageClassName }} volumeClaimTemplates: - metadata: From d559deee53bd4a32129b1a8e2079941c2b3c3e81 Mon Sep 17 00:00:00 2001 From: ericsyh Date: Tue, 26 Nov 2024 13:47:39 +0800 Subject: [PATCH 3/5] apply on sn-platform Signed-off-by: ericsyh --- .../templates/grafana/grafana-statefulset.yaml | 2 ++ .../streamnative-console-initialize.yaml | 9 +++++++++ .../streamnative-console-statefulset.yaml | 2 ++ charts/sn-platform/values.yaml | 16 +++++++++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml index 99683f0c2..1856c21c8 100644 --- a/charts/sn-platform/templates/grafana/grafana-statefulset.yaml +++ b/charts/sn-platform/templates/grafana/grafana-statefulset.yaml @@ -48,6 +48,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 50fe8e388..885c3c4d7 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml @@ -21,6 +21,15 @@ 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 }} {{- 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 8a0fdb33d..503af6cbc 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-statefulset.yaml @@ -52,6 +52,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/values.yaml b/charts/sn-platform/values.yaml index f1b49c361..92b9e3638 100644 --- a/charts/sn-platform/values.yaml +++ b/charts/sn-platform/values.yaml @@ -1784,7 +1784,6 @@ prometheus: requests: memory: 256Mi cpu: 0.1 - # Definition of the serviceAccount used to run brokers. affinity: anti_affinity: true zone_anti_affinity: true @@ -1792,6 +1791,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 @@ -1944,6 +1944,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: @@ -2097,6 +2104,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 From 53402f763c6e583a106a46872d7927712f51a7b4 Mon Sep 17 00:00:00 2001 From: ericsyh Date: Tue, 26 Nov 2024 13:51:36 +0800 Subject: [PATCH 4/5] support vault init jobs Signed-off-by: ericsyh --- .../vault/vault-initialize-public-key.yaml | 13 +++++++++++++ .../templates/vault/vault-initialize.yaml | 10 ++++++++++ 2 files changed, 23 insertions(+) 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 4139a306b..017b17ac4 100644 --- a/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml +++ b/charts/sn-platform/templates/vault/vault-initialize-public-key.yaml @@ -26,6 +26,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 02e6a2f62..6a71986a6 100644 --- a/charts/sn-platform/templates/vault/vault-initialize.yaml +++ b/charts/sn-platform/templates/vault/vault-initialize.yaml @@ -29,6 +29,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 }}" From 7013d39594e17415f0f70ce7d045d21bf7e264a4 Mon Sep 17 00:00:00 2001 From: ericsyh Date: Tue, 17 Dec 2024 14:47:11 +0800 Subject: [PATCH 5/5] fix lint Signed-off-by: ericsyh --- .../streamnative-console/streamnative-console-initialize.yaml | 1 - 1 file changed, 1 deletion(-) 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 885c3c4d7..8e642323b 100644 --- a/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml +++ b/charts/sn-platform/templates/streamnative-console/streamnative-console-initialize.yaml @@ -30,7 +30,6 @@ spec: 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 }} - {{- if not .Values.istio.enabled }} initContainers: # This init container will wait for broker to be ready before # deploying the pulsar manager init job