[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 <camper.xlii@gmail.com>
Signed-off-by: zky.zhoukeyong <zky.zhoukeyong@alibaba-inc.com>
This commit is contained in:
camper42 2023-09-14 11:39:04 +08:00 committed by zky.zhoukeyong
parent 0bf42013f0
commit 3c8d89ca99
5 changed files with 85 additions and 1 deletions

View File

@ -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 }}

View File

@ -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

View File

@ -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 }}

View File

@ -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 }}

View File

@ -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: