Skip to content

Commit

Permalink
fixed leader election
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrmr33 committed Sep 20, 2023
1 parent c15d605 commit 8097c2b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ data:
spotinst.cluster-identifier: {{ required "`spotinst.clusterIdentifier` must be specified" .Values.spotinst.clusterIdentifier }}
base-url: {{ default "" .Values.spotinst.baseUrl | quote }}
proxy-url: {{ default "" .Values.spotinst.proxyUrl | quote }}
leader-election: {{ gt (int .Values.replicas) 1 | quote }}
disable-auto-update: {{ default "false" .Values.spotinst.disableAutoUpdate | quote }}
enable-csr-approval: {{ default "false" .Values.spotinst.enableCsrApproval | quote }}
{{- end }}
12 changes: 10 additions & 2 deletions charts/ocean-kubernetes-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
replicas: {{ .Values.replicas }}
{{- with .Values.updateStrategy }}
strategy:
{{- toYaml . | nindent 4 }}
Expand All @@ -18,8 +18,10 @@ spec:
template:
metadata:
annotations:
# This will restart the deployment in case of configmap changes
# This will restart the deployment in case of configmap/secret changes
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}

{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -70,6 +72,12 @@ spec:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: spotinst.token
optional: true
- name: SPOTINST_LEADER_ELECTION_ENABLED
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: leader-election
optional: true
- name: SPOTINST_ACCOUNT_LEGACY
valueFrom:
configMapKeyRef:
Expand Down
4 changes: 2 additions & 2 deletions charts/ocean-kubernetes-controller/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ metadata:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
type: Opaque
data:
token: {{ required "`spotinst.token` must be specified" .Values.spotinst.token | quote | b64enc }}
account: {{ required "`spotinst.account` must be specified" .Values.spotinst.account | quote | b64enc }}
token: {{ required "`spotinst.token` must be specified" .Values.spotinst.token | b64enc }}
account: {{ required "`spotinst.account` must be specified" .Values.spotinst.account | b64enc }}
{{- end }}

0 comments on commit 8097c2b

Please sign in to comment.