diff --git a/config/crd/bases/starrocks.com_starrocksclusters.yaml b/config/crd/bases/starrocks.com_starrocksclusters.yaml index 60a18b6e..56914ea2 100644 --- a/config/crd/bases/starrocks.com_starrocksclusters.yaml +++ b/config/crd/bases/starrocks.com_starrocksclusters.yaml @@ -841,6 +841,19 @@ spec: description: annotation for pods. user can config monitor annotation for collect to monitor system. type: object + args: + description: |- + Arguments to the entrypoint. + If this is not provided, it will use $(FE_SERVICE_NAME) for all components. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array beEnvVars: description: beEnvVars is a slice of environment variables that are added to the pods, the default is empty. @@ -1001,6 +1014,16 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + description: "Entrypoint array. Not executed within a shell.\nIf + this is not provided, it will use default entrypoint for different + components:\n\t1. For FE, it will use /opt/starrocks/fe_entrypoint.sh + as the entrypoint.\n 2. For BE, it will use /opt/starrocks/be_entrypoint.sh + as the entrypoint.\n 3. For CN, it will use /opt/starrocks/cn_entrypoint.sh + as the entrypoint.\nMore info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + items: + type: string + type: array configMapInfo: description: the reference for configMap which store the config info to start starrocks. e.g. be.conf, fe.conf, cn.conf. @@ -1016,6 +1039,15 @@ spec: description: the reference for configMap which allow users to mount any files to container. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -2630,6 +2662,15 @@ spec: secrets: description: the reference for secrets. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -4910,6 +4951,19 @@ spec: description: annotation for pods. user can config monitor annotation for collect to monitor system. type: object + args: + description: |- + Arguments to the entrypoint. + If this is not provided, it will use $(FE_SERVICE_NAME) for all components. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array autoScalingPolicy: description: AutoScalingPolicy auto scaling strategy properties: @@ -5691,6 +5745,16 @@ spec: - name type: object type: array + command: + description: "Entrypoint array. Not executed within a shell.\nIf + this is not provided, it will use default entrypoint for different + components:\n\t1. For FE, it will use /opt/starrocks/fe_entrypoint.sh + as the entrypoint.\n 2. For BE, it will use /opt/starrocks/be_entrypoint.sh + as the entrypoint.\n 3. For CN, it will use /opt/starrocks/cn_entrypoint.sh + as the entrypoint.\nMore info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + items: + type: string + type: array configMapInfo: description: the reference for configMap which store the config info to start starrocks. e.g. be.conf, fe.conf, cn.conf. @@ -5706,6 +5770,15 @@ spec: description: the reference for configMap which allow users to mount any files to container. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -7320,6 +7393,15 @@ spec: secrets: description: the reference for secrets. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -10901,6 +10983,19 @@ spec: description: annotation for pods. user can config monitor annotation for collect to monitor system. type: object + args: + description: |- + Arguments to the entrypoint. + If this is not provided, it will use $(FE_SERVICE_NAME) for all components. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array capabilities: description: |- refer to https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-capabilities-for-a-container @@ -10946,6 +11041,16 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + description: "Entrypoint array. Not executed within a shell.\nIf + this is not provided, it will use default entrypoint for different + components:\n\t1. For FE, it will use /opt/starrocks/fe_entrypoint.sh + as the entrypoint.\n 2. For BE, it will use /opt/starrocks/be_entrypoint.sh + as the entrypoint.\n 3. For CN, it will use /opt/starrocks/cn_entrypoint.sh + as the entrypoint.\nMore info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + items: + type: string + type: array configMapInfo: description: the reference for configMap which store the config info to start starrocks. e.g. be.conf, fe.conf, cn.conf. @@ -10961,6 +11066,15 @@ spec: description: the reference for configMap which allow users to mount any files to container. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -12690,6 +12804,15 @@ spec: secrets: description: the reference for secrets. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- diff --git a/config/crd/bases/starrocks.com_starrockswarehouses.yaml b/config/crd/bases/starrocks.com_starrockswarehouses.yaml index da8210d7..83898c64 100644 --- a/config/crd/bases/starrocks.com_starrockswarehouses.yaml +++ b/config/crd/bases/starrocks.com_starrockswarehouses.yaml @@ -831,6 +831,19 @@ spec: description: annotation for pods. user can config monitor annotation for collect to monitor system. type: object + args: + description: |- + Arguments to the entrypoint. + If this is not provided, it will use $(FE_SERVICE_NAME) for all components. + Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + of whether the variable exists or not. Cannot be updated. + More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + items: + type: string + type: array autoScalingPolicy: description: AutoScalingPolicy defines auto scaling policy properties: @@ -1497,6 +1510,16 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + description: "Entrypoint array. Not executed within a shell.\nIf + this is not provided, it will use default entrypoint for different + components:\n\t1. For FE, it will use /opt/starrocks/fe_entrypoint.sh + as the entrypoint.\n 2. For BE, it will use /opt/starrocks/be_entrypoint.sh + as the entrypoint.\n 3. For CN, it will use /opt/starrocks/cn_entrypoint.sh + as the entrypoint.\nMore info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell" + items: + type: string + type: array configMapInfo: description: the reference for configMap which store the config info to start starrocks. e.g. be.conf, fe.conf, cn.conf. @@ -1512,6 +1535,15 @@ spec: description: the reference for configMap which allow users to mount any files to container. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- @@ -3241,6 +3273,15 @@ spec: secrets: description: the reference for secrets. items: + description: |- + MountInfo + The reason why we do not support defaultMode is that we use hash.HashObject to + calculate the actual volume name. This volume name is used in pod template of statefulset, + and if this MountInfo type has been changed, the volume name will be changed too, and + that will make pods restart. + The default mode is 0644, and in order to support to set permission information for a configMap + or secret, we add should specify the subPath and specify a command or args in the container. + And It will be set 0755. properties: mountPath: description: |- diff --git a/deploy/starrocks.com_starrocksclusters.yaml b/deploy/starrocks.com_starrocksclusters.yaml index c4bd2802..91fa046e 100644 --- a/deploy/starrocks.com_starrocksclusters.yaml +++ b/deploy/starrocks.com_starrocksclusters.yaml @@ -417,6 +417,10 @@ spec: additionalProperties: type: string type: object + args: + items: + type: string + type: array beEnvVars: items: properties: @@ -504,6 +508,10 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + items: + type: string + type: array configMapInfo: properties: configMapName: @@ -2359,6 +2367,10 @@ spec: additionalProperties: type: string type: object + args: + items: + type: string + type: array autoScalingPolicy: properties: hpaPolicy: @@ -2777,6 +2789,10 @@ spec: - name type: object type: array + command: + items: + type: string + type: array configMapInfo: properties: configMapName: @@ -5253,6 +5269,10 @@ spec: additionalProperties: type: string type: object + args: + items: + type: string + type: array capabilities: properties: add: @@ -5276,6 +5296,10 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + items: + type: string + type: array configMapInfo: properties: configMapName: diff --git a/deploy/starrocks.com_starrockswarehouses.yaml b/deploy/starrocks.com_starrockswarehouses.yaml index c1b3610d..148ae018 100644 --- a/deploy/starrocks.com_starrockswarehouses.yaml +++ b/deploy/starrocks.com_starrockswarehouses.yaml @@ -408,6 +408,10 @@ spec: additionalProperties: type: string type: object + args: + items: + type: string + type: array autoScalingPolicy: properties: hpaPolicy: @@ -762,6 +766,10 @@ spec: x-kubernetes-list-map-keys: - name x-kubernetes-list-type: map + command: + items: + type: string + type: array configMapInfo: properties: configMapName: diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/_helpers.tpl b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/_helpers.tpl index 994d10b0..507bd0aa 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/_helpers.tpl +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/_helpers.tpl @@ -131,6 +131,26 @@ be.conf: | {{- print "/opt/starrocks/cn/log" }} {{- 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 */}} @@ -227,6 +247,33 @@ the first 8 digits are taken, which will be used as the annotations for pods. {{- 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 -}} diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/configmaps.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/configmaps.yaml index 494dd9eb..10ce4880 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/configmaps.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/configmaps.yaml @@ -11,4 +11,40 @@ data: {{- end }} {{- end }} --- -{{- end }} \ No newline at end of file +{{- 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 }} diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml index a08786b1..8d815f6c 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml @@ -17,6 +17,11 @@ spec: {{- toYaml .Values.starrocksFESpec.initContainers | nindent 6 }} {{- 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 }} {{- /* @@ -58,6 +63,9 @@ spec: 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 }} @@ -174,14 +182,21 @@ spec: subPath: {{ .subPath }} {{- end }} {{- end }} - {{- if .Values.starrocksFESpec.configMaps }} + {{- 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 @@ -222,6 +237,11 @@ spec: {{- toYaml .Values.starrocksBeSpec.initContainers | nindent 6 }} {{- 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 }} {{- /* @@ -266,6 +286,9 @@ spec: {{- 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 }} @@ -392,14 +415,21 @@ spec: subPath: {{ .subPath }} {{- end }} {{- end }} - {{- if .Values.starrocksBeSpec.configMaps }} + {{- 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 @@ -440,6 +470,11 @@ spec: {{- toYaml .Values.starrocksCnSpec.initContainers | nindent 6 }} {{- 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 .Values.starrocksCnSpec.replicas }} replicas: {{ .Values.starrocksCnSpec.replicas }} {{- end }} @@ -605,6 +640,9 @@ spec: {{- 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 }} @@ -617,14 +655,21 @@ spec: subPath: {{ .subPath }} {{- end }} {{- end }} - {{- if .Values.starrocksCnSpec.configMaps }} + {{- 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 diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml index 0be0bb1b..11d5bd6d 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml @@ -127,6 +127,16 @@ starrocksFESpec: repository: starrocks/fe-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for FE. + # By default, operator will use '/opt/starrocks/fe_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-fe-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start fe" + # exec /opt/starrocks/fe_entrypoint.sh $FE_SERVICE_NAME # add annotations for fe pods. For example, if you want to config monitor for datadog, you can config the annotations. annotations: {} # If runAsNonRoot is true, the container is run as non-root user. @@ -341,6 +351,16 @@ starrocksCnSpec: repository: starrocks/cn-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for CN. + # By default, operator will use '/opt/starrocks/cn_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-cn-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start cn" + # exec /opt/starrocks/cn_entrypoint.sh $FE_SERVICE_NAME # serviceAccount for cn access cloud service. serviceAccount: "" # add annotations for cn pods. example, if you want to config monitor for datadog, you can config the annotations. @@ -580,6 +600,16 @@ starrocksBeSpec: repository: starrocks/be-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for BE. + # By default, operator will use '/opt/starrocks/be_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-be-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start BE" + # exec /opt/starrocks/be_entrypoint.sh $FE_SERVICE_NAME # serviceAccount for be access cloud service. serviceAccount: "" # add annotations for be pods. example, if you want to config monitor for datadog, you can config the annotations. diff --git a/helm-charts/charts/kube-starrocks/values.yaml b/helm-charts/charts/kube-starrocks/values.yaml index 47cb618b..2b7e89df 100644 --- a/helm-charts/charts/kube-starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/values.yaml @@ -235,6 +235,16 @@ starrocks: repository: starrocks/fe-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for FE. + # By default, operator will use '/opt/starrocks/fe_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-fe-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start fe" + # exec /opt/starrocks/fe_entrypoint.sh $FE_SERVICE_NAME # add annotations for fe pods. For example, if you want to config monitor for datadog, you can config the annotations. annotations: {} # If runAsNonRoot is true, the container is run as non-root user. @@ -449,6 +459,16 @@ starrocks: repository: starrocks/cn-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for CN. + # By default, operator will use '/opt/starrocks/cn_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-cn-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start cn" + # exec /opt/starrocks/cn_entrypoint.sh $FE_SERVICE_NAME # serviceAccount for cn access cloud service. serviceAccount: "" # add annotations for cn pods. example, if you want to config monitor for datadog, you can config the annotations. @@ -688,6 +708,16 @@ starrocks: repository: starrocks/be-ubuntu tag: "" imagePullPolicy: IfNotPresent + # Specify the entrypoint for BE. + # By default, operator will use '/opt/starrocks/be_entrypoint.sh' as command, and use '$(FE_SERVICE_NAME)' as args in container spec. + # If entrypoint is set, the command will be ["bash", "-c"], and the args will be filename of the entrypoint script. + # A configmap with name $cluster-be-entrypoint-script will be created, and the script will be mounted to /etc/starrocks/entrypoint.sh + # Pod will be restarted if the entrypoint script is updated. + entrypoint: {} + # script: | + # #! /bin/bash + # echo "do something before start BE" + # exec /opt/starrocks/be_entrypoint.sh $FE_SERVICE_NAME # serviceAccount for be access cloud service. serviceAccount: "" # add annotations for be pods. example, if you want to config monitor for datadog, you can config the annotations. diff --git a/pkg/apis/starrocks/v1/component_type.go b/pkg/apis/starrocks/v1/component_type.go index b4e3fb5c..72092bcb 100644 --- a/pkg/apis/starrocks/v1/component_type.go +++ b/pkg/apis/starrocks/v1/component_type.go @@ -65,6 +65,26 @@ type StarRocksComponentSpec struct { // You can use this field to launch helper containers that run before the main container starts. // See https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#Container for how to configure a container. InitContainers []corev1.Container `json:"initContainers,omitempty"` + + // Entrypoint array. Not executed within a shell. + // If this is not provided, it will use default entrypoint for different components: + // 1. For FE, it will use /opt/starrocks/fe_entrypoint.sh as the entrypoint. + // 2. For BE, it will use /opt/starrocks/be_entrypoint.sh as the entrypoint. + // 3. For CN, it will use /opt/starrocks/cn_entrypoint.sh as the entrypoint. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Command []string `json:"command,omitempty"` + + // Arguments to the entrypoint. + // If this is not provided, it will use $(FE_SERVICE_NAME) for all components. + // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable + // cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced + // to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will + // produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless + // of whether the variable exists or not. Cannot be updated. + // More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell + // +optional + Args []string `json:"args,omitempty"` } // StarRocksComponentStatus represents the status of a starrocks component. @@ -105,6 +125,14 @@ type ConfigMapReference MountInfo type SecretReference MountInfo +// MountInfo +// The reason why we do not support defaultMode is that we use hash.HashObject to +// calculate the actual volume name. This volume name is used in pod template of statefulset, +// and if this MountInfo type has been changed, the volume name will be changed too, and +// that will make pods restart. +// The default mode is 0644, and in order to support to set permission information for a configMap +// or secret, we add should specify the subPath and specify a command or args in the container. +// And It will be set 0755. type MountInfo struct { // This must match the Name of a ConfigMap or Secret in the same namespace, and // the length of name must not more than 50 characters. @@ -116,6 +144,7 @@ type MountInfo struct { // SubPath within the volume from which the container's volume should be mounted. // Defaults to "" (volume's root). + // +optional SubPath string `json:"subPath,omitempty"` } @@ -153,3 +182,11 @@ func (spec *StarRocksComponentSpec) GetSidecars() []corev1.Container { func (spec *StarRocksComponentSpec) GetInitContainers() []corev1.Container { return spec.InitContainers } + +func (spec *StarRocksComponentSpec) GetCommand() []string { + return spec.Command +} + +func (spec *StarRocksComponentSpec) GetArgs() []string { + return spec.Args +} diff --git a/pkg/apis/starrocks/v1/load_type.go b/pkg/apis/starrocks/v1/load_type.go index ba4c73e6..1d86823c 100644 --- a/pkg/apis/starrocks/v1/load_type.go +++ b/pkg/apis/starrocks/v1/load_type.go @@ -21,6 +21,8 @@ type loadInterface interface { GetStorageVolumes() []StorageVolume GetServiceAccount() string GetImagePullPolicy() corev1.PullPolicy + GetCommand() []string + GetArgs() []string } type StarRocksLoadSpec struct { diff --git a/pkg/apis/starrocks/v1/starrockscluster_types.go b/pkg/apis/starrocks/v1/starrockscluster_types.go index 82abad02..2cad9028 100644 --- a/pkg/apis/starrocks/v1/starrockscluster_types.go +++ b/pkg/apis/starrocks/v1/starrockscluster_types.go @@ -198,21 +198,37 @@ func (spec *StarRocksFeProxySpec) GetTerminationGracePeriodSeconds() *int64 { } // GetCapabilities -// fe proxy does not have field Capabilities +// fe proxy does not have field Capabilities, the reason why implementing this method is +// // that StarRocksFeProxySpec needs to implement SpecInterface interface func (spec *StarRocksFeProxySpec) GetCapabilities() *corev1.Capabilities { return nil } // GetSidecars -// fe proxy does not have field Sidecars +// fe proxy does not have field Sidecars, the reason why implementing this method is +// // that StarRocksFeProxySpec needs to implement SpecInterface interface func (spec *StarRocksFeProxySpec) GetSidecars() []corev1.Container { return nil } // GetInitContainers -// fe proxy does not have field InitContainers +// fe proxy does not have field InitContainers, the reason why implementing this method is +// // that StarRocksFeProxySpec needs to implement SpecInterface interface func (spec *StarRocksFeProxySpec) GetInitContainers() []corev1.Container { return nil } +// GetCommand +// fe proxy does not have field command, the reason why implementing this method is +// // that StarRocksFeProxySpec needs to implement SpecInterface interface +func (spec *StarRocksFeProxySpec) GetCommand() []string { + return nil +} + +// GetArgs +// fe proxy does not have field args +func (spec *StarRocksFeProxySpec) GetArgs() []string { + return nil +} + // Phase is defined under status, e.g. // 1. StarRocksClusterStatus.Phase represents the phase of starrocks cluster. // 2. StarRocksWarehouseStatus.Phase represents the phase of starrocks warehouse. diff --git a/pkg/apis/starrocks/v1/zz_generated.deepcopy.go b/pkg/apis/starrocks/v1/zz_generated.deepcopy.go index d485b595..2f27c8ad 100644 --- a/pkg/apis/starrocks/v1/zz_generated.deepcopy.go +++ b/pkg/apis/starrocks/v1/zz_generated.deepcopy.go @@ -416,6 +416,16 @@ func (in *StarRocksComponentSpec) DeepCopyInto(out *StarRocksComponentSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StarRocksComponentSpec. diff --git a/pkg/common/hash/hash_test.go b/pkg/common/hash/hash_test.go index ed7c4a5b..eacc3ba8 100644 --- a/pkg/common/hash/hash_test.go +++ b/pkg/common/hash/hash_test.go @@ -1,6 +1,7 @@ package hash_test import ( + "fmt" "testing" corev1 "k8s.io/api/core/v1" @@ -15,6 +16,10 @@ func TestHashObject(t *testing.T) { type args struct { object interface{} } + type Object struct { + name string + } + tests := []struct { name string args args @@ -119,6 +124,67 @@ func TestHashObject(t *testing.T) { } } -type Object struct { - name string +func TestTwoObject(t *testing.T) { + type T1 struct { + name string + age int + } + o1 := T1{ + name: "test", + age: 10, + } + + type T2 struct { + name string + age int + } + o2 := T2{ + name: "test", + age: 10, + } + + o3 := struct { + name string + age int + }{ + name: "test", + age: 10, + } + o4 := T1{ + name: "test", + } + + if hash.HashObject(o1) != hash.HashObject(o2) { + fmt.Println("two object has different types") + } + + if hash.HashObject(o1) != hash.HashObject(o3) { + fmt.Println("two object has different types") + } + + if hash.HashObject(o1) == hash.HashObject(o4) { + fmt.Println("two object has the same types and values") + } +} + +func TestTwoObject2(t *testing.T) { + a := int(10) + b := int(10) + type T1 struct { + name string + age *int + } + o1 := T1{ + name: "test", + age: &a, + } + + o2 := T1{ + name: "test", + age: &b, + } + + if hash.HashObject(o1) == hash.HashObject(o2) { + fmt.Println("two object has the same types and values") + } } diff --git a/pkg/k8sutils/templates/pod/mount.go b/pkg/k8sutils/templates/pod/mount.go index ddf181f0..b6c184db 100644 --- a/pkg/k8sutils/templates/pod/mount.go +++ b/pkg/k8sutils/templates/pod/mount.go @@ -91,8 +91,13 @@ func MountHostPathVolume(volumes []corev1.Volume, volumeMounts []corev1.VolumeMo return volumes, volumeMounts } -func MountConfigMaps(volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, +func MountConfigMaps(spec v1.SpecInterface, volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, references []v1.ConfigMapReference) ([]corev1.Volume, []corev1.VolumeMount) { + prerequisitesOfChangingMode := false + if spec != nil && (spec.GetCommand() != nil || spec.GetArgs() != nil) { + prerequisitesOfChangingMode = true + } + for _, reference := range references { volumeName := getVolumeName(v1.MountInfo(reference)) volumes = append(volumes, corev1.Volume{ @@ -102,6 +107,14 @@ func MountConfigMaps(volumes []corev1.Volume, volumeMounts []corev1.VolumeMount, LocalObjectReference: corev1.LocalObjectReference{ Name: reference.Name, }, + DefaultMode: func() *int32 { + if prerequisitesOfChangingMode && reference.SubPath != "" { + const executionPermission = int32(0755) + v := executionPermission + return &v + } + return nil + }(), }, }, }) diff --git a/pkg/k8sutils/templates/pod/mount_test.go b/pkg/k8sutils/templates/pod/mount_test.go index 45fcb4d8..ebbd7123 100644 --- a/pkg/k8sutils/templates/pod/mount_test.go +++ b/pkg/k8sutils/templates/pod/mount_test.go @@ -192,7 +192,7 @@ func TestMountConfigMaps(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, got1 := MountConfigMaps(tt.args.volumes, tt.args.volumeMounts, tt.args.configmaps) + got, got1 := MountConfigMaps(nil, tt.args.volumes, tt.args.volumeMounts, tt.args.configmaps) if !reflect.DeepEqual(got, tt.want) { t.Errorf("MountSecrets() got = %v, want %v", got, tt.want) } diff --git a/pkg/k8sutils/templates/pod/spec.go b/pkg/k8sutils/templates/pod/spec.go index 18a30ff3..29e973bf 100644 --- a/pkg/k8sutils/templates/pod/spec.go +++ b/pkg/k8sutils/templates/pod/spec.go @@ -316,3 +316,32 @@ func ContainerSecurityContext(spec v1.SpecInterface) *corev1.SecurityContext { Capabilities: spec.GetCapabilities(), } } + +func getDefaultEntrypointScript(spec v1.SpecInterface) string { + switch spec.(type) { + case *v1.StarRocksFeSpec: + return "/opt/starrocks/fe_entrypoint.sh" + case *v1.StarRocksBeSpec: + return "/opt/starrocks/be_entrypoint.sh" + case *v1.StarRocksCnSpec: + return "/opt/starrocks/cn_entrypoint.sh" + } + return "" +} + +func ContainerCommand(spec v1.SpecInterface) []string { + if spec.GetCommand() != nil { + return spec.GetCommand() + } + + script := getDefaultEntrypointScript(spec) + return []string{script} +} + +func ContainerArgs(spec v1.SpecInterface) []string { + if spec.GetArgs() != nil { + return spec.GetArgs() + } + + return []string{"$(FE_SERVICE_NAME)"} +} diff --git a/pkg/k8sutils/templates/pod/spec_test.go b/pkg/k8sutils/templates/pod/spec_test.go index a85c2585..9917d463 100644 --- a/pkg/k8sutils/templates/pod/spec_test.go +++ b/pkg/k8sutils/templates/pod/spec_test.go @@ -21,6 +21,7 @@ import ( "testing" corev1 "k8s.io/api/core/v1" + "sigs.k8s.io/yaml" v1 "github.com/StarRocks/starrocks-kubernetes-operator/pkg/apis/starrocks/v1" rutils "github.com/StarRocks/starrocks-kubernetes-operator/pkg/common/resource_utils" @@ -533,3 +534,60 @@ func TestContainerSecurityContext(t *testing.T) { }) } } + +func TestK8sYamlMarshal(t *testing.T) { + type args struct { + data interface{} + } + tests := []struct { + name string + args args + want string + }{ + { + name: "input is map", + args: args{ + data: map[string]string{ + "hello": `metadata: + annotations: + app.starrocks.io/fe-config-hash: e615d940 + creationTimestamp: "2023-12-13T05:25:55Z" +`, + }, + }, + want: `hello: | + metadata: + annotations: + app.starrocks.io/fe-config-hash: e615d940 + creationTimestamp: "2023-12-13T05:25:55Z" +`, + }, + { + name: "input is slice", + args: args{ + data: []string{ + `metadata: + annotations: + app.starrocks.io/fe-config-hash: e615d940 + creationTimestamp: "2023-12-13T05:25:55Z" +`, + }, + }, + want: `- | + metadata: + annotations: + app.starrocks.io/fe-config-hash: e615d940 + creationTimestamp: "2023-12-13T05:25:55Z" +`, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got, err := yaml.Marshal(tt.args.data); err != nil { + t.Errorf("yaml marshal failed: %v", err) + } else if string(got) != tt.want { + t.Errorf("yaml marshal not expected, got: \n%v\n\nwant: \n%v\n", string(got), tt.want) + } + }) + } +} diff --git a/pkg/subcontrollers/be/be_pod.go b/pkg/subcontrollers/be/be_pod.go index 094f8ac7..2355b914 100644 --- a/pkg/subcontrollers/be/be_pod.go +++ b/pkg/subcontrollers/be/be_pod.go @@ -57,7 +57,7 @@ func (be *BeController) buildPodTemplate(src *srapi.StarRocksCluster, config map // mount configmap, secrets to pod if needed vols, volumeMounts = pod.MountConfigMapInfo(vols, volumeMounts, beSpec.ConfigMapInfo, _beConfigPath) - vols, volumeMounts = pod.MountConfigMaps(vols, volumeMounts, beSpec.ConfigMaps) + vols, volumeMounts = pod.MountConfigMaps(beSpec, vols, volumeMounts, beSpec.ConfigMaps) vols, volumeMounts = pod.MountSecrets(vols, volumeMounts, beSpec.Secrets) if err := k8sutils.CheckVolumes(vols, volumeMounts); err != nil { return nil, err @@ -69,8 +69,8 @@ func (be *BeController) buildPodTemplate(src *srapi.StarRocksCluster, config map beContainer := corev1.Container{ Name: srapi.DEFAULT_BE, Image: beSpec.Image, - Command: []string{"/opt/starrocks/be_entrypoint.sh"}, - Args: []string{"$(FE_SERVICE_NAME)"}, + Command: pod.ContainerCommand(beSpec), + Args: pod.ContainerArgs(beSpec), Ports: pod.Ports(beSpec, config), Env: envs, Resources: beSpec.ResourceRequirements, diff --git a/pkg/subcontrollers/cn/cn_pod.go b/pkg/subcontrollers/cn/cn_pod.go index a3dca56c..ddbda113 100644 --- a/pkg/subcontrollers/cn/cn_pod.go +++ b/pkg/subcontrollers/cn/cn_pod.go @@ -54,7 +54,7 @@ func (cc *CnController) buildPodTemplate(ctx context.Context, object srobject.St // mount configmap, secrets to pod if needed vols, volumeMounts = pod.MountConfigMapInfo(vols, volumeMounts, cnSpec.ConfigMapInfo, _cnConfigPath) - vols, volumeMounts = pod.MountConfigMaps(vols, volumeMounts, cnSpec.ConfigMaps) + vols, volumeMounts = pod.MountConfigMaps(cnSpec, vols, volumeMounts, cnSpec.ConfigMaps) vols, volumeMounts = pod.MountSecrets(vols, volumeMounts, cnSpec.Secrets) if err := k8sutils.CheckVolumes(vols, volumeMounts); err != nil { return nil, err @@ -79,8 +79,8 @@ func (cc *CnController) buildPodTemplate(ctx context.Context, object srobject.St cnContainer := corev1.Container{ Name: srapi.DEFAULT_CN, Image: cnSpec.Image, - Command: []string{"/opt/starrocks/cn_entrypoint.sh"}, - Args: []string{"$(FE_SERVICE_NAME)"}, + Command: pod.ContainerCommand(cnSpec), + Args: pod.ContainerArgs(cnSpec), Ports: pod.Ports(cnSpec, config), Env: envs, Resources: cnSpec.ResourceRequirements, diff --git a/pkg/subcontrollers/fe/fe_pod.go b/pkg/subcontrollers/fe/fe_pod.go index 8a131ba8..b69c986c 100644 --- a/pkg/subcontrollers/fe/fe_pod.go +++ b/pkg/subcontrollers/fe/fe_pod.go @@ -52,7 +52,7 @@ func (fc *FeController) buildPodTemplate(src *srapi.StarRocksCluster, config map // mount configmap, secrets to pod if needed vols, volMounts = pod.MountConfigMapInfo(vols, volMounts, feSpec.ConfigMapInfo, _feConfigPath) - vols, volMounts = pod.MountConfigMaps(vols, volMounts, feSpec.ConfigMaps) + vols, volMounts = pod.MountConfigMaps(feSpec, vols, volMounts, feSpec.ConfigMaps) vols, volMounts = pod.MountSecrets(vols, volMounts, feSpec.Secrets) if err := k8sutils.CheckVolumes(vols, volMounts); err != nil { return nil, err @@ -64,8 +64,8 @@ func (fc *FeController) buildPodTemplate(src *srapi.StarRocksCluster, config map feContainer := corev1.Container{ Name: srapi.DEFAULT_FE, Image: feSpec.Image, - Command: []string{"/opt/starrocks/fe_entrypoint.sh"}, - Args: []string{"$(FE_SERVICE_NAME)"}, + Command: pod.ContainerCommand(feSpec), + Args: pod.ContainerArgs(feSpec), Ports: pod.Ports(feSpec, config), Env: envs, Resources: feSpec.ResourceRequirements, diff --git a/pkg/subcontrollers/feproxy/feproxy_controller.go b/pkg/subcontrollers/feproxy/feproxy_controller.go index 070b2563..ffff09c4 100644 --- a/pkg/subcontrollers/feproxy/feproxy_controller.go +++ b/pkg/subcontrollers/feproxy/feproxy_controller.go @@ -197,7 +197,7 @@ func (controller *FeProxyController) buildPodTemplate(src *srapi.StarRocksCluste feProxySpec := src.Spec.StarRocksFeProxySpec vols, volumeMounts := pod.MountStorageVolumes(feProxySpec) - vols, volumeMounts = pod.MountConfigMaps(vols, volumeMounts, []srapi.ConfigMapReference{ + vols, volumeMounts = pod.MountConfigMaps(feProxySpec, vols, volumeMounts, []srapi.ConfigMapReference{ { Name: load.Name(src.Name, feProxySpec), MountPath: "/etc/nginx",