This is an automated email from the ASF dual-hosted git repository.

zhouky pushed a commit to branch branch-0.3
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/branch-0.3 by this push:
     new f1e05753a [CELEBORN-969][HELM] Allow user set priorityClass used by 
celeborn pods
f1e05753a is described below

commit f1e05753a96274278ea7be22fb48f88fda17c913
Author: camper42 <[email protected]>
AuthorDate: Thu Sep 14 11:39:04 2023 +0800

    [CELEBORN-969][HELM] Allow user set priorityClass used by celeborn pods
    
    ### What changes were proposed in this pull request?
    
    Allow user set priorityClass used by celeborn pods
    
    ### Why are the changes needed?
    
    Allow user set a proper priorityClass to avoid unwanted evict happens.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, default values change nothing.
    
    ### How was this patch tested?
    
    Run test locally before make a pull request
    
    `helm template test charts/celeborn > new_rendered.yaml` && `diff 
old_rendered.yaml new_rendered.yaml`
    
    Closes #1902 from camper42/priority-class.
    
    Authored-by: camper42 <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
    (cherry picked from commit 3c8d89ca990b593f9302d6b8bb49f4f517bb6ec3)
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 .../celeborn/templates/master-priorityclass.yaml   | 31 ++++++++++++++++++++++
 charts/celeborn/templates/master-statefulset.yaml  |  5 +++-
 .../celeborn/templates/worker-priorityclass.yaml   | 31 ++++++++++++++++++++++
 charts/celeborn/templates/worker-statefulset.yaml  |  3 +++
 charts/celeborn/values.yaml                        | 16 +++++++++++
 5 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/charts/celeborn/templates/master-priorityclass.yaml 
b/charts/celeborn/templates/master-priorityclass.yaml
new file mode 100644
index 000000000..753fc00b9
--- /dev/null
+++ b/charts/celeborn/templates/master-priorityclass.yaml
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+{{- if .Values.priorityClass.master.create }}
+apiVersion: scheduling.k8s.io/v1
+kind: PriorityClass
+metadata:
+  name: {{ .Values.priorityClass.master.name | default (printf 
"%s-master-priority" (.Release.Name)) }}
+  labels:
+    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
+    app.kubernetes.io/name: {{ .Chart.Name }}
+    app.kubernetes.io/instance: {{ .Release.Name }}
+    app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+    app.kubernetes.io/managed-by: {{ .Release.Service }}
+    {{- include "celeborn.labels" . | nindent 4 }}
+value: {{ .Values.priorityClass.master.value }}
+{{- end }}
diff --git a/charts/celeborn/templates/master-statefulset.yaml 
b/charts/celeborn/templates/master-statefulset.yaml
index 7b83aab67..a69cb83f2 100644
--- a/charts/celeborn/templates/master-statefulset.yaml
+++ b/charts/celeborn/templates/master-statefulset.yaml
@@ -67,6 +67,9 @@ spec:
       tolerations:
         {{- toYaml . | nindent 8 }}
       {{- end }}
+      {{- if or .Values.priorityClass.master.name 
.Values.priorityClass.master.create }}
+      priorityClassName: {{ .Values.priorityClass.master.name | default 
(printf "%s-master-priority" (.Release.Name)) }}
+      {{- end }}
       {{- with .Values.securityContext }}
       securityContext:
         {{- toYaml . | nindent 8 }}
@@ -120,7 +123,7 @@ spec:
           - name: {{ $key }}
             value: {{ $val | quote }}
           {{- end}}
-      terminationGracePeriodSeconds: 30 
+      terminationGracePeriodSeconds: 30
       volumes:
         - configMap:
             name: {{ .Release.Name }}-conf
diff --git a/charts/celeborn/templates/worker-priorityclass.yaml 
b/charts/celeborn/templates/worker-priorityclass.yaml
new file mode 100644
index 000000000..371f04628
--- /dev/null
+++ b/charts/celeborn/templates/worker-priorityclass.yaml
@@ -0,0 +1,31 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+{{- if .Values.priorityClass.worker.create }}
+apiVersion: scheduling.k8s.io/v1
+kind: PriorityClass
+metadata:
+  name: {{ .Values.priorityClass.worker.name | default (printf 
"%s-worker-priority" (.Release.Name)) }}
+  labels:
+    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
+    app.kubernetes.io/name: {{ .Chart.Name }}
+    app.kubernetes.io/instance: {{ .Release.Name }}
+    app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+    app.kubernetes.io/managed-by: {{ .Release.Service }}
+    {{- include "celeborn.labels" . | nindent 4 }}
+value: {{ .Values.priorityClass.worker.value }}
+{{- end }}
diff --git a/charts/celeborn/templates/worker-statefulset.yaml 
b/charts/celeborn/templates/worker-statefulset.yaml
index 7b9f0ad53..19df75577 100644
--- a/charts/celeborn/templates/worker-statefulset.yaml
+++ b/charts/celeborn/templates/worker-statefulset.yaml
@@ -67,6 +67,9 @@ spec:
       tolerations:
         {{- toYaml . | nindent 8 }}
       {{- end }}
+      {{- if or .Values.priorityClass.worker.name 
.Values.priorityClass.worker.create }}
+      priorityClassName: {{ .Values.priorityClass.worker.name | default 
(printf "%s-worker-priority" (.Release.Name)) }}
+      {{- end }}
       {{- with .Values.securityContext }}
       securityContext:
         {{- toYaml . | nindent 8 }}
diff --git a/charts/celeborn/values.yaml b/charts/celeborn/values.yaml
index 2d754f58a..fe295f84b 100644
--- a/charts/celeborn/values.yaml
+++ b/charts/celeborn/values.yaml
@@ -138,6 +138,22 @@ resources: {}
   #    cpu: 100m
   #    memory: 128Mi
 
+# priorityClass used for Celeborn pods
+priorityClass:
+  master:
+    # Specifies whether a priorityClass should be created
+    create: false
+    # Specifies priorityClass name to be used (created if `create: true`)
+    name: ~
+    # half of system-cluster-critical by default
+    value: 1000000000
+
+  worker:
+    create: false
+    name: ~
+    # celeborn master minus 1000
+    value: 999999000
+
 podAnnotations: {}
 
 affinity:

Reply via email to