-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add extended scheduler to operator #145
Merged
Merged
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
d317598
stash
weekface 9260f71
Merge branch 'master' into scheduler
weekface 449176e
scheduler: add extended scheduler to operator
weekface a10f684
Merge branch 'master' into scheduler
weekface b5daa75
add e2e test specs
weekface 3d361c2
Merge branch 'master' into scheduler
tennix db67aa3
Merge branch 'master' into scheduler
weekface dfbb8d7
* add more unit tests
weekface 2aba403
Merge branch 'scheduler' of https://github.com/weekface/tidb-operator…
weekface d0b17b9
Merge branch 'master' into scheduler
weekface 728d347
address comment
weekface 29ad131
Merge branch 'scheduler' of https://github.com/weekface/tidb-operator…
weekface 27f0a8d
address comment
weekface 1e37aea
Merge branch 'master' into scheduler
weekface 504314b
Merge branch 'master' into scheduler
weekface b7e8d1e
address comment
weekface 2527a18
Merge branch 'scheduler' of https://github.com/weekface/tidb-operator…
weekface 2675d6f
make gofmt happy
weekface e42c89e
update vendor
weekface 098e853
Merge branch 'master' into scheduler
weekface 40fa7e2
disable cgo
weekface 682d8c2
address comment
weekface af54fb5
Merge branch 'master' into scheduler
weekface 60db86d
address comment
weekface File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add schedulerName on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This
schedulerName
used at here: https://github.com/weekface/tidb-operator/blob/449176ebcaa90b37be63156eb72a27fee5266a01/pkg/manager/member/pd_member_manager.go#L513