diff --git a/charts/tidb-operator/templates/config/_scheduler-config-yaml.tpl b/charts/tidb-operator/templates/config/_scheduler-config-yaml.tpl index 9470c61b2d..d6d008fa3f 100644 --- a/charts/tidb-operator/templates/config/_scheduler-config-yaml.tpl +++ b/charts/tidb-operator/templates/config/_scheduler-config-yaml.tpl @@ -1,3 +1,24 @@ +{{- if semverCompare ">=1.23.0-0" .Capabilities.KubeVersion.GitVersion }} +apiVersion: kubescheduler.config.k8s.io/v1beta2 +kind: KubeSchedulerConfiguration +leaderElection: + leaderElect: true + resourceNamespace: {{ .Release.Namespace }} + {{- if eq .Values.appendReleaseSuffix true}} + resourceName: {{ .Values.scheduler.schedulerName }}-{{.Release.Name}} + {{- else }} + resourceName: {{ .Values.scheduler.schedulerName }} + {{- end }} +profiles: + - schedulerName: tidb-scheduler +extenders: + - urlPrefix: http://127.0.0.1:10262/scheduler + filterVerb: filter + preemptVerb: preempt + weight: 1 + enableHTTPS: false + httpTimeout: 30s +{{- else }} apiVersion: kubescheduler.config.k8s.io/v1beta1 kind: KubeSchedulerConfiguration leaderElection: @@ -19,3 +40,4 @@ extenders: weight: 1 enableHTTPS: false httpTimeout: 30s +{{- end }} diff --git a/charts/tidb-operator/templates/scheduler-deployment.yaml b/charts/tidb-operator/templates/scheduler-deployment.yaml index 81ac4a1649..d27872620e 100644 --- a/charts/tidb-operator/templates/scheduler-deployment.yaml +++ b/charts/tidb-operator/templates/scheduler-deployment.yaml @@ -69,11 +69,11 @@ spec: {{ toYaml .Values.scheduler.resources | indent 12 }} command: - kube-scheduler - - --port=10261 - --v={{ .Values.scheduler.logLevel }} {{- if $lgK8sV119 }} - --config=/etc/kubernetes/scheduler-config.yaml {{- else }} + - --port=10261 - --leader-elect=true - --lock-object-namespace={{ .Release.Namespace }} - --policy-configmap-namespace={{ .Release.Namespace }}