-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes rafting and routing to the leader issues.
Fixes #107 This commit makes a service for each pod by using the unique statefull set name label. These services ensure that there is a cluster ip reserved for each pod. The rafting uses these cluster ips. Orchestrator will proxy/route traffic to its leader. So, the main service can be used as entry point and all the trafic will be routed to the leader. See: https://github.com/github/orchestrator/blob/master/docs/configuration-raft.md See: presslabs/docker-orchestrator#8 Signed-off-by: Kevin Hellemun <17928966+OGKevin@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
120 additions
and
15 deletions.
There are no files selected for viewing
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,36 @@ | ||
{{- if .Values.orchestrator.ingress.enabled -}} | ||
{{- $fullName := include "mysql-operator.fullname" . -}} | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{ include "mysql-operator.labels" . | indent 4 }} | ||
{{- with .Values.orchestrator.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.orchestrator.ingress.tls }} | ||
tls: | ||
{{- range .Values.orchestrator.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.orchestrator.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
{{- range .paths }} | ||
- path: {{ . }} | ||
backend: | ||
serviceName: {{ $fullName }} | ||
servicePort: http | ||
{{- end }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,54 @@ | ||
{{- $fullName := include "mysql-operator.fullname" . }} | ||
{{- $replicas := int .Values.replicas -}} | ||
{{- $chart := include "mysql-operator.chart" . }} | ||
{{- range $i := until $replicas -}} | ||
{{/* | ||
this service is needed for rafting. https://github.com/presslabs/mysql-operator/issues/107 | ||
and for routing/proxying to the leader. | ||
*/}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ template "mysql-operator.orc-service-name" . }} | ||
name: "{{$fullName}}-{{$i}}-svc" | ||
labels: | ||
app: "{{$fullName}}" | ||
chart: {{$chart}} | ||
release: "{{ $.Release.Name }}" | ||
heritage: "{{ $.Release.Service }}" | ||
annotations: | ||
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: web | ||
port: 80 | ||
targetPort: 3000 | ||
- name: raft | ||
port: 10008 | ||
targetPort: 10008 | ||
selector: | ||
statefulset.kubernetes.io/pod-name: {{$fullName}}-{{$i}} | ||
--- | ||
{{end}} | ||
{{/*{orchestrator will make sure that this service always talks to the leader}*/}} | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: "{{ template "mysql-operator.fullname" . }}" | ||
labels: | ||
app: {{ template "mysql-operator.name" . }} | ||
chart: {{ template "mysql-operator.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
clusterIP: None | ||
# orchestrator nodes are ready only when the raft is ready and if the service doesn't publish | ||
# unready pods, pods will never get ready (deadlock) | ||
publishNotReadyAddresses: true | ||
ports: | ||
- name: raft | ||
port: 10008 | ||
targetPort: 10008 | ||
type: {{ .Values.orchestrator.service.type }} | ||
selector: | ||
app: {{ template "mysql-operator.name" . }} | ||
ports: | ||
- name: http | ||
port: {{ .Values.orchestrator.service.port }} | ||
protocol: TCP | ||
targetPort: 3000 | ||
{{- if .Values.orchestrator.service.nodePort }} | ||
nodePort: {{ .Values.orchestrator.service.nodePort }} | ||
{{- 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