Add chart starrocks/1.11.0

This commit is contained in:
wbsong111
2025-08-20 15:06:46 +09:00
parent efb5adc639
commit dac8dfa310
16 changed files with 3423 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
{{- if .Values.metrics.serviceMonitor.enabled }}
{{- if not (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
ERROR: Installation of the ServiceMonitor CR for the Prometheus operator failed. Please ensure it is installed beforehand.
{{- end }}
{{- end }}
Thank you for installing {{ .Chart.Name }}-{{ .Chart.Version }} starrocks chart. Please wait for a few minutes for the cluster to be ready.
Please see the values.yaml for more operation information: https://github.com/StarRocks/starrocks-kubernetes-operator/blob/main/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml
+743
View File
@@ -0,0 +1,743 @@
{{/*
Common labels
*/}}
{{- define "starrockscluster.labels" -}}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
initpassword secret name
*/}}
{{- define "starrockscluster.initpassword.secret.name" -}}
{{ default (print (include "starrockscluster.name" .) "-credential") .Values.initPassword.passwordSecret }}
{{- end }}
{{/*
starrockscluster
*/}}
{{- define "starrockscluster.name" -}}
{{ default (default .Chart.Name .Values.nameOverride) .Values.starrocksCluster.name }}
{{- end }}
{{- define "starrockscluster.namespace" -}}
{{ default .Release.Namespace .Values.starrocksCluster.namespace }}
{{- end }}
{{- define "starrockscluster.fe.name" -}}
{{- print (include "starrockscluster.name" .) "-fe" }}
{{- end }}
{{- define "starrockscluster.cn.name" -}}
{{- print (include "starrockscluster.name" .) "-cn" }}
{{- end }}
{{- define "starrockscluster.be.name" -}}
{{- print (include "starrockscluster.name" .) "-be" }}
{{- end }}
{{- define "starrockscluster.be.configmap.name" -}}
{{- print (include "starrockscluster.be.name" .) "-cm" }}
{{- end }}
{{- define "starrockscluster.fe.configmap.name" -}}
{{- print (include "starrockscluster.fe.name" .) "-cm" }}
{{- end }}
{{- define "starrockscluster.cn.configmap.name" -}}
{{- print (include "starrockscluster.cn.name" .) "-cm" }}
{{- end }}
{{- define "starrockscluster.fe.config" -}}
fe.conf: |
{{- if and .Values.starrocksFESpec.configyaml (kindIs "map" .Values.starrocksFESpec.configyaml) }}
{{- range $key, $value := .Values.starrocksFESpec.configyaml }}
{{ $key }} = {{ $value }}
{{- end }}
{{- else if .Values.starrocksFESpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else }}
{{- .Values.starrocksFESpec.config | nindent 2 }}
{{- end }}
{{- end }}
{{- define "starrockscluster.cn.config" -}}
cn.conf: |
{{- if and .Values.starrocksCnSpec.configyaml (kindIs "map" .Values.starrocksCnSpec.configyaml) }}
{{- range $key, $value := .Values.starrocksCnSpec.configyaml }}
{{ $key }} = {{ $value }}
{{- end }}
{{- else if .Values.starrocksCnSpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else }}
{{- .Values.starrocksCnSpec.config | nindent 2 }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.config" -}}
be.conf: |
{{- if and .Values.starrocksBeSpec.configyaml (kindIs "map" .Values.starrocksBeSpec.configyaml) }}
{{- range $key, $value := .Values.starrocksBeSpec.configyaml }}
{{ $key }} = {{ $value }}
{{- end }}
{{- else if .Values.starrocksBeSpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else }}
{{- .Values.starrocksBeSpec.config | nindent 2 }}
{{- end }}
{{- end }}
{{- define "starrockscluster.fe.meta.suffix" -}}
{{- print "-meta" }}
{{- end }}
{{- define "starrockscluster.fe.meta.path" -}}
{{- if .Values.starrocksFESpec.storageSpec.storageMountPath }}
{{- print .Values.starrocksFESpec.storageSpec.storageMountPath }}
{{- else }}
{{- print "/opt/starrocks/fe/meta" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.fe.log.suffix" -}}
{{- print "-log" }}
{{- end }}
{{- define "starrockscluster.fe.log.path" -}}
{{- if .Values.starrocksFESpec.storageSpec.logMountPath }}
{{- print .Values.starrocksFESpec.storageSpec.logMountPath }}
{{- else }}
{{- print "/opt/starrocks/fe/log" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.data.suffix" -}}
{{- print "-data" }}
{{- end }}
{{- define "starrockscluster.be.data.path" -}}
{{- if .Values.starrocksBeSpec.storageSpec.storageMountPath }}
{{- print .Values.starrocksBeSpec.storageSpec.storageMountPath }}
{{- else }}
{{- print "/opt/starrocks/be/storage" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.log.suffix" -}}
{{- print "-log" }}
{{- end }}
{{- define "starrockscluster.be.log.path" -}}
{{- if .Values.starrocksBeSpec.storageSpec.logMountPath }}
{{- print .Values.starrocksBeSpec.storageSpec.logMountPath }}
{{- else }}
{{- print "/opt/starrocks/be/log" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.spill.suffix" -}}
{{- print "-spill" }}
{{- end }}
{{- define "starrockscluster.be.spill.path" -}}
{{- if .Values.starrocksBeSpec.storageSpec.spillMountPath }}
{{- print .Values.starrocksBeSpec.storageSpec.spillMountPath }}
{{- else }}
{{- print "/opt/starrocks/be/spill" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.cn.data.suffix" -}}
{{- print "-data" }}
{{- end }}
{{- define "starrockscluster.cn.data.path" -}}
{{- if .Values.starrocksCnSpec.storageSpec.storageMountPath }}
{{- print .Values.starrocksCnSpec.storageSpec.storageMountPath }}
{{- else }}
{{- print "/opt/starrocks/cn/storage" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.cn.log.suffix" -}}
{{- print "-log" }}
{{- end }}
{{- define "starrockscluster.cn.log.path" -}}
{{- if .Values.starrocksCnSpec.storageSpec.logMountPath }}
{{- print .Values.starrocksCnSpec.storageSpec.logMountPath }}
{{- else }}
{{- print "/opt/starrocks/cn/log" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.cn.spill.suffix" -}}
{{- print "-spill" }}
{{- end }}
{{- define "starrockscluster.cn.spill.path" -}}
{{- if .Values.starrocksCnSpec.storageSpec.spillMountPath }}
{{- print .Values.starrocksCnSpec.storageSpec.spillMountPath }}
{{- else }}
{{- print "/opt/starrocks/cn/spill" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.entrypoint.script.name" -}}
{{- print "entrypoint.sh" }}
{{- end }}
{{- define "starrockscluster.entrypoint.mount.path" -}}
{{- print "/etc/starrocks" }}
{{- end }}
{{- define "starrockscluster.fe.entrypoint.script.configmap.name" -}}
{{- print (include "starrockscluster.name" .) "-fe-entrypoint-script" }}
{{- end }}
{{- define "starrockscluster.be.entrypoint.script.configmap.name" -}}
{{- print (include "starrockscluster.name" .) "-be-entrypoint-script" }}
{{- end }}
{{- define "starrockscluster.cn.entrypoint.script.configmap.name" -}}
{{- print (include "starrockscluster.name" .) "-cn-entrypoint-script" }}
{{- end }}
{{/*
Define a function to handle resource limits for fe
*/}}
{{- define "starrockscluster.fe.resources" -}}
requests:
{{- toYaml .Values.starrocksFESpec.resources.requests | nindent 2 }}
limits:
{{- range $key, $value := .Values.starrocksFESpec.resources.limits }}
{{- if ne (toString $value) "unlimited" }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Define a function to handle resource limits for be
*/}}
{{- define "starrockscluster.be.resources" -}}
requests:
{{- toYaml .Values.starrocksBeSpec.resources.requests | nindent 2 }}
limits:
{{- range $key, $value := .Values.starrocksBeSpec.resources.limits }}
{{- if ne (toString $value) "unlimited" }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
Define a function to handle resource limits for cn
*/}}
{{- define "starrockscluster.cn.resources" -}}
requests:
{{- toYaml .Values.starrocksCnSpec.resources.requests | nindent 2 }}
limits:
{{- range $key, $value := .Values.starrocksCnSpec.resources.limits }}
{{- if ne (toString $value) "unlimited" }}
{{ $key }}: {{ $value }}
{{- end }}
{{- end }}
{{- end -}}
{{/*
starrockscluster.fe.config.hash is used to calculate the hash value of the fe.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.fe.config.hash" }}
{{- if and .Values.starrocksFESpec.configyaml (kindIs "map" .Values.starrocksFESpec.configyaml) }}
{{- $hash := toJson .Values.starrocksFESpec.configyaml | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else if .Values.starrocksFESpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else if .Values.starrocksFESpec.config }}
{{- $hash := toJson .Values.starrocksFESpec.config | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{/*
starrockscluster.be.config.hash is used to calculate the hash value of the be.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.be.config.hash" }}
{{- if and .Values.starrocksBeSpec.configyaml (kindIs "map" .Values.starrocksBeSpec.configyaml) }}
{{- $hash := toJson .Values.starrocksBeSpec.configyaml | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else if .Values.starrocksBeSpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else if .Values.starrocksBeSpec.config }}
{{- $hash := toJson .Values.starrocksBeSpec.config | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{/*
starrockscluster.cn.config.hash is used to calculate the hash value of the cn.conf, and due to the length limit, only
the first 8 digits are taken, which will be used as the annotations for pods.
*/}}
{{- define "starrockscluster.cn.config.hash" }}
{{- if and .Values.starrocksCnSpec.configyaml (kindIs "map" .Values.starrocksCnSpec.configyaml) }}
{{- $hash := toJson .Values.starrocksCnSpec.configyaml | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else if .Values.starrocksCnSpec.configyaml }}
{{ fail "configyaml must be a map" }}
{{- else if .Values.starrocksCnSpec.config }}
{{- $hash := toJson .Values.starrocksCnSpec.config | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.fe.query.port" -}}
{{- $config := index .Values.starrocksFESpec.config -}}
{{- $configMap := dict -}}
{{- range $line := splitList "\n" $config -}}
{{- $pair := splitList "=" $line -}}
{{- if eq (len $pair) 2 -}}
{{- $_ := set $configMap (trim (index $pair 0)) (trim (index $pair 1)) -}}
{{- end -}}
{{- end -}}
{{- if (index $configMap "query_port") -}}
{{- print (index $configMap "query_port") }}
{{- end }}
{{- end }}
{{- define "starrockscluster.fe.entrypoint.script.hash" }}
{{- if .Values.starrocksFESpec.entrypoint }}
{{- $hash := toJson .Values.starrocksFESpec.entrypoint.script | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.entrypoint.script.hash" }}
{{- if .Values.starrocksBeSpec.entrypoint }}
{{- $hash := toJson .Values.starrocksBeSpec.entrypoint.script | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.cn.entrypoint.script.hash" }}
{{- if .Values.starrocksCnSpec.entrypoint }}
{{- $hash := toJson .Values.starrocksCnSpec.entrypoint.script | sha256sum | trunc 8 }}
{{- printf "%s" $hash }}
{{- else }}
{{- printf "no-config" }}
{{- end }}
{{- end }}
{{- define "starrockscluster.fe.http.port" -}}
{{- $config := index .Values.starrocksFESpec.config -}}
{{- $configMap := dict -}}
{{- range $line := splitList "\n" $config -}}
{{- $pair := splitList "=" $line -}}
{{- if eq (len $pair) 2 -}}
{{- $_ := set $configMap (trim (index $pair 0)) (trim (index $pair 1)) -}}
{{- end -}}
{{- end -}}
{{- if (index $configMap "http_port") -}}
{{- print (index $configMap "http_port") }}
{{- end }}
{{- end }}
{{- define "starrockscluster.be.webserver.port" -}}
{{- include "starrockscluster.webserver.port" .Values.starrocksBeSpec }}
{{- end }}
{{- define "starrockscluster.cn.webserver.port" -}}
{{- include "starrockscluster.webserver.port" .Values.starrocksCnSpec }}
{{- end }}
{{- define "starrockscluster.webserver.port" -}}
{{- $config := index .config -}}
{{- $configMap := dict -}}
{{- range $line := splitList "\n" $config -}}
{{- $pair := splitList "=" $line -}}
{{- if eq (len $pair) 2 -}}
{{- $_ := set $configMap (trim (index $pair 0)) (trim (index $pair 1)) -}}
{{- end -}}
{{- end -}}
{{- if (index $configMap "webserver_port") -}}
{{- print (index $configMap "webserver_port") }}
{{- end }}
{{- end }}
{{/*
Get the value of the schedulerName field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.schedulerName" -}}
{{- if .Values.starrocksFESpec.schedulerName -}}
{{- .Values.starrocksFESpec.schedulerName -}}
{{- else if .Values.starrocksCluster.componentValues.schedulerName -}}
{{- .Values.starrocksCluster.componentValues.schedulerName -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the schedulerName field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.schedulerName" -}}
{{- if .Values.starrocksBeSpec.schedulerName -}}
{{- .Values.starrocksBeSpec.schedulerName -}}
{{- else if .Values.starrocksCluster.componentValues.schedulerName -}}
{{- .Values.starrocksCluster.componentValues.schedulerName -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the schedulerName field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.schedulerName" -}}
{{- if .Values.starrocksCnSpec.schedulerName -}}
{{- .Values.starrocksCnSpec.schedulerName -}}
{{- else if .Values.starrocksCluster.componentValues.schedulerName -}}
{{- .Values.starrocksCluster.componentValues.schedulerName -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the serviceAccount field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.serviceAccount" -}}
{{- if .Values.starrocksFESpec.serviceAccount -}}
{{- .Values.starrocksFESpec.serviceAccount -}}
{{- else if .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the serviceAccount field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.serviceAccount" -}}
{{- if .Values.starrocksBeSpec.serviceAccount -}}
{{- .Values.starrocksBeSpec.serviceAccount -}}
{{- else if .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the serviceAccount field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.serviceAccount" -}}
{{- if .Values.starrocksCnSpec.serviceAccount -}}
{{- .Values.starrocksCnSpec.serviceAccount -}}
{{- else if .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- .Values.starrocksCluster.componentValues.serviceAccount -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the imagePullSecrets field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.imagePullSecrets" -}}
{{- if .Values.starrocksFESpec.imagePullSecrets -}}
{{- toYaml .Values.starrocksFESpec.imagePullSecrets -}}
{{- else if .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- toYaml .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the imagePullSecrets field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.imagePullSecrets" -}}
{{- if .Values.starrocksBeSpec.imagePullSecrets -}}
{{- toYaml .Values.starrocksBeSpec.imagePullSecrets -}}
{{- else if .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- toYaml .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the imagePullSecrets field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.imagePullSecrets" -}}
{{- if .Values.starrocksCnSpec.imagePullSecrets -}}
{{- toYaml .Values.starrocksCnSpec.imagePullSecrets -}}
{{- else if .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- toYaml .Values.starrocksCluster.componentValues.imagePullSecrets -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the tolerations field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.tolerations" -}}
{{- if .Values.starrocksFESpec.tolerations -}}
{{- toYaml .Values.starrocksFESpec.tolerations -}}
{{- else if .Values.starrocksCluster.componentValues.tolerations -}}
{{- toYaml .Values.starrocksCluster.componentValues.tolerations -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the tolerations field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.tolerations" -}}
{{- if .Values.starrocksBeSpec.tolerations -}}
{{- toYaml .Values.starrocksBeSpec.tolerations -}}
{{- else if .Values.starrocksCluster.componentValues.tolerations -}}
{{- toYaml .Values.starrocksCluster.componentValues.tolerations -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the tolerations field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.tolerations" -}}
{{- if .Values.starrocksCnSpec.tolerations -}}
{{- toYaml .Values.starrocksCnSpec.tolerations -}}
{{- else if .Values.starrocksCluster.componentValues.tolerations -}}
{{- toYaml .Values.starrocksCluster.componentValues.tolerations -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the nodeSelector field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.nodeSelector" -}}
{{- if .Values.starrocksFESpec.nodeSelector -}}
{{- toYaml .Values.starrocksFESpec.nodeSelector -}}
{{- else if .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- toYaml .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the nodeSelector field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.nodeSelector" -}}
{{- if .Values.starrocksBeSpec.nodeSelector -}}
{{- toYaml .Values.starrocksBeSpec.nodeSelector -}}
{{- else if .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- toYaml .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the nodeSelector field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.nodeSelector" -}}
{{- if .Values.starrocksCnSpec.nodeSelector -}}
{{- toYaml .Values.starrocksCnSpec.nodeSelector -}}
{{- else if .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- toYaml .Values.starrocksCluster.componentValues.nodeSelector -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the affinity field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.affinity" -}}
{{- if .Values.starrocksFESpec.affinity -}}
{{- toYaml .Values.starrocksFESpec.affinity -}}
{{- else if .Values.starrocksCluster.componentValues.affinity -}}
{{- toYaml .Values.starrocksCluster.componentValues.affinity -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the affinity field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.affinity" -}}
{{- if .Values.starrocksBeSpec.affinity -}}
{{- toYaml .Values.starrocksBeSpec.affinity -}}
{{- else if .Values.starrocksCluster.componentValues.affinity -}}
{{- toYaml .Values.starrocksCluster.componentValues.affinity -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the affinity field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.affinity" -}}
{{- if .Values.starrocksCnSpec.affinity -}}
{{- toYaml .Values.starrocksCnSpec.affinity -}}
{{- else if .Values.starrocksCluster.componentValues.affinity -}}
{{- toYaml .Values.starrocksCluster.componentValues.affinity -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the topologySpreadConstraints field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.topologySpreadConstraints" -}}
{{- if .Values.starrocksFESpec.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksFESpec.topologySpreadConstraints -}}
{{- else if .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the topologySpreadConstraints field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.topologySpreadConstraints" -}}
{{- if .Values.starrocksBeSpec.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksBeSpec.topologySpreadConstraints -}}
{{- else if .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the topologySpreadConstraints field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.topologySpreadConstraints" -}}
{{- if .Values.starrocksCnSpec.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksCnSpec.topologySpreadConstraints -}}
{{- else if .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- toYaml .Values.starrocksCluster.componentValues.topologySpreadConstraints -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the runAsNonRoot field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.runAsNonRoot" -}}
{{- if .Values.starrocksFESpec.runAsNonRoot -}}
{{- .Values.starrocksFESpec.runAsNonRoot -}}
{{- else if .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the runAsNonRoot field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.runAsNonRoot" -}}
{{- if .Values.starrocksBeSpec.runAsNonRoot -}}
{{- .Values.starrocksBeSpec.runAsNonRoot -}}
{{- else if .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of the runAsNonRoot field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.runAsNonRoot" -}}
{{- if .Values.starrocksCnSpec.runAsNonRoot -}}
{{- .Values.starrocksCnSpec.runAsNonRoot -}}
{{- else if .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- .Values.starrocksCluster.componentValues.runAsNonRoot -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of hostAliases field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.hostAliases" -}}
{{- if .Values.starrocksFESpec.hostAliases -}}
{{- toYaml .Values.starrocksFESpec.hostAliases -}}
{{- else if .Values.starrocksCluster.componentValues.hostAliases -}}
{{- toYaml .Values.starrocksCluster.componentValues.hostAliases -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of hostAliases field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.hostAliases" -}}
{{- if .Values.starrocksBeSpec.hostAliases -}}
{{- toYaml .Values.starrocksBeSpec.hostAliases -}}
{{- else if .Values.starrocksCluster.componentValues.hostAliases -}}
{{- toYaml .Values.starrocksCluster.componentValues.hostAliases -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of hostAliases field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.hostAliases" -}}
{{- if .Values.starrocksCnSpec.hostAliases -}}
{{- toYaml .Values.starrocksCnSpec.hostAliases -}}
{{- else if .Values.starrocksCluster.componentValues.hostAliases -}}
{{- toYaml .Values.starrocksCluster.componentValues.hostAliases -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of tag field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.image.tag" -}}
{{- if .Values.starrocksFESpec.image.tag -}}
{{- .Values.starrocksFESpec.image.tag -}}
{{- else if .Values.starrocksCluster.componentValues.image.tag -}}
{{- .Values.starrocksCluster.componentValues.image.tag -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of tag field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.image.tag" -}}
{{- if .Values.starrocksBeSpec.image.tag -}}
{{- .Values.starrocksBeSpec.image.tag -}}
{{- else if .Values.starrocksCluster.componentValues.image.tag -}}
{{- .Values.starrocksCluster.componentValues.image.tag -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of tag field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.image.tag" -}}
{{- if .Values.starrocksCnSpec.image.tag -}}
{{- .Values.starrocksCnSpec.image.tag -}}
{{- else if .Values.starrocksCluster.componentValues.image.tag -}}
{{- .Values.starrocksCluster.componentValues.image.tag -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of podLabels field in the starrocksFESpec
*/}}
{{- define "starrockscluster.fe.podLabels" -}}
{{- if .Values.starrocksFESpec.podLabels -}}
{{- toYaml .Values.starrocksFESpec.podLabels -}}
{{- else if .Values.starrocksCluster.componentValues.podLabels -}}
{{- toYaml .Values.starrocksCluster.componentValues.podLabels -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of podLabels field in the starrocksBeSpec
*/}}
{{- define "starrockscluster.be.podLabels" -}}
{{- if .Values.starrocksBeSpec.podLabels -}}
{{- toYaml .Values.starrocksBeSpec.podLabels -}}
{{- else if .Values.starrocksCluster.componentValues.podLabels -}}
{{- toYaml .Values.starrocksCluster.componentValues.podLabels -}}
{{- end -}}
{{- end -}}
{{/*
Get the value of podLabels field in the starrocksCnSpec
*/}}
{{- define "starrockscluster.cn.podLabels" -}}
{{- if .Values.starrocksCnSpec.podLabels -}}
{{- toYaml .Values.starrocksCnSpec.podLabels -}}
{{- else if .Values.starrocksCluster.componentValues.podLabels -}}
{{- toYaml .Values.starrocksCluster.componentValues.podLabels -}}
{{- end -}}
{{- end -}}
@@ -0,0 +1,14 @@
{{- if and .Values.starrocksCluster.enabledBe .Values.starrocksBeSpec .Values.starrocksBeSpec.config }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.be.configmap.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
app: "be"
data:
{{- include "starrockscluster.be.config" . | nindent 2 }}
{{- end }}
@@ -0,0 +1,13 @@
{{- if and .Values.starrocksCluster.enabledCn .Values.starrocksCnSpec .Values.starrocksCnSpec.config }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.cn.configmap.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
app: "cn"
data:
{{- include "starrockscluster.cn.config" . | nindent 2 }}
{{- end }}
@@ -0,0 +1,50 @@
{{- range .Values.configMaps }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .name }}
data:
{{- range $key, $value := .data }}
{{- if $value }}
{{ $key }}: |
{{- $value | nindent 4 }}
{{- end }}
{{- end }}
---
{{- end }}
---
{{- if .Values.starrocksFESpec.entrypoint }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.fe.entrypoint.script.configmap.name" .}}
data:
{{ template "starrockscluster.entrypoint.script.name" .}}: |
{{- .Values.starrocksFESpec.entrypoint.script | nindent 4 }}
{{- end }}
---
{{- if .Values.starrocksBeSpec.entrypoint }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.be.entrypoint.script.configmap.name" .}}
data:
{{ template "starrockscluster.entrypoint.script.name" .}}: |
{{- .Values.starrocksBeSpec.entrypoint.script | nindent 4 }}
{{- end }}
---
{{- if .Values.starrocksCnSpec.entrypoint }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.cn.entrypoint.script.configmap.name" .}}
data:
{{ template "starrockscluster.entrypoint.script.name" .}}: |
{{- .Values.starrocksCnSpec.entrypoint.script | nindent 4 }}
{{- end }}
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.fe.configmap.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
app: "fe"
data:
{{- include "starrockscluster.fe.config" . | nindent 2 }}
@@ -0,0 +1,44 @@
{{- if .Values.initPassword.enabled }}
{{- if not .Values.initPassword.passwordSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "starrockscluster.initpassword.secret.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
data:
password: {{ .Values.initPassword.password | b64enc }}
---
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "starrockscluster.name" . }}-initpwd-shell
namespace: {{ template "starrockscluster.namespace" . }}
data:
fe_initpwd.sh: |-
#!/bin/bash
# ensure `mysql` command can be ended with 30 seconds
# Change the root password during initial installation
init_pwd_sql="SET PASSWORD = PASSWORD('$INIT_PWD');"
success=`mysql --connect-timeout 30 -h $1 -P $2 -u root --skip-column-names --batch -e "$init_pwd_sql" 2>&1`
if [ $? -ne 0 ] ; then
echo $success
errcode=`echo $success | awk -F " " '{print $2}'`
echo "error code: $errcode"
# Password error, believed to have been changed, exiting normally
if [[ $errcode = '1045' || $errcode = '1064' ]] ; then
echo "Password error, believed to have been changed, exiting normally"
exit 0
fi
# Other unsuccessful errors, abnormal exit
echo "Other unsuccessful errors, abnormal exit"
exit 1
fi
echo "Successfully modified password"
exit 0
{{- end }}
@@ -0,0 +1,71 @@
{{- if and .Values.initPassword.enabled .Values.initPassword.isInstall .Release.IsInstall }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "starrockscluster.name" . }}-initpwd
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
{{- if .Values.initPassword.annotations }}
annotations:
{{- toYaml .Values.initPassword.annotations | nindent 4 }}
{{- end }}
spec:
template:
{{- if .Values.initPassword.podAnnotations }}
metadata:
annotations:
{{- toYaml .Values.initPassword.podAnnotations | nindent 8 }}
{{- end }}
spec:
{{- if or .Values.starrocksFESpec.imagePullSecrets .Values.starrocksCluster.componentValues.imagePullSecrets }}
imagePullSecrets:
{{- include "starrockscluster.fe.imagePullSecrets" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.affinity .Values.starrocksCluster.componentValues.affinity }}
affinity:
{{- include "starrockscluster.fe.affinity" . | nindent 8 }}
{{- end }}
{{- if or .Values.starrocksFESpec.tolerations .Values.starrocksCluster.componentValues.tolerations }}
tolerations:
{{- include "starrockscluster.fe.tolerations" . | nindent 8 }}
{{- end }}
containers:
- name: {{ template "starrockscluster.name" . }}-initpwd
{{- if .Values.initPassword.image }}
image: {{ .Values.initPassword.image }}
{{- else }}
image: {{ .Values.starrocksFESpec.image.repository }}:{{ include "starrockscluster.fe.image.tag" . }}
{{- end }}
imagePullPolicy: IfNotPresent
{{- if .Values.initPassword.resources }}
resources: {{- toYaml .Values.initPassword.resources | nindent 10 }}
{{- end }}
command:
- /bin/bash
args:
- /opt/starrocks/fe_initpwd.sh
- {{ template "starrockscluster.name" . }}-fe-0.{{ template "starrockscluster.name" . }}-fe-search
- "{{- default 9030 (include "starrockscluster.fe.query.port" .) }}"
env:
- name: INIT_PWD
valueFrom:
secretKeyRef:
key: password
name: {{ template "starrockscluster.initpassword.secret.name" . }}
volumeMounts:
- mountPath: /opt/starrocks/fe_initpwd.sh
name: {{ template "starrockscluster.name" . }}-initpwd-shell
subPath: fe_initpwd.sh
volumes:
- configMap:
defaultMode: 420
items:
- key: fe_initpwd.sh
path: fe_initpwd.sh
name: {{ template "starrockscluster.name" . }}-initpwd-shell
optional: false
name: {{ template "starrockscluster.name" . }}-initpwd-shell
restartPolicy: OnFailure
backoffLimit: 10
{{- end }}
@@ -0,0 +1,4 @@
{{- range .Values.resources }}
{{- toYaml . | nindent 0 }}
---
{{- end }}
+14
View File
@@ -0,0 +1,14 @@
{{- range .Values.secrets }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .name }}
type: Opaque
data:
{{- range $key, $value := .data }}
{{- if $value }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
{{- end }}
---
{{- end }}
@@ -0,0 +1,112 @@
{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "starrockscluster.fe.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
path: /metrics
{{- if .Values.metrics.serviceMonitor.basicAuth.enabled }}
basicAuth:
username:
name: {{ .Values.metrics.serviceMonitor.basicAuth.usernameSecretName }}
key: {{ .Values.metrics.serviceMonitor.basicAuth.usernameSecretKey }}
password:
name: {{ .Values.metrics.serviceMonitor.basicAuth.passwordSecretName }}
key: {{ .Values.metrics.serviceMonitor.basicAuth.passwordSecretKey }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.endpointParam.enabled }}
params:
{{- toYaml .Values.metrics.serviceMonitor.endpointParam.params | nindent 8 }}
{{- end }}
relabelings:
- sourceLabels: [__meta_kubernetes_endpoints_label_app_starrocks_ownerreference_name]
targetLabel: app_starrocks_ownerreference_name
- sourceLabels: [__meta_kubernetes_service_label_app_kubernetes_io_component]
targetLabel: app_kubernetes_io_component
namespaceSelector:
matchNames:
- {{ template "starrockscluster.namespace" . }}
selector:
matchLabels:
app.starrocks.ownerreference/name: {{ template "starrockscluster.name" . }}
app.kubernetes.io/component: fe
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "starrockscluster.be.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: webserver
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
path: /metrics
relabelings:
- sourceLabels: [__meta_kubernetes_endpoints_label_app_starrocks_ownerreference_name]
targetLabel: app_starrocks_ownerreference_name
- sourceLabels: [__meta_kubernetes_service_label_app_kubernetes_io_component]
targetLabel: app_kubernetes_io_component
namespaceSelector:
matchNames:
- {{ template "starrockscluster.namespace" . }}
selector:
matchLabels:
app.starrocks.ownerreference/name: {{ template "starrockscluster.name" . }}
app.kubernetes.io/component: be
---
{{- if .Values.starrocksCluster.enabledCn }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "starrockscluster.cn.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: webserver
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
path: /metrics
relabelings:
- sourceLabels: [__meta_kubernetes_endpoints_label_app_starrocks_ownerreference_name]
targetLabel: app_starrocks_ownerreference_name
- sourceLabels: [__meta_kubernetes_service_label_app_kubernetes_io_component]
targetLabel: app_kubernetes_io_component
namespaceSelector:
matchNames:
- {{ template "starrockscluster.namespace" . }}
selector:
matchLabels:
app.starrocks.ownerreference/name: {{ template "starrockscluster.name" . }}
app.kubernetes.io/component: cn
{{- end }}
{{- end }}
@@ -0,0 +1,959 @@
apiVersion: starrocks.com/v1
kind: StarRocksCluster
metadata:
name: {{ template "starrockscluster.name" . }}
namespace: {{ template "starrockscluster.namespace" . }}
labels:
cluster: {{ template "starrockscluster.name" . }}
{{- include "starrockscluster.labels" . | nindent 4 }}
{{- if .Values.starrocksCluster.annotations }}
annotations:
{{- toYaml .Values.starrocksCluster.annotations | nindent 4 }}
{{- end }}
spec:
{{- if .Values.starrocksCluster.disasterRecovery }}
disasterRecovery:
{{- toYaml .Values.starrocksCluster.disasterRecovery | nindent 4 }}
{{- end }}
starRocksFeSpec:
{{- if .Values.starrocksFESpec.initContainers }}
initContainers:
{{- toYaml .Values.starrocksFESpec.initContainers | nindent 6 }}
{{- end }}
{{- if .Values.starrocksFESpec.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.starrocksFESpec.shareProcessNamespace }}
{{- end }}
image: "{{ .Values.starrocksFESpec.image.repository }}:{{ include "starrockscluster.fe.image.tag" . }}"
{{- if .Values.starrocksFESpec.entrypoint }}
command: ["bash", "-c"]
args:
- {{template "starrockscluster.entrypoint.mount.path" .}}/{{template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
replicas: {{ .Values.starrocksFESpec.replicas }}
imagePullPolicy: {{ .Values.starrocksFESpec.imagePullPolicy }}
{{- if .Values.starrocksFESpec.maxUnavailablePods }}
updateStrategy:
rollingUpdate:
maxUnavailable: {{ .Values.starrocksFESpec.maxUnavailablePods }}
{{- end }}
{{- /*
support both resources and resource for backward compatibility
*/}}
{{- if .Values.starrocksFESpec.resources }}
{{- include "starrockscluster.fe.resources" . | nindent 4 }}
{{- else if .Values.starrocksFESpec.resource }}
{{- toYaml .Values.starrocksFESpec.resource | nindent 4 }}
{{- end }}
{{- if .Values.starrocksFESpec.service.type }}
service:
type: {{ .Values.starrocksFESpec.service.type }}
{{- if and (eq "LoadBalancer" .Values.starrocksFESpec.service.type) .Values.starrocksFESpec.service.loadbalancerIP }}
loadBalancerIP: {{ .Values.starrocksFESpec.service.loadbalancerIP }}
{{- end }}
{{- if and (eq "LoadBalancer" .Values.starrocksFESpec.service.type) .Values.starrocksFESpec.service.loadBalancerSourceRanges}}
loadBalancerSourceRanges:
{{- toYaml .Values.starrocksFESpec.service.loadBalancerSourceRanges | nindent 8 }}
{{- end }}
{{- if .Values.starrocksFESpec.service.ports }}
ports:
{{- toYaml .Values.starrocksFESpec.service.ports | nindent 8 }}
{{- end }}
{{- if or .Values.starrocksFESpec.service.annotations .Values.datadog.metrics.enabled }}
annotations:
{{- if .Values.datadog.metrics.enabled }}
prometheus.io/path: "/metrics"
prometheus.io/port: "{{- default 8030 (include "starrockscluster.fe.http.port" .) }}"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.starrocksFESpec.service.annotations}}
{{- toYaml .Values.starrocksFESpec.service.annotations | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.service.labels}}
labels:
{{- toYaml .Values.starrocksFESpec.service.labels | nindent 8 }}
{{- end }}
{{- end }}
annotations:
app.starrocks.io/fe-config-hash: "{{template "starrockscluster.fe.config.hash" . }}"
{{- if .Values.datadog.log.enabled }}
{{- if eq (trimAll " {}" .Values.datadog.log.logConfig) "" }}
ad.datadoghq.com/fe.logs: '[{"service":"starrocks","source":"fe"}]'
{{- else }}
ad.datadoghq.com/fe.logs: {{ printf "[%s]" (printf "{%s, \"source\": \"fe\", \"service\": \"starrocks\"}" (trimAll " {}" .Values.datadog.log.logConfig) | fromJson | toJson) | squote }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.entrypoint }}
app.starrocks.io/fe-entrypoint-hash: "{{ template "starrockscluster.fe.entrypoint.script.hash" . }}"
{{- end }}
{{- if .Values.starrocksFESpec.annotations }}
{{- toYaml .Values.starrocksFESpec.annotations | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.imagePullSecrets .Values.starrocksCluster.componentValues.imagePullSecrets }}
imagePullSecrets:
{{- include "starrockscluster.fe.imagePullSecrets" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.serviceAccount .Values.starrocksCluster.componentValues.serviceAccount }}
serviceAccount: {{ include "starrockscluster.fe.serviceAccount" . }}
{{- end }}
runAsNonRoot: {{ include "starrockscluster.fe.runAsNonRoot" . }}
{{- if .Values.starrocksFESpec.readOnlyRootFilesystem }}
readOnlyRootFilesystem: {{ .Values.starrocksFESpec.readOnlyRootFilesystem }}
{{- end }}
{{- if .Values.starrocksFESpec.capabilities }}
capabilities:
{{- toYaml .Values.starrocksFESpec.capabilities | nindent 6 }}
{{- end }}
{{- if .Values.starrocksFESpec.sysctls }}
sysctls:
{{- toYaml .Values.starrocksFESpec.sysctls | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.nodeSelector .Values.starrocksCluster.componentValues.nodeSelector }}
nodeSelector:
{{- include "starrockscluster.fe.nodeSelector" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.podLabels .Values.starrocksCluster.componentValues.podLabels .Values.datadog.profiling.fe }}
podLabels:
{{- if or .Values.starrocksFESpec.podLabels .Values.starrocksCluster.componentValues.podLabels }}
{{- include "starrockscluster.fe.podLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.datadog.profiling.fe }}
admission.datadoghq.com/config.mode: {{ .Values.datadog.profiling.configMode }}
admission.datadoghq.com/enabled: "true"
{{- end }}
{{- end }}
{{- if or .Values.starrocksFESpec.hostAliases .Values.starrocksCluster.componentValues.hostAliases }}
hostAliases:
{{- include "starrockscluster.fe.hostAliases" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.schedulerName .Values.starrocksCluster.componentValues.schedulerName }}
schedulerName: {{ include "starrockscluster.fe.schedulerName" . }}
{{- end }}
feEnvVars:
- name: TZ
value: {{ .Values.timeZone }}
{{- if .Values.datadog.log.enabled }}
- name: LOG_CONSOLE
value: "1"
{{- end }}
{{- if and .Values.initPassword.enabled (.Values.starrocksFESpec.feEnvVars | toJson | contains "MYSQL_PWD" | not) }}
- name: "MYSQL_PWD"
valueFrom:
secretKeyRef:
name: {{ template "starrockscluster.initpassword.secret.name" . }}
key: password
{{- end }}
{{- if .Values.datadog.profiling.fe }}
- name: ENABLE_DATADOG_PROFILE
value: "true"
- name: DD_PROFILING_ENABLED
value: "true"
- name: DD_SERVICE
value: starrocks-fe
- name: DD_ENV
value: "{{ .Values.datadog.profiling.env }}"
- name: DD_VERSION
value: "{{ include "starrockscluster.fe.image.tag" . }}"
- name: DD_PROFILING_DDPROF_ALLOC_ENABLED
value: "true"
- name: DD_PROFILING_DDPROF_ENABLED
value: "true"
- name: DD_PROFILING_DDPROF_LIVEHEAP_ENABLED
value: "true"
- name: DD_PROFILING_DIRECTALLOCATION_ENABLED
value: "true"
{{- end }}
{{- if .Values.starrocksFESpec.feEnvVars }}
{{- /* if it is a map, we use range to iterate to merge environment variables */}}
{{- if eq (kindOf .Values.starrocksFESpec.feEnvVars) "map" }}
{{- range $key, $value := .Values.starrocksFESpec.feEnvVars }}
- name: {{ $key }}
{{- if eq (kindOf $value) "string" }}
value: {{ $value | quote }}
{{- else }}
{{- toYaml $value | nindent 8 }}
{{- end }}
{{- end }}
{{- else }}
{{- /* the default kind is slice, we keep backward compatibility */}}
{{- toYaml .Values.starrocksFESpec.feEnvVars | nindent 6 }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksFESpec.affinity .Values.starrocksCluster.componentValues.affinity }}
affinity:
{{- include "starrockscluster.fe.affinity" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.tolerations .Values.starrocksCluster.componentValues.tolerations }}
tolerations:
{{- include "starrockscluster.fe.tolerations" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksFESpec.topologySpreadConstraints .Values.starrocksCluster.componentValues.topologySpreadConstraints }}
topologySpreadConstraints:
{{- include "starrockscluster.fe.topologySpreadConstraints" . | nindent 6 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.starrocksFESpec.terminationGracePeriodSeconds }}
{{- if .Values.starrocksFESpec.startupProbeFailureSeconds }}
startupProbeFailureSeconds: {{ .Values.starrocksFESpec.startupProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksFESpec.livenessProbeFailureSeconds }}
livenessProbeFailureSeconds: {{ .Values.starrocksFESpec.livenessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksFESpec.readinessProbeFailureSeconds }}
readinessProbeFailureSeconds: {{ .Values.starrocksFESpec.readinessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksFESpec.lifecycle }}
lifecycle:
{{- toYaml .Values.starrocksFESpec.lifecycle | nindent 6 }}
{{- end }}
{{- if and .Values.starrocksFESpec.sidecarsMap .Values.starrocksFESpec.sidecars }}
{{ fail "starrocksFESpec.sidecarsMap and starrocksFESpec.sidecars cannot be set at the same time" }}
{{- end }}
{{- if or .Values.starrocksFESpec.sidecarsMap .Values.starrocksFESpec.sidecars }}
sidecars:
{{- if .Values.starrocksFESpec.sidecarsMap }}
{{- range $name, $spec := .Values.starrocksFESpec.sidecarsMap }}
- name: {{ $name }}
{{- toYaml $spec | nindent 8 }}
{{- end }}
{{- else if .Values.starrocksFESpec.sidecars }}
{{- toYaml .Values.starrocksFESpec.sidecars | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.secrets }}
secrets:
{{- range .Values.starrocksFESpec.secrets }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksFESpec.configMaps .Values.starrocksFESpec.entrypoint }}
configMaps:
{{- if .Values.starrocksFESpec.configMaps }}
{{- range .Values.starrocksFESpec.configMaps }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.entrypoint }}
- name: {{template "starrockscluster.fe.entrypoint.script.configmap.name" .}}
mountPath: {{template "starrockscluster.entrypoint.mount.path" .}}/{{ template "starrockscluster.entrypoint.script.name" .}}
subPath: {{ template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
{{- end }}
configMapInfo:
configMapName: {{ template "starrockscluster.fe.configmap.name" . }}
resolveKey: fe.conf
{{- if or .Values.starrocksFESpec.storageSpec.name .Values.starrocksFESpec.emptyDirs .Values.starrocksFESpec.hostPaths }}
storageVolumes:
{{- if .Values.starrocksFESpec.storageSpec.name }}
- name: {{ .Values.starrocksFESpec.storageSpec.name }}{{ template "starrockscluster.fe.meta.suffix" . }}
storageClassName: {{ .Values.starrocksFESpec.storageSpec.storageClassName }}
storageSize: "{{ .Values.starrocksFESpec.storageSpec.storageSize }}"
mountPath: {{ template "starrockscluster.fe.meta.path" . }}
- name: {{ .Values.starrocksFESpec.storageSpec.name }}{{ template "starrockscluster.fe.log.suffix" . }}
{{- if .Values.starrocksFESpec.storageSpec.logStorageClassName }}
storageClassName: {{ .Values.starrocksFESpec.storageSpec.logStorageClassName }}
{{- else }}
storageClassName: {{ .Values.starrocksFESpec.storageSpec.storageClassName }}
{{- end }}
storageSize: "{{ .Values.starrocksFESpec.storageSpec.logStorageSize }}"
mountPath: {{ template "starrockscluster.fe.log.path" . }}
{{- end }}
{{- if .Values.starrocksFESpec.emptyDirs }}
{{- range .Values.starrocksFESpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.hostPaths }}
{{- range .Values.starrocksFESpec.hostPaths }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "hostPath"
hostPath:
{{- toYaml .hostPath | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.persistentVolumeClaimRetentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml .Values.starrocksFESpec.persistentVolumeClaimRetentionPolicy | nindent 6 }}
{{- end }}
{{- if .Values.starrocksCluster.enabledBe }}
starRocksBeSpec:
{{- if .Values.starrocksBeSpec.initContainers }}
initContainers:
{{- toYaml .Values.starrocksBeSpec.initContainers | nindent 6 }}
{{- end }}
{{- if .Values.starrocksBeSpec.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.starrocksBeSpec.shareProcessNamespace }}
{{- end }}
image: "{{ .Values.starrocksBeSpec.image.repository }}:{{ include "starrockscluster.be.image.tag" . }}"
{{- if .Values.starrocksBeSpec.entrypoint }}
command: ["bash", "-c"]
args:
- {{template "starrockscluster.entrypoint.mount.path" .}}/{{template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
replicas: {{ .Values.starrocksBeSpec.replicas }}
imagePullPolicy: {{ .Values.starrocksBeSpec.imagePullPolicy }}
{{- if .Values.starrocksBeSpec.maxUnavailablePods }}
updateStrategy:
rollingUpdate:
maxUnavailable: {{ .Values.starrocksBeSpec.maxUnavailablePods }}
{{- end }}
{{- /*
support both resources and resource for backward compatibility
*/}}
{{- if .Values.starrocksBeSpec.resources }}
{{- include "starrockscluster.be.resources" . | nindent 4 }}
{{- else if .Values.starrocksBeSpec.resource }}
{{- toYaml .Values.starrocksBeSpec.resource | nindent 4 }}
{{- end }}
{{- if .Values.starrocksBeSpec.service.type }}
service:
type: {{ .Values.starrocksBeSpec.service.type }}
{{- if and (eq "LoadBalancer" .Values.starrocksBeSpec.service.type) .Values.starrocksBeSpec.service.loadbalancerIP }}
loadBalancerIP: {{ .Values.starrocksBeSpec.service.loadbalancerIP }}
{{- end }}
{{- if and (eq "LoadBalancer" .Values.starrocksBeSpec.service.type) .Values.starrocksBeSpec.service.loadBalancerSourceRanges}}
loadBalancerSourceRanges:
{{- toYaml .Values.starrocksBeSpec.service.loadBalancerSourceRanges | nindent 8 }}
{{- end }}
{{- if .Values.starrocksBeSpec.service.ports }}
ports:
{{- toYaml .Values.starrocksBeSpec.service.ports | nindent 8 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.service.annotations .Values.datadog.metrics.enabled }}
annotations:
{{- if .Values.datadog.metrics.enabled }}
prometheus.io/path: "/metrics"
prometheus.io/port: "{{- default 8040 (include "starrockscluster.be.webserver.port" .) }}"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.starrocksBeSpec.service.annotations }}
{{- toYaml .Values.starrocksBeSpec.service.annotations | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.service.labels}}
labels:
{{- toYaml .Values.starrocksBeSpec.service.labels | nindent 8 }}
{{- end }}
{{- end }}
annotations:
app.starrocks.io/be-config-hash: "{{template "starrockscluster.be.config.hash" . }}"
{{- if .Values.datadog.log.enabled }}
{{- if eq (trimAll " {}" .Values.datadog.log.logConfig) "" }}
ad.datadoghq.com/be.logs: '[{"service":"starrocks","source":"be"}]'
{{- else }}
ad.datadoghq.com/be.logs: {{ printf "[%s]" (printf "{%s, \"source\": \"be\", \"service\": \"starrocks\"}" (trimAll " {}" .Values.datadog.log.logConfig) | fromJson | toJson) | squote }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.annotations }}
{{- toYaml .Values.starrocksBeSpec.annotations | nindent 6 }}
{{- end }}
{{- if .Values.starrocksBeSpec.entrypoint }}
app.starrocks.io/be-entrypoint-hash: "{{ template "starrockscluster.be.entrypoint.script.hash" . }}"
{{- end }}
{{- if or .Values.starrocksBeSpec.imagePullSecrets .Values.starrocksCluster.componentValues.imagePullSecrets }}
imagePullSecrets:
{{- include "starrockscluster.be.imagePullSecrets" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.serviceAccount .Values.starrocksCluster.componentValues.serviceAccount }}
serviceAccount: {{ include "starrockscluster.be.serviceAccount" . }}
{{- end }}
runAsNonRoot: {{ include "starrockscluster.be.runAsNonRoot" . }}
{{- if .Values.starrocksBeSpec.readOnlyRootFilesystem }}
readOnlyRootFilesystem: {{ .Values.starrocksBeSpec.readOnlyRootFilesystem }}
{{- end }}
{{- if or .Values.starrocksBeSpec.capabilities .Values.datadog.profiling.be }}
capabilities:
{{- if or .Values.starrocksBeSpec.capabilities.add .Values.datadog.profiling.be }}
add:
{{- if .Values.starrocksBeSpec.capabilities.add }}
{{- toYaml .Values.starrocksBeSpec.capabilities.add | nindent 8 }}
{{- end }}
{{- if .Values.datadog.profiling.be }}
{{- if and .Values.starrocksBeSpec.capabilities.add (has "PERFMON" .Values.starrocksBeSpec.capabilities.add) | not }}
- PERFMON
{{- end }}
{{- if and .Values.starrocksBeSpec.capabilities.add (has "SYS_PTRACE" .Values.starrocksBeSpec.capabilities.add) | not }}
- SYS_PTRACE
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.capabilities.drop }}
drop:
{{- toYaml .Values.starrocksBeSpec.capabilities.drop | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.sysctls }}
sysctls:
{{- toYaml .Values.starrocksBeSpec.sysctls | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.podLabels .Values.starrocksCluster.componentValues.podLabels .Values.datadog.profiling.be }}
podLabels:
{{- if or .Values.starrocksBeSpec.podLabels .Values.starrocksCluster.componentValues.podLabels }}
{{- include "starrockscluster.be.podLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.datadog.profiling.be }}
admission.datadoghq.com/config.mode: {{ .Values.datadog.profiling.configMode }}
admission.datadoghq.com/enabled: "true"
{{- end }}
{{- end }}
{{- if or .Values.starrocksBeSpec.hostAliases .Values.starrocksCluster.componentValues.hostAliases }}
hostAliases:
{{- include "starrockscluster.be.hostAliases" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.schedulerName .Values.starrocksCluster.componentValues.schedulerName }}
schedulerName: {{ include "starrockscluster.be.schedulerName" . }}
{{- end }}
{{- if or .Values.starrocksBeSpec.nodeSelector .Values.starrocksCluster.componentValues.nodeSelector }}
nodeSelector:
{{- include "starrockscluster.be.nodeSelector" . | nindent 6 }}
{{- end }}
beEnvVars:
- name: TZ
value: {{ .Values.timeZone }}
{{- if .Values.datadog.log.enabled }}
- name: LOG_CONSOLE
value: "1"
{{- end }}
{{- if and .Values.initPassword.enabled (.Values.starrocksBeSpec.beEnvVars | toJson | contains "MYSQL_PWD" | not) }}
- name: "MYSQL_PWD"
valueFrom:
secretKeyRef:
name: {{ template "starrockscluster.initpassword.secret.name" . }}
key: password
{{- end }}
{{- if .Values.datadog.profiling.be }}
- name: ENABLE_DATADOG_PROFILE
value: "true"
- name: DD_PROFILING_ENABLED
value: "true"
- name: DD_SERVICE
value: starrocks-be
- name: DD_ENV
value: "{{ .Values.datadog.profiling.env }}"
- name: DD_VERSION
value: "{{ include "starrockscluster.be.image.tag" . }}"
{{- end }}
{{- if .Values.starrocksBeSpec.beEnvVars }}
{{- /* if it is a map, we use range to iterate to merge environment variables */}}
{{- if eq (kindOf .Values.starrocksBeSpec.beEnvVars) "map" }}
{{- range $key, $value := .Values.starrocksBeSpec.beEnvVars }}
- name: {{ $key }}
{{- if eq (kindOf $value) "string" }}
value: {{ $value | quote }}
{{- else }}
{{- toYaml $value | nindent 8 }}
{{- end }}
{{- end }}
{{- else }}
{{- /* the default kind is slice, we keep backward compatibility */}}
{{- toYaml .Values.starrocksBeSpec.beEnvVars | nindent 6 }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksBeSpec.affinity .Values.starrocksCluster.componentValues.affinity }}
affinity:
{{- include "starrockscluster.be.affinity" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.tolerations .Values.starrocksCluster.componentValues.tolerations }}
tolerations:
{{- include "starrockscluster.be.tolerations" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksBeSpec.topologySpreadConstraints .Values.starrocksCluster.componentValues.topologySpreadConstraints }}
topologySpreadConstraints:
{{- include "starrockscluster.be.topologySpreadConstraints" . | nindent 6 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.starrocksBeSpec.terminationGracePeriodSeconds }}
{{- if .Values.starrocksBeSpec.startupProbeFailureSeconds }}
startupProbeFailureSeconds: {{ .Values.starrocksBeSpec.startupProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksBeSpec.livenessProbeFailureSeconds }}
livenessProbeFailureSeconds: {{ .Values.starrocksBeSpec.livenessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksBeSpec.readinessProbeFailureSeconds }}
readinessProbeFailureSeconds: {{ .Values.starrocksBeSpec.readinessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksBeSpec.lifecycle }}
lifecycle:
{{- toYaml .Values.starrocksBeSpec.lifecycle | nindent 6 }}
{{- end }}
{{- if and .Values.starrocksBeSpec.sidecarsMap .Values.starrocksBeSpec.sidecars }}
{{ fail "starrocksBeSpec.sidecarsMap and starrocksBeSpec.sidecars cannot be set at the same time" }}
{{- end }}
{{- if or .Values.starrocksBeSpec.sidecarsMap .Values.starrocksBeSpec.sidecars }}
sidecars:
{{- if .Values.starrocksBeSpec.sidecarsMap }}
{{- range $name, $spec := .Values.starrocksBeSpec.sidecarsMap }}
- name: {{ $name }}
{{- toYaml $spec | nindent 8 }}
{{- end }}
{{- else if .Values.starrocksBeSpec.sidecars }}
{{- toYaml .Values.starrocksBeSpec.sidecars | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.secrets }}
secrets:
{{- range .Values.starrocksBeSpec.secrets }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksBeSpec.configMaps .Values.starrocksBeSpec.entrypoint }}
configMaps:
{{- if .Values.starrocksBeSpec.configMaps }}
{{- range .Values.starrocksBeSpec.configMaps }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.entrypoint }}
- name: {{template "starrockscluster.be.entrypoint.script.configmap.name" .}}
mountPath: {{template "starrockscluster.entrypoint.mount.path" .}}/{{ template "starrockscluster.entrypoint.script.name" .}}
subPath: {{ template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
{{- end }}
configMapInfo:
configMapName: {{template "starrockscluster.be.configmap.name" . }}
resolveKey: be.conf
{{- if or .Values.starrocksBeSpec.storageSpec.name .Values.starrocksBeSpec.emptyDirs .Values.starrocksBeSpec.hostPaths }}
storageVolumes:
{{- if .Values.starrocksBeSpec.storageSpec.name }}
{{- if gt (int .Values.starrocksBeSpec.storageSpec.storageCount) 1 }}
{{- $storageName := .Values.starrocksBeSpec.storageSpec.name -}}
{{- $storageClassName := .Values.starrocksBeSpec.storageSpec.storageClassName -}}
{{- $storageSize := .Values.starrocksBeSpec.storageSpec.storageSize -}}
{{- $storageMountPath := include "starrockscluster.be.data.path" . -}}
{{- range $i, $e := until (int .Values.starrocksBeSpec.storageSpec.storageCount) }}
- name: {{ $storageName }}{{ $i }}{{template "starrockscluster.be.data.suffix" . }}
storageClassName: {{ $storageClassName }}
storageSize: "{{ $storageSize }}"
mountPath: {{ $storageMountPath }}{{ $i }}
{{- end }}
{{- else}}
- name: {{ .Values.starrocksBeSpec.storageSpec.name }}{{template "starrockscluster.be.data.suffix" . }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.storageClassName }}
storageSize: "{{ .Values.starrocksBeSpec.storageSpec.storageSize }}"
mountPath: {{template "starrockscluster.be.data.path" . }}
{{- end }}
- name: {{ .Values.starrocksBeSpec.storageSpec.name }}{{template "starrockscluster.be.log.suffix" . }}
{{- if .Values.starrocksBeSpec.storageSpec.logStorageClassName }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.logStorageClassName }}
{{- else }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.storageClassName }}
{{- end }}
storageSize: "{{ .Values.starrocksBeSpec.storageSpec.logStorageSize }}"
mountPath: {{template "starrockscluster.be.log.path" . }}
- name: {{ .Values.starrocksBeSpec.storageSpec.name }}{{template "starrockscluster.be.spill.suffix" . }}
{{- if .Values.starrocksBeSpec.storageSpec.spillStorageClassName }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.spillStorageClassName }}
{{- else }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.storageClassName }}
{{- end }}
storageSize: "{{ .Values.starrocksBeSpec.storageSpec.spillStorageSize}}"
mountPath: {{template "starrockscluster.be.spill.path" . }}
{{- end }}
{{- if .Values.starrocksBeSpec.emptyDirs }}
{{- range .Values.starrocksBeSpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.hostPaths }}
{{- range .Values.starrocksBeSpec.hostPaths }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "hostPath"
hostPath:
{{- toYaml .hostPath | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksBeSpec.persistentVolumeClaimRetentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml .Values.starrocksBeSpec.persistentVolumeClaimRetentionPolicy | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCluster.enabledCn }}
starRocksCnSpec:
{{- if .Values.starrocksCnSpec.initContainers }}
initContainers:
{{- toYaml .Values.starrocksCnSpec.initContainers | nindent 6 }}
{{- end }}
{{- if .Values.starrocksCnSpec.shareProcessNamespace }}
shareProcessNamespace: {{ .Values.starrocksCnSpec.shareProcessNamespace }}
{{- end }}
image: "{{ .Values.starrocksCnSpec.image.repository }}:{{ include "starrockscluster.cn.image.tag" . }}"
{{- if .Values.starrocksCnSpec.entrypoint }}
command: ["bash", "-c"]
args:
- {{template "starrockscluster.entrypoint.mount.path" .}}/{{template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
{{- if hasKey .Values.starrocksCnSpec "replicas" }}
replicas: {{ .Values.starrocksCnSpec.replicas }}
{{- end }}
imagePullPolicy: {{ .Values.starrocksCnSpec.imagePullPolicy }}
{{- if .Values.starrocksCnSpec.maxUnavailablePods }}
updateStrategy:
rollingUpdate:
maxUnavailable: {{ .Values.starrocksCnSpec.maxUnavailablePods }}
{{- end }}
{{- if or .Values.starrocksCnSpec.serviceAccount .Values.starrocksCluster.componentValues.serviceAccount }}
serviceAccount: {{ include "starrockscluster.cn.serviceAccount" . }}
{{- end }}
runAsNonRoot: {{ include "starrockscluster.cn.runAsNonRoot" . }}
{{- if .Values.starrocksCnSpec.readOnlyRootFilesystem }}
readOnlyRootFilesystem: {{ .Values.starrocksCnSpec.readOnlyRootFilesystem }}
{{- end }}
{{- if or .Values.starrocksCnSpec.capabilities .Values.datadog.profiling.cn }}
capabilities:
{{- if or .Values.starrocksCnSpec.capabilities.add .Values.datadog.profiling.cn }}
add:
{{- if .Values.starrocksCnSpec.capabilities.add }}
{{- toYaml .Values.starrocksCnSpec.capabilities.add | nindent 8 }}
{{- end }}
{{- if .Values.datadog.profiling.cn }}
{{- if and .Values.starrocksCnSpec.capabilities.add (has "PERFMON" .Values.starrocksCnSpec.capabilities.add) | not }}
- PERFMON
{{- end }}
{{- if and .Values.starrocksCnSpec.capabilities.add (has "SYS_PTRACE" .Values.starrocksCnSpec.capabilities.add) | not }}
- SYS_PTRACE
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.capabilities.drop }}
drop:
{{- toYaml .Values.starrocksCnSpec.capabilities.drop | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.sysctls }}
sysctls:
{{- toYaml .Values.starrocksCnSpec.sysctls | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksCnSpec.podLabels .Values.starrocksCluster.componentValues.podLabels .Values.datadog.profiling.cn }}
podLabels:
{{- if or .Values.starrocksCnSpec.podLabels .Values.starrocksCluster.componentValues.podLabels }}
{{- include "starrockscluster.cn.podLabels" . | nindent 6 }}
{{- end }}
{{- if .Values.datadog.profiling.cn }}
admission.datadoghq.com/config.mode: {{ .Values.datadog.profiling.configMode }}
admission.datadoghq.com/enabled: "true"
{{- end }}
{{- end }}
{{- if or .Values.starrocksCnSpec.hostAliases .Values.starrocksCluster.componentValues.hostAliases }}
hostAliases:
{{- include "starrockscluster.cn.hostAliases" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksCnSpec.schedulerName .Values.starrocksCluster.componentValues.schedulerName }}
schedulerName: {{ include "starrockscluster.cn.schedulerName" . }}
{{- end }}
{{- if or .Values.starrocksCnSpec.nodeSelector .Values.starrocksCluster.componentValues.nodeSelector }}
nodeSelector:
{{- include "starrockscluster.cn.nodeSelector" . | nindent 6 }}
{{- end }}
cnEnvVars:
- name: TZ
value: {{ .Values.timeZone }}
{{- if .Values.datadog.log.enabled }}
- name: LOG_CONSOLE
value: "1"
{{- end }}
{{- if and .Values.initPassword.enabled (.Values.starrocksCnSpec.cnEnvVars | toJson | contains "MYSQL_PWD" | not) }}
- name: "MYSQL_PWD"
valueFrom:
secretKeyRef:
name: {{ template "starrockscluster.initpassword.secret.name" . }}
key: password
{{- end }}
{{- if .Values.datadog.profiling.cn }}
- name: ENABLE_DATADOG_PROFILE
value: "true"
- name: DD_PROFILING_ENABLED
value: "true"
- name: DD_SERVICE
value: starrocks-cn
- name: DD_ENV
value: "{{ .Values.datadog.profiling.env }}"
- name: DD_VERSION
value: "{{ include "starrockscluster.cn.image.tag" . }}"
{{- end }}
{{- if .Values.starrocksCnSpec.cnEnvVars }}
{{- /* if it is a map, we use range to iterate to merge environment variables */}}
{{- if eq (kindOf .Values.starrocksCnSpec.cnEnvVars) "map" }}
{{- range $key, $value := .Values.starrocksCnSpec.cnEnvVars }}
- name: {{ $key }}
{{- if eq (kindOf $value) "string" }}
value: {{ $value | quote }}
{{- else }}
{{- toYaml $value | nindent 8 }}
{{- end }}
{{- end }}
{{- else }}
{{- /* the default kind is slice, we keep backward compatibility */}}
{{- toYaml .Values.starrocksCnSpec.cnEnvVars | nindent 6 }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksCnSpec.affinity .Values.starrocksCluster.componentValues.affinity }}
affinity:
{{- include "starrockscluster.cn.affinity" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksCnSpec.tolerations .Values.starrocksCluster.componentValues.tolerations }}
tolerations:
{{- include "starrockscluster.cn.tolerations" . | nindent 6 }}
{{- end }}
{{- if or .Values.starrocksCnSpec.topologySpreadConstraints .Values.starrocksCluster.componentValues.topologySpreadConstraints }}
topologySpreadConstraints:
{{- include "starrockscluster.cn.topologySpreadConstraints" . | nindent 6 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.starrocksCnSpec.terminationGracePeriodSeconds }}
{{- if .Values.starrocksCnSpec.startupProbeFailureSeconds }}
startupProbeFailureSeconds: {{ .Values.starrocksCnSpec.startupProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksCnSpec.livenessProbeFailureSeconds }}
livenessProbeFailureSeconds: {{ .Values.starrocksCnSpec.livenessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksCnSpec.readinessProbeFailureSeconds }}
readinessProbeFailureSeconds: {{ .Values.starrocksCnSpec.readinessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksCnSpec.lifecycle }}
lifecycle:
{{- toYaml .Values.starrocksCnSpec.lifecycle | nindent 6 }}
{{- end }}
{{- if and .Values.starrocksCnSpec.sidecarsMap .Values.starrocksCnSpec.sidecars }}
{{ fail "starrocksCnSpec.sidecarsMap and starrocksCnSpec.sidecars cannot be set at the same time" }}
{{- end }}
{{- if or .Values.starrocksCnSpec.sidecarsMap .Values.starrocksCnSpec.sidecars }}
sidecars:
{{- if .Values.starrocksCnSpec.sidecarsMap }}
{{- range $name, $spec := .Values.starrocksCnSpec.sidecarsMap }}
- name: {{ $name }}
{{- toYaml $spec | nindent 8 }}
{{- end }}
{{- else if .Values.starrocksCnSpec.sidecars }}
{{- toYaml .Values.starrocksCnSpec.sidecars | nindent 6 }}
{{- end }}
{{- end }}
{{- if and .Values.starrocksCluster.enabledCn .Values.starrocksCnSpec.autoScalingPolicy }}
autoScalingPolicy:
{{- toYaml .Values.starrocksCnSpec.autoScalingPolicy | nindent 6 }}
{{- end }}
{{- /*
support both resources and resource for backward compatibility
*/}}
{{- if .Values.starrocksCnSpec.resources }}
{{- include "starrockscluster.cn.resources" . | nindent 4 }}
{{- else if .Values.starrocksCnSpec.resource }}
{{- toYaml .Values.starrocksCnSpec.resource | nindent 4 }}
{{- end }}
{{- if .Values.starrocksCnSpec.service.type }}
service:
type: {{ .Values.starrocksCnSpec.service.type }}
{{- if and (eq "LoadBalancer" .Values.starrocksCnSpec.service.type) .Values.starrocksCnSpec.service.loadbalancerIP }}
loadBalancerIP: {{ .Values.starrocksCnSpec.service.loadbalancerIP }}
{{- end }}
{{- if and (eq "LoadBalancer" .Values.starrocksCnSpec.service.type) .Values.starrocksCnSpec.service.loadBalancerSourceRanges}}
loadBalancerSourceRanges:
{{- toYaml .Values.starrocksCnSpec.service.loadBalancerSourceRanges | nindent 8 }}
{{- end }}
{{- if .Values.starrocksCnSpec.service.ports }}
ports:
{{- toYaml .Values.starrocksCnSpec.service.ports | nindent 8 }}
{{- end }}
{{- if or .Values.starrocksCnSpec.service.annotations .Values.datadog.metrics.enabled }}
annotations:
{{- if .Values.datadog.metrics.enabled }}
prometheus.io/path: "/metrics"
prometheus.io/port: "{{- default 8040 (include "starrockscluster.cn.webserver.port" .) }}"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.starrocksCnSpec.service.annotations }}
{{- toYaml .Values.starrocksCnSpec.service.annotations | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.service.labels}}
labels:
{{- toYaml .Values.starrocksCnSpec.service.labels | nindent 8 }}
{{- end }}
{{- end }}
annotations:
app.starrocks.io/cn-config-hash: "{{template "starrockscluster.cn.config.hash" . }}"
{{- if .Values.datadog.log.enabled }}
{{- if eq (trimAll " {}" .Values.datadog.log.logConfig) "" }}
ad.datadoghq.com/cn.logs: '[{"service":"starrocks","source":"cn"}]'
{{- else }}
ad.datadoghq.com/cn.logs: {{ printf "[%s]" (printf "{%s, \"source\": \"cn\", \"service\": \"starrocks\"}" (trimAll " {}" .Values.datadog.log.logConfig) | fromJson | toJson) | squote }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.annotations }}
{{- toYaml .Values.starrocksCnSpec.annotations | nindent 6 }}
{{- end }}
{{- if .Values.starrocksCnSpec.entrypoint }}
app.starrocks.io/cn-entrypoint-hash: "{{ template "starrockscluster.cn.entrypoint.script.hash" . }}"
{{- end }}
{{- if or .Values.starrocksCnSpec.imagePullSecrets .Values.starrocksCluster.componentValues.imagePullSecrets }}
imagePullSecrets:
{{- include "starrockscluster.cn.imagePullSecrets" . | nindent 6 }}
{{- end }}
{{- if .Values.starrocksCnSpec.secrets }}
secrets:
{{- range .Values.starrocksCnSpec.secrets }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if or .Values.starrocksCnSpec.configMaps .Values.starrocksCnSpec.entrypoint }}
configMaps:
{{- if .Values.starrocksCnSpec.configMaps }}
{{- range .Values.starrocksCnSpec.configMaps }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
subPath: {{ .subPath }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.entrypoint }}
- name: {{template "starrockscluster.cn.entrypoint.script.configmap.name" .}}
mountPath: {{template "starrockscluster.entrypoint.mount.path" .}}/{{ template "starrockscluster.entrypoint.script.name" .}}
subPath: {{ template "starrockscluster.entrypoint.script.name" .}}
{{- end }}
{{- end }}
configMapInfo:
configMapName: {{template "starrockscluster.cn.configmap.name" . }}
resolveKey: cn.conf
{{- if or .Values.starrocksCnSpec.storageSpec.name .Values.starrocksCnSpec.emptyDirs .Values.starrocksCnSpec.hostPaths }}
storageVolumes:
{{- if .Values.starrocksCnSpec.storageSpec.name }}
{{- if gt (int .Values.starrocksCnSpec.storageSpec.storageCount) 1 }}
{{- $storageName := .Values.starrocksCnSpec.storageSpec.name -}}
{{- $storageClassName := .Values.starrocksCnSpec.storageSpec.storageClassName -}}
{{- $storageSize := .Values.starrocksCnSpec.storageSpec.storageSize -}}
{{- $storageMountPath := include "starrockscluster.cn.data.path" . -}}
{{- range $i, $e := until (int .Values.starrocksCnSpec.storageSpec.storageCount) }}
- name: {{ $storageName }}{{ $i }}{{template "starrockscluster.cn.data.suffix" . }}
storageClassName: {{ $storageClassName }}
storageSize: "{{ $storageSize }}"
mountPath: {{ $storageMountPath }}{{ $i }}
{{- end }}
{{- else }}
- name: {{ .Values.starrocksCnSpec.storageSpec.name }}{{template "starrockscluster.cn.data.suffix" . }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.storageClassName }}
storageSize: "{{ .Values.starrocksCnSpec.storageSpec.storageSize }}"
mountPath: {{template "starrockscluster.cn.data.path" . }}
{{- end }}
- name: {{ .Values.starrocksCnSpec.storageSpec.name }}{{template "starrockscluster.cn.log.suffix" . }}
{{- if .Values.starrocksCnSpec.storageSpec.logStorageClassName }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.logStorageClassName }}
{{- else }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.storageClassName }}
{{- end }}
storageSize: "{{ .Values.starrocksCnSpec.storageSpec.logStorageSize }}"
mountPath: {{template "starrockscluster.cn.log.path" . }}
- name: {{ .Values.starrocksCnSpec.storageSpec.name }}{{template "starrockscluster.cn.spill.suffix" . }}
{{- if .Values.starrocksCnSpec.storageSpec.spillStorageClassName }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.spillStorageClassName }}
{{- else }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.storageClassName }}
{{- end }}
storageSize: "{{ .Values.starrocksCnSpec.storageSpec.spillStorageSize}}"
mountPath: {{template "starrockscluster.cn.spill.path" . }}
{{- end }}
{{- if .Values.starrocksCnSpec.emptyDirs }}
{{- range .Values.starrocksCnSpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.hostPaths }}
{{- range .Values.starrocksCnSpec.hostPaths }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "hostPath"
hostPath:
{{- toYaml .hostPath | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCnSpec.persistentVolumeClaimRetentionPolicy }}
persistentVolumeClaimRetentionPolicy:
{{- toYaml .Values.starrocksCnSpec.persistentVolumeClaimRetentionPolicy | nindent 6 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.enabled }}
starRocksFeProxySpec:
{{- if .Values.starrocksFeProxySpec.image.repository }}
image: "{{ .Values.starrocksFeProxySpec.image.repository }}:{{ .Values.starrocksFeProxySpec.image.tag }}"
{{- end }}
{{- if .Values.starrocksFeProxySpec.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.starrocksFeProxySpec.imagePullSecrets | nindent 4 }}
{{- end }}
replicas: {{ .Values.starrocksFeProxySpec.replicas }}
imagePullPolicy: {{ .Values.starrocksFeProxySpec.imagePullPolicy }}
resolver: {{ .Values.starrocksFeProxySpec.resolver }}
{{- if .Values.starrocksFeProxySpec.resources }}
{{- toYaml .Values.starrocksFeProxySpec.resources | nindent 4 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.service.type }}
service:
type: {{ .Values.starrocksFeProxySpec.service.type }}
{{- if .Values.starrocksFeProxySpec.service.annotations }}
annotations:
{{- toYaml .Values.starrocksFeProxySpec.service.annotations | nindent 8 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.service.labels}}
labels:
{{- toYaml .Values.starrocksFeProxySpec.service.labels | nindent 8 }}
{{- end }}
{{- if and (eq "LoadBalancer" .Values.starrocksFeProxySpec.service.type) .Values.starrocksFeProxySpec.service.loadbalancerIP }}
loadBalancerIP: {{ .Values.starrocksFeProxySpec.service.loadbalancerIP }}
{{- end }}
{{- if and (eq "LoadBalancer" .Values.starrocksFeProxySpec.service.type) .Values.starrocksFeProxySpec.service.loadBalancerSourceRanges}}
loadBalancerSourceRanges:
{{- toYaml .Values.starrocksFeProxySpec.service.loadBalancerSourceRanges | nindent 8 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.service.ports }}
ports:
{{- toYaml .Values.starrocksFeProxySpec.service.ports | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.nodeSelector }}
nodeSelector:
{{- toYaml .Values.starrocksFeProxySpec.nodeSelector | nindent 6 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.affinity }}
affinity:
{{- toYaml .Values.starrocksFeProxySpec.affinity | nindent 6 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.tolerations }}
tolerations:
{{- toYaml .Values.starrocksFeProxySpec.tolerations | nindent 6 }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.livenessProbeFailureSeconds }}
livenessProbeFailureSeconds: {{ .Values.starrocksFeProxySpec.livenessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.readinessProbeFailureSeconds }}
readinessProbeFailureSeconds: {{ .Values.starrocksFeProxySpec.readinessProbeFailureSeconds }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.emptyDirs }}
storageVolumes:
{{- range .Values.starrocksFeProxySpec.emptyDirs }}
- name: {{ .name }}
storageClassName: "emptyDir"
mountPath: {{ .mountPath }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.podLabels }}
podLabels:
{{- toYaml .Values.starrocksFeProxySpec.podLabels | nindent 6 }}
{{- end }}
{{- end }}