diff --git a/addons-cluster/apecloud-mysql/templates/cluster.yaml b/addons-cluster/apecloud-mysql/templates/cluster.yaml index 79d382fe6..644c790c6 100644 --- a/addons-cluster/apecloud-mysql/templates/cluster.yaml +++ b/addons-cluster/apecloud-mysql/templates/cluster.yaml @@ -6,10 +6,6 @@ metadata: labels: {{ include "kblib.clusterLabels" . | nindent 4 }} auditLogEnabled: "{{ .Values.auditLogEnabled }}" - {{- if and (eq .Values.mode "raftGroup") .Values.proxyEnabled }} - annotations: - kubeblocks.io/extra-env: '{"KB_PROXY_ENABLED":"on","ETCDCTL_API": "{{ .Values.etcd.etcdctlApi}}"}' - {{- end }} spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} {{- include "kblib.affinity" . | indent 2 }} @@ -17,6 +13,13 @@ spec: topology: {{ include "apecloud-mysql-cluster.topology" . }} componentSpecs: - name: mysql + {{- if and (eq .Values.mode "raftGroup") .Values.proxyEnabled }} + env: + - name: KB_PROXY_ENABLED + value: "on" + - name: ETCDCTL_API + value: "{{ .Values.etcd.etcdctlApi }}" + {{- end }} {{- include "kblib.componentMonitor" . | indent 6 }} {{- if and (eq .Values.mode "raftGroup") .Values.proxyEnabled (not .Values.localEtcdEnabled) }} serviceRefs: diff --git a/addons-cluster/elasticsearch/templates/cluster-multi-node.yaml b/addons-cluster/elasticsearch/templates/cluster-multi-node.yaml index 970e9c38b..064af621f 100644 --- a/addons-cluster/elasticsearch/templates/cluster-multi-node.yaml +++ b/addons-cluster/elasticsearch/templates/cluster-multi-node.yaml @@ -5,8 +5,6 @@ metadata: name: {{ include "kblib.clusterName" . }} namespace: {{ .Release.Namespace }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} - annotations: - kubeblocks.io/extra-env: '{"mdit-roles":"master,data,ingest,transform","mode":"{{ .Values.mode }}"}' spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} {{- include "kblib.affinity" . | indent 2 }} @@ -14,6 +12,11 @@ spec: - name: mdit componentDef: elasticsearch-{{ include "elasticsearch.majorVersion" . }} serviceVersion: {{ include "elasticsearch.version" . }} + env: + - name: mdit-roles + value: "master,data,ingest,transform" + - name: mode + value: {{ .Values.mode }} serviceAccountName: {{ include "kblib.serviceAccountName" . }} {{- include "elasticsearch-cluster.replicaCount" . | indent 6 }} {{- include "kblib.componentMonitor" . | indent 6 }} diff --git a/addons-cluster/elasticsearch/templates/cluster-single-node.yaml b/addons-cluster/elasticsearch/templates/cluster-single-node.yaml index caa76d9c8..7c797c354 100644 --- a/addons-cluster/elasticsearch/templates/cluster-single-node.yaml +++ b/addons-cluster/elasticsearch/templates/cluster-single-node.yaml @@ -5,8 +5,6 @@ metadata: name: {{ include "kblib.clusterName" . }} namespace: {{ .Release.Namespace }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} - annotations: - kubeblocks.io/extra-env: '{"mode":"{{ .Values.mode }}"}' spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} {{- include "kblib.affinity" . | indent 2 }} @@ -14,6 +12,9 @@ spec: - name: mdit componentDef: elasticsearch-{{ include "elasticsearch.majorVersion" . }} serviceVersion: {{ include "elasticsearch.version" . }} + env: + - name: mode + value: {{ .Values.mode }} serviceAccountName: {{ include "kblib.serviceAccountName" . }} {{- include "elasticsearch-cluster.replicaCount" . | indent 6 }} {{- include "kblib.componentMonitor" . | indent 6 }} diff --git a/addons-cluster/kafka/templates/cluster.yaml b/addons-cluster/kafka/templates/cluster.yaml index 3ba27b8be..582f654be 100644 --- a/addons-cluster/kafka/templates/cluster.yaml +++ b/addons-cluster/kafka/templates/cluster.yaml @@ -4,7 +4,6 @@ metadata: name: {{ include "kblib.clusterName" . }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} annotations: - "kubeblocks.io/extra-env": '{"KB_KAFKA_ENABLE_SASL":"{{ $.Values.saslEnable }}","KB_KAFKA_BROKER_HEAP":"{{ $.Values.brokerHeap }}","KB_KAFKA_CONTROLLER_HEAP":"{{ $.Values.controllerHeap }}","KB_KAFKA_PUBLIC_ACCESS":"{{ $.Values.extra.publiclyAccessible }}"}' {{/* {{- include "kafka-cluster.brokerAddrFeatureGate" . | nindent 4 }}*/}} spec: clusterDef: kafka # ref clusterdefinition.name @@ -30,6 +29,15 @@ spec: {{- if .Values.useLegacyCompDef }} componentDef: kafka-server {{- end }} + env: + - name: KB_KAFKA_ENABLE_SASL + value: "{{ $.Values.saslEnable }}" + - name: KB_KAFKA_BROKER_HEAP + value: "{{ $.Values.brokerHeap }}" + - name: KB_KAFKA_CONTROLLER_HEAP + value: "{{ $.Values.controllerHeap }}" + - name: KB_KAFKA_PUBLIC_ACCESS + value: "{{ $.Values.extra.publiclyAccessible }}" tls: {{ $.Values.tlsEnable }} {{- if $.Values.tlsEnable }} issuer: @@ -70,6 +78,15 @@ spec: {{- if .Values.useLegacyCompDef }} componentDef: kafka-broker {{- end }} + env: + - name: KB_KAFKA_ENABLE_SASL + value: "{{ $.Values.saslEnable }}" + - name: KB_KAFKA_BROKER_HEAP + value: "{{ $.Values.brokerHeap }}" + - name: KB_KAFKA_CONTROLLER_HEAP + value: "{{ $.Values.controllerHeap }}" + - name: KB_KAFKA_PUBLIC_ACCESS + value: "{{ $.Values.extra.publiclyAccessible }}" tls: {{ $.Values.tlsEnable }} {{- if $.Values.tlsEnable }} issuer: @@ -109,6 +126,15 @@ spec: {{- if .Values.useLegacyCompDef }} componentDef: controller {{- end }} + env: + - name: KB_KAFKA_ENABLE_SASL + value: "{{ $.Values.saslEnable }}" + - name: KB_KAFKA_BROKER_HEAP + value: "{{ $.Values.brokerHeap }}" + - name: KB_KAFKA_CONTROLLER_HEAP + value: "{{ $.Values.controllerHeap }}" + - name: KB_KAFKA_PUBLIC_ACCESS + value: "{{ $.Values.extra.publiclyAccessible }}" tls: {{ $.Values.tlsEnable }} {{- if $.Values.tlsEnable }} issuer: @@ -134,6 +160,15 @@ spec: {{- if .Values.useLegacyCompDef }} componentDef: kafka-exporter {{- end }} + env: + - name: KB_KAFKA_ENABLE_SASL + value: "{{ $.Values.saslEnable }}" + - name: KB_KAFKA_BROKER_HEAP + value: "{{ $.Values.brokerHeap }}" + - name: KB_KAFKA_CONTROLLER_HEAP + value: "{{ $.Values.controllerHeap }}" + - name: KB_KAFKA_PUBLIC_ACCESS + value: "{{ $.Values.extra.publiclyAccessible }}" replicas: {{ $.Values.monitorReplicas }} {{- include "kblib.componentResources" . | nindent 6 }} {{- end }} diff --git a/addons-cluster/llm/templates/cluster.yaml b/addons-cluster/llm/templates/cluster.yaml index a882378c0..40d0eec2a 100644 --- a/addons-cluster/llm/templates/cluster.yaml +++ b/addons-cluster/llm/templates/cluster.yaml @@ -4,8 +4,6 @@ metadata: name: {{ include "kblib.clusterName" . }} namespace: {{ .Release.Namespace }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} - annotations: - "kubeblocks.io/extra-env": "{\"MODEL_NAME\":\"{{ .Values.model }}\", \"EXTRA_ARGS\":\"{{ .Values.extraArgs }}\", \"MODEL_URL\":\"{{ .Values.url }}\", \"QUANTIZE\":\"{{ .Values.quantize }}\"}" spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} {{- include "kblib.affinity" . | indent 2 }} @@ -14,6 +12,15 @@ spec: componentSpecs: - name: ggml componentDefRef: ggml + env: + - name: MODEL_NAME + value: {{ .Values.model }} + - name: EXTRA_ARGS + value: {{ .Values.extraArgs }} + - name: MODEL_URL + value: {{ .Values.url }} + - name: QUANTIZE + value: {{ .Values.quantize }} {{- include "kblib.componentMonitor" . | indent 6 }} replicas: {{ .Values.replicas }} serviceAccountName: {{ include "kblib.serviceAccountName" . }} @@ -23,6 +30,15 @@ spec: componentSpecs: - name: vllm componentDefRef: vllm + env: + - name: MODEL_NAME + value: {{ .Values.model }} + - name: EXTRA_ARGS + value: {{ .Values.extraArgs }} + - name: MODEL_URL + value: {{ .Values.url }} + - name: QUANTIZE + value: {{ .Values.quantize }} {{- include "kblib.componentMonitor" . | indent 6 }} replicas: {{ .Values.replicas }} serviceAccountName: {{ include "kblib.serviceAccountName" . }} diff --git a/addons-cluster/mysql/templates/cluster.yaml b/addons-cluster/mysql/templates/cluster.yaml index c7759a009..fc10ead8e 100644 --- a/addons-cluster/mysql/templates/cluster.yaml +++ b/addons-cluster/mysql/templates/cluster.yaml @@ -3,10 +3,6 @@ kind: Cluster metadata: name: {{ include "kblib.clusterName" . }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} - annotations: - {{- if eq .Values.topology "server-with-proxy" }} - kubeblocks.io/extra-env: '{"PROXY_ENABLED":"on"}' - {{- end }} spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} {{- include "kblib.affinity" . | indent 2 }} @@ -18,6 +14,11 @@ spec: {{- $compdef = printf "%s-orc" $compdef }} {{- end }} componentDef: {{ $compdef }} + {{- if eq .Values.topology "server-with-proxy" }} + env: + - name: PROXY_ENABLED + value: "on" + {{- end }} {{- include "kblib.componentMonitor" . | indent 6 }} {{- include "mysql-cluster.replicaCount" . | indent 6 }} {{- include "kblib.componentResources" . | indent 6 }} @@ -42,6 +43,11 @@ spec: {{- if eq .Values.topology "server-with-proxy" }} - name: proxysql componentDef: proxysql + {{- if eq .Values.topology "server-with-proxy" }} + env: + - name: PROXY_ENABLED + value: "on" + {{- end }} replicas: {{.Values.proxysql.replicas}} resources: limits: diff --git a/addons-cluster/oceanbase-ce/templates/_helpers.tpl b/addons-cluster/oceanbase-ce/templates/_helpers.tpl index 853e47e73..d89fd01ec 100644 --- a/addons-cluster/oceanbase-ce/templates/_helpers.tpl +++ b/addons-cluster/oceanbase-ce/templates/_helpers.tpl @@ -66,17 +66,23 @@ Create the name of the service account to use Create extra env */}} {{- define "oceanbase-cluster.extra-envs" }} -{ -{{- if .Values.tenant }} -"TENANT_NAME": "{{ .Values.tenant.name }}", -"TENANT_CPU": "{{ min (sub .Values.cpu 1) .Values.tenant.max_cpu }}", -"TENANT_MEMORY": "{{ print (min (sub .Values.memory 2) .Values.tenant.memory_size) "G" }}", -"TENANT_DISK": "{{ print (.Values.tenant.log_disk_size | default 5) "G" }}", -{{- end }} -"ZONE_COUNT": "{{ .Values.zoneCount | default "1" }}", -"OB_CLUSTERS_COUNT": "{{ .Values.obClusters | default "1" }}", -"OB_DEBUG": "{{ .Values.debug | default "false" }}" -} +env: + {{- if .Values.tenant }} + - name: TENANT_NAME + value: "{{ .Values.tenant.name }}" + - name: TENANT_CPU + value: "{{ min (sub .Values.cpu 1) .Values.tenant.max_cpu }}" + - name: TENANT_MEMORY + value: "{{ print (min (sub .Values.memory 2) .Values.tenant.memory_size) "G" }}" + - name: TENANT_DISK + value: "{{ print (.Values.tenant.log_disk_size | default 5) "G" }}" + {{- end }} + - name: ZONE_COUNT + value: "{{ .Values.zoneCount | default "1" }}" + - name: OB_CLUSTERS_COUNT + value: "{{ .Values.obClusters | default "1" }}" + - name: OB_DEBUG + value: "{{ .Values.debug | default "false" }}" {{- end }} @@ -93,10 +99,6 @@ Create extra env {{- end }} -{{- define "oceanbase-cluster.annotations.extra-envs" -}} - "kubeblocks.io/extra-env": {{ include "oceanbase-cluster.extra-envs" . | nospace | quote }} -{{- end -}} - {{/* Define oceanbase cluster annotation pod-ordinal-svc feature gate. */}} @@ -111,4 +113,4 @@ kubeblocks.io/enabled-pod-ordinal-svc: {{ include "observers" . | quote}} {{- $observers = print "ob-bundle-" $idx | append $observers -}} {{- end -}} {{- join "," $observers -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/addons-cluster/oceanbase-ce/templates/cluster.yaml b/addons-cluster/oceanbase-ce/templates/cluster.yaml index 3f62561af..ab22d294e 100644 --- a/addons-cluster/oceanbase-ce/templates/cluster.yaml +++ b/addons-cluster/oceanbase-ce/templates/cluster.yaml @@ -5,7 +5,6 @@ metadata: labels: {{- include "oceanbase.labels" . | nindent 4 }} annotations: - {{- include "oceanbase-cluster.annotations.extra-envs" . | nindent 4 }} {{- include "oceanbase-cluster.featureGate" . | nindent 4 }} spec: terminationPolicy: {{ .Values.extra.terminationPolicy }} @@ -26,6 +25,7 @@ spec: {{- range $i, $e := until (int .Values.obClusters) }} - name: ob-bundle-{{ $i }} componentDef: {{ include "oceanbase-cluster.compdef" $}} + {{- include "oceanbase-cluster.extra-envs" $ | indent 6 }} replicas: {{ max $.Values.zoneCount $.Values.replicas}} {{- include "kblib.componentResources" $ | indent 6 }} volumeClaimTemplates: diff --git a/addons-cluster/opentenbase/templates/_helpers.tpl b/addons-cluster/opentenbase/templates/_helpers.tpl index 34eb988ad..a86cd3d9e 100644 --- a/addons-cluster/opentenbase/templates/_helpers.tpl +++ b/addons-cluster/opentenbase/templates/_helpers.tpl @@ -4,7 +4,3 @@ Expand the name of the chart. {{- define "opentenbase.name" -}} {{- .Release.Name | trunc 63 | trimSuffix "-" }} {{- end }} - -{{- define "opentenbase.extraEnv" -}} -{"DATANODE_COUNT":"{{ len .Values.dn }}", "COORDINATOR_COUNT":"{{ len .Values.cn }}"} -{{- end }} \ No newline at end of file diff --git a/addons-cluster/opentenbase/templates/cluster.yaml b/addons-cluster/opentenbase/templates/cluster.yaml index 3d2c2ed1e..b6a83b81b 100644 --- a/addons-cluster/opentenbase/templates/cluster.yaml +++ b/addons-cluster/opentenbase/templates/cluster.yaml @@ -2,14 +2,17 @@ apiVersion: apps.kubeblocks.io/v1 kind: Cluster metadata: name: {{ include "opentenbase.name" . }} - annotations: - kubeblocks.io/extra-env: {{ include "opentenbase.extraEnv" . | squote }} spec: clusterDef: opentenbase terminationPolicy: {{ .Values.terminationPolicy }} componentSpecs: - name: gtm componentDefRef: gtm + env: + - name: DATANODE_COUNT + value: "{{ len .Values.dn }}" + - name: COORDINATOR_COUNT + value: "{{ len .Values.cn }}" replicas: {{ .Values.gtm.replicas }} {{- with .Values.gtm.resources }} resources: @@ -38,6 +41,11 @@ spec: {{- range .Values.dn }} - name: dn-{{ $i }} componentDefRef: dn + env: + - name: DATANODE_COUNT + value: "{{ len .Values.dn }}" + - name: COORDINATOR_COUNT + value: "{{ len .Values.cn }}" replicas: {{ .replicas }} {{- with .resources }} resources: @@ -68,6 +76,11 @@ spec: {{- range .Values.cn }} - name: cn-{{ $j }} componentDefRef: cn + env: + - name: DATANODE_COUNT + value: "{{ len .Values.dn }}" + - name: COORDINATOR_COUNT + value: "{{ len .Values.cn }}" replicas: {{ .replicas }} {{- with .resources }} resources: diff --git a/addons-cluster/orchestrator/templates/_helpers.tpl b/addons-cluster/orchestrator/templates/_helpers.tpl deleted file mode 100644 index 357689289..000000000 --- a/addons-cluster/orchestrator/templates/_helpers.tpl +++ /dev/null @@ -1,20 +0,0 @@ -{{/* -Create extra env -*/}} -# TOPOLOGY and META user name are fixed to orchestrator -# "ORC_TOPOLOGY_USER": "{{ .Values.secret.TOPOLOGY_USER | default "orchestrator" }}", -# "ORC_META_USER": "{{ .Values.secret.META_USER | default "orchestrator" }}", -{{- define "orchestrator-cluster.extra-envs" }} -{ -"ORC_TOPOLOGY_PASSWORD": "{{ .Values.secret.TOPOLOGY_PASSWORD | default "orchestrator" }}", -"ORC_META_PASSWORD": "{{ .Values.secret.META_PASSWORD | default "orchestrator" }}", -"ORC_META_DATABASE": "{{ .Values.secret.META_DATABASE | default "orchestrator" }}" -} -{{- end }} - -{{/* -Create the hummock option -*/}} -{{- define "orchestrator-cluster.annotations.extra-envs" -}} -"kubeblocks.io/extra-env": {{ include "orchestrator-cluster.extra-envs" . | nospace | quote }} -{{- end -}} \ No newline at end of file diff --git a/addons-cluster/orchestrator/templates/cluster.yaml b/addons-cluster/orchestrator/templates/cluster.yaml index a94ec672d..ab8203c01 100644 --- a/addons-cluster/orchestrator/templates/cluster.yaml +++ b/addons-cluster/orchestrator/templates/cluster.yaml @@ -3,8 +3,6 @@ kind: Cluster metadata: name: {{ include "kblib.clusterName" . }} labels: {{ include "kblib.clusterLabels" . | nindent 4 }} - annotations: - {{- include "orchestrator-cluster.annotations.extra-envs" . | nindent 4 }} spec: clusterDef: orchestrator topology: {{ .Values.mode }} @@ -19,6 +17,13 @@ spec: port: 80 componentSpecs: - name: orchestrator + env: + - name: ORC_TOPOLOGY_PASSWORD + value: {{ .Values.secret.TOPOLOGY_PASSWORD | default "orchestrator" }} + - name: ORC_META_PASSWORD + value: {{ .Values.secret.META_PASSWORD | default "orchestrator" }} + - name: ORC_META_DATABASE + value: {{ .Values.secret.META_DATABASE | default "orchestrator" }} {{- include "kblib.componentMonitor" . | indent 6 }} replicas: {{ .Values.replicas }} {{- include "kblib.componentResources" . | indent 6 }}