From 62bc66dc9f9a923b20f66f5e4cac79b0c900a099 Mon Sep 17 00:00:00 2001 From: Joaquin Menchaca Date: Fri, 10 Jul 2020 19:56:17 -0700 Subject: [PATCH 1/5] initial support for alpha startup with multiple zeros list --- charts/dgraph/templates/alpha-statefulset.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/charts/dgraph/templates/alpha-statefulset.yaml b/charts/dgraph/templates/alpha-statefulset.yaml index 12a567f34..ecc7dd2a1 100644 --- a/charts/dgraph/templates/alpha-statefulset.yaml +++ b/charts/dgraph/templates/alpha-statefulset.yaml @@ -18,6 +18,18 @@ {{- printf "--tls_use_system_ca " -}} {{- end -}} {{- end }} + +{{- define "multi_zeros" -}} + {{- /* TODO: $max = 1 if older version */}} + {{- $zeroFullName := include "dgraph.zero.fullname" . -}} + {{- $max := int .Values.alpha.replicaCount -}} + {{- range $idx := until $max }} + {{- printf "%s-%d.%s-headless.${POD_NAMESPACE}.svc.cluster.local:5080" $zeroFullName $idx $zeroFullName -}} + {{- if ne $idx (sub $max 1) -}} + {{- print "," -}} + {{- end -}} + {{ end }} +{{- end -}} apiVersion: apps/v1 kind: StatefulSet metadata: @@ -133,7 +145,7 @@ spec: - "-c" - | set -ex - dgraph alpha ${TLS_OPTIONS} --my=$(hostname -f):7080 --lru_mb {{ .Values.alpha.lru_mb }} --zero {{ template "dgraph.zero.fullname" . }}-0.{{ template "dgraph.zero.fullname" . }}-headless.${POD_NAMESPACE}.svc.cluster.local:5080 + dgraph alpha ${TLS_OPTIONS} --my=$(hostname -f):7080 --lru_mb {{ .Values.alpha.lru_mb }} --zero {{ template "multi_zeros" . }} resources: {{ toYaml .Values.alpha.resources | indent 10 }} {{- if .Values.alpha.livenessProbe.enabled }} From 364c7f16c7487976b64e5e98d7a9ec1342674f45 Mon Sep 17 00:00:00 2001 From: Joaquin Menchaca Date: Fri, 10 Jul 2020 23:59:04 -0700 Subject: [PATCH 2/5] turn off multiple zero support if dgraph version < 1.2.3 --- charts/dgraph/templates/alpha-statefulset.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/dgraph/templates/alpha-statefulset.yaml b/charts/dgraph/templates/alpha-statefulset.yaml index ecc7dd2a1..dd7745479 100644 --- a/charts/dgraph/templates/alpha-statefulset.yaml +++ b/charts/dgraph/templates/alpha-statefulset.yaml @@ -18,11 +18,15 @@ {{- printf "--tls_use_system_ca " -}} {{- end -}} {{- end }} - +{{- /* Generate Comma Seperated List of Zeros */}} {{- define "multi_zeros" -}} - {{- /* TODO: $max = 1 if older version */}} {{- $zeroFullName := include "dgraph.zero.fullname" . -}} {{- $max := int .Values.alpha.replicaCount -}} + {{- /* Reset $max to 1 if multiple zeros not supported dgraph version */}} + {{- if semverCompare "< 1.2.3" .Values.image.tag -}} + {{- $max = 1 -}} + {{- end -}} + {{- /* Create Comman seperated List Zeros */}} {{- range $idx := until $max }} {{- printf "%s-%d.%s-headless.${POD_NAMESPACE}.svc.cluster.local:5080" $zeroFullName $idx $zeroFullName -}} {{- if ne $idx (sub $max 1) -}} From 110996d03cc920d68a0e7e95cb3eecccfd763547 Mon Sep 17 00:00:00 2001 From: Joaquin Menchaca Date: Sat, 11 Jul 2020 00:22:09 -0700 Subject: [PATCH 3/5] version bump --- charts/dgraph/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/dgraph/Chart.yaml b/charts/dgraph/Chart.yaml index 9d9ce2196..5b5099ba1 100644 --- a/charts/dgraph/Chart.yaml +++ b/charts/dgraph/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: dgraph -version: 0.0.6 +version: 0.0.7 appVersion: v20.03.3 description: Dgraph is a horizontally scalable and distributed graph database, providing ACID transactions, consistent replication and linearizable reads. keywords: From d5298e49c84ec6f71ad8da48dae60c83348c2cce Mon Sep 17 00:00:00 2001 From: Joaquin Menchaca Date: Sat, 11 Jul 2020 00:27:22 -0700 Subject: [PATCH 4/5] fix: use zero.ReplicaCount --- charts/dgraph/templates/alpha-statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/dgraph/templates/alpha-statefulset.yaml b/charts/dgraph/templates/alpha-statefulset.yaml index dd7745479..3b53dced1 100644 --- a/charts/dgraph/templates/alpha-statefulset.yaml +++ b/charts/dgraph/templates/alpha-statefulset.yaml @@ -21,7 +21,7 @@ {{- /* Generate Comma Seperated List of Zeros */}} {{- define "multi_zeros" -}} {{- $zeroFullName := include "dgraph.zero.fullname" . -}} - {{- $max := int .Values.alpha.replicaCount -}} + {{- $max := int .Values.zero.replicaCount -}} {{- /* Reset $max to 1 if multiple zeros not supported dgraph version */}} {{- if semverCompare "< 1.2.3" .Values.image.tag -}} {{- $max = 1 -}} From b7550fa46357e3478e0e9bd98b5acf5d3844bd62 Mon Sep 17 00:00:00 2001 From: Joaquin Menchaca Date: Tue, 14 Jul 2020 17:00:06 -0700 Subject: [PATCH 5/5] comment updates, check for v20.03.0 --- charts/dgraph/templates/alpha-statefulset.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/dgraph/templates/alpha-statefulset.yaml b/charts/dgraph/templates/alpha-statefulset.yaml index 3b53dced1..c1a19c489 100644 --- a/charts/dgraph/templates/alpha-statefulset.yaml +++ b/charts/dgraph/templates/alpha-statefulset.yaml @@ -18,15 +18,15 @@ {{- printf "--tls_use_system_ca " -}} {{- end -}} {{- end }} -{{- /* Generate Comma Seperated List of Zeros */}} +{{- /* Generate comma-separated list of Zeros */}} {{- define "multi_zeros" -}} {{- $zeroFullName := include "dgraph.zero.fullname" . -}} {{- $max := int .Values.zero.replicaCount -}} - {{- /* Reset $max to 1 if multiple zeros not supported dgraph version */}} - {{- if semverCompare "< 1.2.3" .Values.image.tag -}} + {{- /* Reset $max to 1 if multiple zeros not supported by dgraph version */}} + {{- if semverCompare "< 1.2.3 || 20.03.0" .Values.image.tag -}} {{- $max = 1 -}} {{- end -}} - {{- /* Create Comman seperated List Zeros */}} + {{- /* Create comma-separated list of zeros */}} {{- range $idx := until $max }} {{- printf "%s-%d.%s-headless.${POD_NAMESPACE}.svc.cluster.local:5080" $zeroFullName $idx $zeroFullName -}} {{- if ne $idx (sub $max 1) -}} @@ -162,7 +162,7 @@ spec: timeoutSeconds: {{ .Values.alpha.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.alpha.livenessProbe.successThreshold }} failureThreshold: {{ .Values.alpha.livenessProbe.failureThreshold }} - {{- else if .Values.alpha.customLivenessProbe }} + {{- else if .Values.alpha.customLivenessProbe }} livenessProbe: {{- toYaml .Values.alpha.customLivenessProbe | nindent 10 }} {{- end }} {{- if .Values.alpha.readinessProbe.enabled }} @@ -175,7 +175,7 @@ spec: timeoutSeconds: {{ .Values.alpha.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.alpha.readinessProbe.successThreshold }} failureThreshold: {{ .Values.alpha.readinessProbe.failureThreshold }} - {{- else if .Values.alpha.customReadinessProbe }} + {{- else if .Values.alpha.customReadinessProbe }} readinessProbe: {{- toYaml .Values.alpha.customReadinessProbe | nindent 10 }} {{- end }} volumeMounts: