From 0f857ba701b4a26f22458205bf70b5c0070cab64 Mon Sep 17 00:00:00 2001 From: "Amonpongitsara, Jenwit" Date: Tue, 13 May 2025 10:43:12 +0700 Subject: [PATCH 1/3] [Enhancement] support priorityClassName (#642) --- .../starrocks.com_starrocksclusters.yaml | 24 +++++++++++++++++++ .../starrocks.com_starrockswarehouses.yaml | 6 +++++ deploy/starrocks.com_starrocksclusters.yaml | 8 +++++++ deploy/starrocks.com_starrockswarehouses.yaml | 2 ++ .../starrocks/templates/starrockscluster.yaml | 12 ++++++++++ .../charts/starrocks/values.yaml | 16 +++++++++++++ helm-charts/charts/kube-starrocks/values.yaml | 20 ++++++++++++++-- pkg/apis/starrocks/v1/load_type.go | 7 ++++++ pkg/k8sutils/templates/pod/spec.go | 1 + 9 files changed, 94 insertions(+), 2 deletions(-) diff --git a/config/crd/bases/starrocks.com_starrocksclusters.yaml b/config/crd/bases/starrocks.com_starrocksclusters.yaml index 8c23fca3..59dade4e 100644 --- a/config/crd/bases/starrocks.com_starrocksclusters.yaml +++ b/config/crd/bases/starrocks.com_starrocksclusters.yaml @@ -2634,6 +2634,12 @@ spec: type: string description: the pod labels for user select or classify pods. type: object + priorityClassName: + description: |- + If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + type: string readOnlyRootFilesystem: description: "Whether this container has a read-only root filesystem.\nDefault is false.\nNote that:\n\t1. This field cannot be set when spec.os.name @@ -7637,6 +7643,12 @@ spec: type: string description: the pod labels for user select or classify pods. type: object + priorityClassName: + description: |- + If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + type: string readOnlyRootFilesystem: description: "Whether this container has a read-only root filesystem.\nDefault is false.\nNote that:\n\t1. This field cannot be set when spec.os.name @@ -10534,6 +10546,12 @@ spec: type: string description: the pod labels for user select or classify pods. type: object + priorityClassName: + description: |- + If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + type: string readinessProbeFailureSeconds: description: |- ReadinessProbeFailureSeconds defines the total failure seconds of readiness Probe. @@ -13526,6 +13544,12 @@ spec: type: string description: the pod labels for user select or classify pods. type: object + priorityClassName: + description: |- + If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + type: string readOnlyRootFilesystem: description: "Whether this container has a read-only root filesystem.\nDefault is false.\nNote that:\n\t1. This field cannot be set when spec.os.name diff --git a/config/crd/bases/starrocks.com_starrockswarehouses.yaml b/config/crd/bases/starrocks.com_starrockswarehouses.yaml index 41c18540..07eb675a 100644 --- a/config/crd/bases/starrocks.com_starrockswarehouses.yaml +++ b/config/crd/bases/starrocks.com_starrockswarehouses.yaml @@ -3230,6 +3230,12 @@ spec: type: string description: the pod labels for user select or classify pods. type: object + priorityClassName: + description: |- + If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + type: string readOnlyRootFilesystem: description: "Whether this container has a read-only root filesystem.\nDefault is false.\nNote that:\n\t1. This field cannot be set when spec.os.name diff --git a/deploy/starrocks.com_starrocksclusters.yaml b/deploy/starrocks.com_starrocksclusters.yaml index 11088aba..8342ed60 100644 --- a/deploy/starrocks.com_starrocksclusters.yaml +++ b/deploy/starrocks.com_starrocksclusters.yaml @@ -1289,6 +1289,8 @@ spec: additionalProperties: type: string type: object + priorityClassName: + type: string readOnlyRootFilesystem: type: boolean readinessProbeFailureSeconds: @@ -3662,6 +3664,8 @@ spec: additionalProperties: type: string type: object + priorityClassName: + type: string readOnlyRootFilesystem: type: boolean readinessProbeFailureSeconds: @@ -4994,6 +4998,8 @@ spec: additionalProperties: type: string type: object + priorityClassName: + type: string readinessProbeFailureSeconds: format: int32 type: integer @@ -6387,6 +6393,8 @@ spec: additionalProperties: type: string type: object + priorityClassName: + type: string readOnlyRootFilesystem: type: boolean readinessProbeFailureSeconds: diff --git a/deploy/starrocks.com_starrockswarehouses.yaml b/deploy/starrocks.com_starrockswarehouses.yaml index 191c178e..f1504d68 100644 --- a/deploy/starrocks.com_starrockswarehouses.yaml +++ b/deploy/starrocks.com_starrockswarehouses.yaml @@ -1603,6 +1603,8 @@ spec: additionalProperties: type: string type: object + priorityClassName: + type: string readOnlyRootFilesystem: type: boolean readinessProbeFailureSeconds: 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 5671ed96..59d0bb19 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/templates/starrockscluster.yaml @@ -31,6 +31,9 @@ spec: {{- end }} replicas: {{ .Values.starrocksFESpec.replicas }} imagePullPolicy: {{ .Values.starrocksFESpec.imagePullPolicy }} + {{- if .Values.starrocksFESpec.priorityClassName }} + priorityClassName: {{ .Values.starrocksFESpec.priorityClassName }} + {{- end }} {{- if .Values.starrocksFESpec.maxUnavailablePods }} updateStrategy: rollingUpdate: @@ -296,6 +299,9 @@ spec: {{- end }} replicas: {{ .Values.starrocksBeSpec.replicas }} imagePullPolicy: {{ .Values.starrocksBeSpec.imagePullPolicy }} + {{- if .Values.starrocksBeSpec.priorityClassName }} + priorityClassName: {{ .Values.starrocksBeSpec.priorityClassName }} + {{- end }} {{- if .Values.starrocksBeSpec.maxUnavailablePods }} updateStrategy: rollingUpdate: @@ -593,6 +599,9 @@ spec: replicas: {{ .Values.starrocksCnSpec.replicas }} {{- end }} imagePullPolicy: {{ .Values.starrocksCnSpec.imagePullPolicy }} + {{- if .Values.starrocksCnSpec.priorityClassName }} + priorityClassName: {{ .Values.starrocksCnSpec.priorityClassName }} + {{- end }} {{- if .Values.starrocksCnSpec.maxUnavailablePods }} updateStrategy: rollingUpdate: @@ -888,6 +897,9 @@ spec: {{- end }} replicas: {{ .Values.starrocksFeProxySpec.replicas }} imagePullPolicy: {{ .Values.starrocksFeProxySpec.imagePullPolicy }} + {{- if .Values.starrocksFeProxySpec.priorityClassName }} + priorityClassName: {{ .Values.starrocksFeProxySpec.priorityClassName }} + {{- end }} resolver: {{ .Values.starrocksFeProxySpec.resolver }} {{- if .Values.starrocksFeProxySpec.resources }} {{- toYaml .Values.starrocksFeProxySpec.resources | nindent 4 }} diff --git a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml index 366322cf..b6c85f90 100644 --- a/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml @@ -467,6 +467,10 @@ starrocksFESpec: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: # spec for compute node, compute node provide compute function. starrocksCnSpec: @@ -817,6 +821,10 @@ starrocksCnSpec: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: # spec for component be, provide storage and compute function. starrocksBeSpec: @@ -1128,6 +1136,10 @@ starrocksBeSpec: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: # create secrets if necessary. secrets: [] @@ -1247,3 +1259,7 @@ starrocksFeProxySpec: # e.g. mount an emptyDir volume to /tmp # - name: tmp-data # mountPath: /tmp + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: diff --git a/helm-charts/charts/kube-starrocks/values.yaml b/helm-charts/charts/kube-starrocks/values.yaml index a5028a45..b337d57b 100644 --- a/helm-charts/charts/kube-starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/values.yaml @@ -584,6 +584,10 @@ starrocks: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: # spec for compute node, compute node provide compute function. starrocksCnSpec: @@ -934,7 +938,11 @@ starrocks: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: - + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: + # spec for component be, provide storage and compute function. starrocksBeSpec: # number of replicas to deploy. @@ -1245,7 +1253,11 @@ starrocks: # When this is set containers will be able to view and signal processes from other containers # in the same pod, and the first process in each container will not be assigned PID 1. shareProcessNamespace: - + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: + # create secrets if necessary. secrets: [] # e.g. create my-secret @@ -1364,3 +1376,7 @@ starrocks: # e.g. mount an emptyDir volume to /tmp # - name: tmp-data # mountPath: /tmp + # priorityClassName allows you to assign a [Kubernetes PriorityClass] + # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. + # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. + priorityClassName: diff --git a/pkg/apis/starrocks/v1/load_type.go b/pkg/apis/starrocks/v1/load_type.go index 48058a93..c3d8d64e 100644 --- a/pkg/apis/starrocks/v1/load_type.go +++ b/pkg/apis/starrocks/v1/load_type.go @@ -28,6 +28,7 @@ type loadInterface interface { GetImagePullPolicy() corev1.PullPolicy GetCommand() []string GetArgs() []string + GetPriorityClassName() string } type StarRocksLoadSpec struct { @@ -169,6 +170,12 @@ type StarRocksLoadSpec struct { // Optional: Default to false. // +optional ShareProcessNamespace *bool `json:"shareProcessNamespace,omitempty"` + + //If specified, Pods can have priority. Priority indicates the importance of a Pod relative to other Pods. If a Pod + //cannot be scheduled, the scheduler tries to preempt (evict) lower priority Pods to make scheduling + //More info: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption of the pending Pod possible. + // +optional + PriorityClassName string `json:"priorityClassName,omitempty"` } // StarRocksService defines external service for starrocks component. diff --git a/pkg/k8sutils/templates/pod/spec.go b/pkg/k8sutils/templates/pod/spec.go index 71f659b4..518ae931 100644 --- a/pkg/k8sutils/templates/pod/spec.go +++ b/pkg/k8sutils/templates/pod/spec.go @@ -279,6 +279,7 @@ func Spec(spec v1.SpecInterface, container corev1.Container, volumes []corev1.Vo SchedulerName: spec.GetSchedulerName(), AutomountServiceAccountToken: func() *bool { b := false; return &b }(), ShareProcessNamespace: spec.GetShareProcessNamespace(), + PriorityClassName: spec.GetPriorityClassName(), } return podSpec } From 322d798b7e3d5b82d3aed937bfa0ab0dba6905fc Mon Sep 17 00:00:00 2001 From: "Amonpongitsara, Jenwit" Date: Tue, 13 May 2025 11:55:19 +0700 Subject: [PATCH 2/3] add getPriorityClassName func --- pkg/apis/starrocks/v1/component_type.go | 4 ++++ pkg/apis/starrocks/v1/load_type.go | 4 ++++ pkg/apis/starrocks/v1/starrockscluster_types.go | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/pkg/apis/starrocks/v1/component_type.go b/pkg/apis/starrocks/v1/component_type.go index 9f011d09..7105a3af 100644 --- a/pkg/apis/starrocks/v1/component_type.go +++ b/pkg/apis/starrocks/v1/component_type.go @@ -307,3 +307,7 @@ const ( DRPhaseDoing DRPhase = "doing" DRPhaseDone DRPhase = "done" ) + +func (spec *StarRocksComponentSpec) GetPriorityClassName() string { + return spec.PriorityClassName +} diff --git a/pkg/apis/starrocks/v1/load_type.go b/pkg/apis/starrocks/v1/load_type.go index c3d8d64e..910ec0b0 100644 --- a/pkg/apis/starrocks/v1/load_type.go +++ b/pkg/apis/starrocks/v1/load_type.go @@ -340,3 +340,7 @@ func (spec *StarRocksLoadSpec) GetImagePullPolicy() corev1.PullPolicy { } return spec.ImagePullPolicy } + +func (spec *StarRocksLoadSpec) GetPriorityClassName() string { + return spec.PriorityClassName +} diff --git a/pkg/apis/starrocks/v1/starrockscluster_types.go b/pkg/apis/starrocks/v1/starrockscluster_types.go index 98fb67ac..705e8e67 100644 --- a/pkg/apis/starrocks/v1/starrockscluster_types.go +++ b/pkg/apis/starrocks/v1/starrockscluster_types.go @@ -258,6 +258,10 @@ func (spec *StarRocksFeProxySpec) IsReadOnlyRootFilesystem() *bool { // that StarRocksFeProxySpec needs to implement SpecInterface interface func (spec *StarRocksFeProxySpec) GetSysctls() []corev1.Sysctl { return nil } +func (spec *StarRocksFeProxySpec) GetPriorityClassName() string { + return spec.StarRocksLoadSpec.GetPriorityClassName() +} + // 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. From 312e53c6262226b94a1f93225c0ce8a1853db054 Mon Sep 17 00:00:00 2001 From: "Amonpongitsara, Jenwit" Date: Tue, 13 May 2025 11:57:12 +0700 Subject: [PATCH 3/3] run create-parent-chart-values.sh --- helm-charts/charts/kube-starrocks/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm-charts/charts/kube-starrocks/values.yaml b/helm-charts/charts/kube-starrocks/values.yaml index b337d57b..fee861fc 100644 --- a/helm-charts/charts/kube-starrocks/values.yaml +++ b/helm-charts/charts/kube-starrocks/values.yaml @@ -942,7 +942,7 @@ starrocks: # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. priorityClassName: - + # spec for component be, provide storage and compute function. starrocksBeSpec: # number of replicas to deploy. @@ -1257,7 +1257,7 @@ starrocks: # to the pods of this component. This determines the scheduling priority of pods and their eviction order under resource pressure. # see https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass for more details. priorityClassName: - + # create secrets if necessary. secrets: [] # e.g. create my-secret