forked from pingcap/tidb-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extended scheduler to operator (pingcap#145)
* scheduler: add extended scheduler to operator
- Loading branch information
1 parent
9d99b83
commit 27a5603
Showing
125 changed files
with
9,980 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"kind" : "Policy", | ||
"apiVersion" : "v1", | ||
"predicates": [ | ||
{"name": "MatchInterPodAffinity"}, | ||
{"name": "CheckVolumeBinding"}, | ||
{"name": "CheckNodeCondition"}, | ||
{"name": "GeneralPredicates"}, | ||
{"name": "HostName"}, | ||
{"name": "PodFitsHostPorts"}, | ||
{"name": "MatchNodeSelector"}, | ||
{"name": "PodFitsResources"}, | ||
{"name": "NoDiskConflict"}, | ||
{"name": "PodToleratesNodeTaints"}, | ||
{"name": "CheckNodeMemoryPressure"}, | ||
{"name": "CheckNodeDiskPressure"} | ||
], | ||
"priorities": [ | ||
{"name": "EqualPriority", "weight": 1}, | ||
{"name": "ImageLocalityPriority", "weight": 1}, | ||
{"name": "LeastRequestedPriority", "weight": 1}, | ||
{"name": "BalancedResourceAllocation", "weight": 1}, | ||
{"name": "SelectorSpreadPriority", "weight": 1}, | ||
{"name": "NodePreferAvoidPodsPriority", "weight": 1}, | ||
{"name": "NodeAffinityPriority", "weight": 1}, | ||
{"name": "TaintTolerationPriority", "weight": 1}, | ||
{"name": "MostRequestedPriority", "weight": 1} | ||
], | ||
"extenders": [ | ||
{ | ||
"urlPrefix": "http://127.0.0.1:10262/scheduler", | ||
"filterVerb": "filter", | ||
"weight": 1, | ||
"httpTimeout": 30000000000, | ||
"enableHttps": false | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: tidb-scheduler | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
spec: | ||
replicas: {{ .Values.scheduler.replicas }} | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
spec: | ||
{{- if .Values.scheduler.serviceAccount }} | ||
serviceAccount: {{ .Values.scheduler.serviceAccount }} | ||
{{- end }} | ||
containers: | ||
- name: tidb-scheduler | ||
image: {{ .Values.operatorImage }} | ||
resources: | ||
{{ toYaml .Values.scheduler.resources | indent 12 }} | ||
command: | ||
- /usr/local/bin/tidb-scheduler | ||
- -v={{ .Values.scheduler.logLevel }} | ||
- -port=10262 | ||
- name: kube-scheduler | ||
image: {{ .Values.scheduler.kubeSchedulerImage }} | ||
resources: | ||
{{ toYaml .Values.scheduler.resources | indent 12 }} | ||
command: | ||
- kube-scheduler | ||
- --port=10261 | ||
- --leader-elect=true | ||
- --lock-object-name={{ .Values.scheduler.schedulerName }} | ||
- --lock-object-namespace={{ .Release.Namespace }} | ||
- --scheduler-name={{ .Values.scheduler.schedulerName }} | ||
- --v={{ .Values.scheduler.logLevel }} | ||
- --policy-configmap={{ .Values.scheduler.schedulerName }}-policy | ||
- --policy-configmap-namespace={{ .Release.Namespace }} |
13 changes: 13 additions & 0 deletions
13
charts/tidb-operator/templates/scheduler-policy-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: tidb-scheduler-policy | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
data: | ||
policy.cfg: |- | ||
{{ .Files.Get "files/scheduler-policy.json" | indent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
{{- if .Values.rbac.create }} | ||
kind: ServiceAccount | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ .Values.scheduler.serviceAccount }} | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
rules: | ||
{{- if .Values.clusterScoped }} | ||
- apiGroups: [""] | ||
resources: ["pods", "services", "configmaps", "replicationcontrollers", "persistentvolumeclaims", "endpoints"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["pods/binding"] | ||
verbs: ["create"] | ||
- apiGroups: [""] | ||
resources: ["endpoints", "events"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
- apiGroups: ["apps"] | ||
resources: ["statefulsets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["policy"] | ||
resources: ["poddisruptionbudgets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["extensions"] | ||
resources: ["replicasets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["storageclasses"] | ||
verbs: ["get", "list", "watch"] | ||
{{- end }} | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["persistentvolumes"] | ||
verbs: ["get", "list", "watch", "update"] | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.scheduler.serviceAccount }} | ||
namespace: {{ .Release.Namespace }} | ||
roleRef: | ||
kind: ClusterRole | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
apiGroup: rbac.authorization.k8s.io | ||
{{- if (not .Values.clusterScoped) }} | ||
--- | ||
kind: Role | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["pods", "services", "configmaps", "replicationcontrollers", "persistentvolumeclaims", "endpoints"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: [""] | ||
resources: ["pods/binding"] | ||
verbs: ["create"] | ||
- apiGroups: [""] | ||
resources: ["endpoints", "events"] | ||
verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
- apiGroups: ["apps"] | ||
resources: ["statefulsets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["policy"] | ||
resources: ["poddisruptionbudgets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["extensions"] | ||
resources: ["replicasets"] | ||
verbs: ["get", "list", "watch"] | ||
- apiGroups: ["storage.k8s.io"] | ||
resources: ["storageclasses"] | ||
verbs: ["get", "list", "watch"] | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
metadata: | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
labels: | ||
app.kubernetes.io/name: {{ template "chart.name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
app.kubernetes.io/component: scheduler | ||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ .Values.scheduler.serviceAccount }} | ||
roleRef: | ||
kind: Role | ||
name: {{ .Release.Name }}:tidb-scheduler | ||
apiGroup: rbac.authorization.k8s.io | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.