Skip to content

Commit

Permalink
Support multiple operator replicas with leader election
Browse files Browse the repository at this point in the history
eclipse-theia/theia-cloud#201

* allow to specify number of operator replicas
* allow operator to work with leases
  • Loading branch information
jfaltermeier committed Aug 1, 2023
1 parent 5b1b95f commit 1b1b5a2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/theia.cloud-base/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.8.1-v001-MS1
version: 0.8.1-v002

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 3 additions & 1 deletion charts/theia.cloud-base/templates/operator-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rules:
- theia.cloud
- networking.k8s.io
- apps
- coordination.k8s.io
resources:
- customresourcedefinitions
- appdefinitions
Expand All @@ -23,6 +24,7 @@ rules:
- services
- configmaps
- deployments
verbs: ["list", "create", "watch", "get", "patch", "delete"]
- leases
verbs: ["list", "create", "watch", "get", "patch", "delete", "update"]

{{- end }}
2 changes: 1 addition & 1 deletion charts/theia.cloud/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.8.1-v002-MS1
version: 0.8.1-v003

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
8 changes: 7 additions & 1 deletion charts/theia.cloud/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
app: operator
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
replicas: {{ tpl (.Values.operator.replicas | toString) . }}
selector:
matchLabels:
app: operator
Expand Down Expand Up @@ -71,6 +71,12 @@ spec:
- "{{ tpl (.Values.monitor.activityTracker.interval | toString) . }}"
{{- end }}
{{- end }}
- "--leaderLeaseDuration"
- "{{ tpl (.Values.operator.leaderElection.leaseDuration | toString) . }}"
- "--leaderRenewDeadline"
- "{{ tpl (.Values.operator.leaderElection.renewDeadline | toString) . }}"
- "--leaderRetryPeriod"
- "{{ tpl (.Values.operator.leaderElection.retryPeriod | toString) . }}"
{{- if .Values.operator.imagePullSecret }}
imagePullSecrets:
- name: {{ tpl (.Values.operator.imagePullSecret | toString) . }}
Expand Down
9 changes: 9 additions & 0 deletions charts/theia.cloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ operator:
# See https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/quantity/
requestedStorage: "250Mi"

# Number of operator instances to create
replicas: 2

# Options to influence the operator's leader election
leaderElection:
leaseDuration: 6
renewDeadline: 4
retryPeriod: 1

# Values of the Theia.cloud REST service
service:
# The image to use
Expand Down

0 comments on commit 1b1b5a2

Please sign in to comment.