From fce6d6df3a4b094676fa0aa30362265bc6900320 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 30 Apr 2024 14:26:41 +0200 Subject: [PATCH 01/18] Init HA chart --- .pre-commit-config.yaml | 2 +- charts/memgraph-high-availability/.helmignore | 23 ++++ charts/memgraph-high-availability/Chart.lock | 6 + charts/memgraph-high-availability/Chart.yaml | 34 ++++++ .../charts/memgraph-0.1.2.tgz | Bin 0 -> 7094 bytes .../templates/NOTES.txt | 3 + .../templates/_helpers.tpl | 62 ++++++++++ .../templates/tests/test-connection.yaml | 20 +++ charts/memgraph-high-availability/values.yaml | 114 ++++++++++++++++++ 9 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 charts/memgraph-high-availability/.helmignore create mode 100644 charts/memgraph-high-availability/Chart.lock create mode 100644 charts/memgraph-high-availability/Chart.yaml create mode 100644 charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz create mode 100644 charts/memgraph-high-availability/templates/NOTES.txt create mode 100644 charts/memgraph-high-availability/templates/_helpers.tpl create mode 100644 charts/memgraph-high-availability/templates/tests/test-connection.yaml create mode 100644 charts/memgraph-high-availability/values.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 35a3feb..ade47a0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - exclude: ^charts/memgraph/templates/ + exclude: ^charts/memgraph/templates/|charts/memgraph-high-availability/templates/ - id: check-json - id: mixed-line-ending - id: check-merge-conflict diff --git a/charts/memgraph-high-availability/.helmignore b/charts/memgraph-high-availability/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/memgraph-high-availability/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/memgraph-high-availability/Chart.lock b/charts/memgraph-high-availability/Chart.lock new file mode 100644 index 0000000..6d8077a --- /dev/null +++ b/charts/memgraph-high-availability/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: memgraph + repository: file://../memgraph + version: 0.1.2 +digest: sha256:adc3cf9945b8b2cd9bfc23cb257bf0990fde78f12620d95f8955345f799d408c +generated: "2024-04-30T14:15:55.895968+02:00" diff --git a/charts/memgraph-high-availability/Chart.yaml b/charts/memgraph-high-availability/Chart.yaml new file mode 100644 index 0000000..57782d0 --- /dev/null +++ b/charts/memgraph-high-availability/Chart.yaml @@ -0,0 +1,34 @@ +apiVersion: v2 +name: memgraph-high-availability +description: A Helm chart for Kubernetes with Memgraph High availabiliy capabilites + +version: 0.1.0 +appVersion: "2.16.0" + +dependencies: +- name: memgraph + version: 0.1.2 + repository: "file://../memgraph" + +type: application + +keywords: +- memgraph +- graph +- database +- cypher +- analytics +- high-availability + +icon: https://public-assets.memgraph.com/memgraph-logo/logo-large.png + +home: https://memgraph.com/ + +sources: +- "https://github.com/memgraph/memgraph" +- "https://github.com/memgraph/helm-charts" + + +maintainers: +- name: Memgraph + email: tech@memgraph.com diff --git a/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz b/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz new file mode 100644 index 0000000000000000000000000000000000000000..277eb796a4b7ad02819cb5dc0c23a627e9210d2a GIT binary patch literal 7094 zcmV;n8%g9JiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PKC+aw9jgpr7k2@{l{xmr<2SwYuBGwH!xQ_jt6^x~!zOr zoRW^GFqY}B2A_>LZDVb2nn-n%nT1gi0Ao?>mURsSvt2OHbKUOv`k2@sT0qbNJn6K zJp1=1+5kW@q`n+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1n zIj-sR97P7Iho_(>is3lQ;yN`Jc1u9zZHb6 z)eRdf_w$0F3n|?Xu9>;9JcFlu$M0z^m5G$P+cWyU8%~w}(uG8h2Yq2{ZB&lOk?964huIjA_tsZnd^cLH1>w z7N*?$Eq8LuD+t)C9a=g!U2eVj?cU~wt~a>O9{YSUib`$2D|_rJQOK8}ppjPzTeb|2 zB(OSTm}`D1RAJDH^Xh!w>V4&kB%I`GbGbTU`6LV{DRbGwCv?2hZ|%Chu@U{zXtU#; gJF1>|tb2KU9-qhOkMR6w00030|LT10=>UEJ047r&%>V!Z literal 0 HcmV?d00001 diff --git a/charts/memgraph-high-availability/templates/NOTES.txt b/charts/memgraph-high-availability/templates/NOTES.txt new file mode 100644 index 0000000..bc34b0d --- /dev/null +++ b/charts/memgraph-high-availability/templates/NOTES.txt @@ -0,0 +1,3 @@ +Running Memgraph in High-availability configuraiton! + +TODO: Fill the details diff --git a/charts/memgraph-high-availability/templates/_helpers.tpl b/charts/memgraph-high-availability/templates/_helpers.tpl new file mode 100644 index 0000000..d19757a --- /dev/null +++ b/charts/memgraph-high-availability/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "memgraph-high-availability.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "memgraph-high-availability.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "memgraph-high-availability.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "memgraph-high-availability.labels" -}} +helm.sh/chart: {{ include "memgraph-high-availability.chart" . }} +{{ include "memgraph-high-availability.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "memgraph-high-availability.selectorLabels" -}} +app.kubernetes.io/name: {{ include "memgraph-high-availability.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "memgraph-high-availability.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "memgraph-high-availability.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/memgraph-high-availability/templates/tests/test-connection.yaml b/charts/memgraph-high-availability/templates/tests/test-connection.yaml new file mode 100644 index 0000000..f164143 --- /dev/null +++ b/charts/memgraph-high-availability/templates/tests/test-connection.yaml @@ -0,0 +1,20 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Release.Name }}-memgraph-test" + labels: + {{- include "memgraph.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + template: + spec: + containers: + - name: memgraph-test + image: memgraph/memgraph:2.16.0 + command: ["/bin/sh", "-c"] + args: + - | + echo "RETURN 0;" | mgconsole --host {{ include "memgraph.fullname" . }} --port 7687 + restartPolicy: Never + backoffLimit: 4 diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml new file mode 100644 index 0000000..3aee935 --- /dev/null +++ b/charts/memgraph-high-availability/values.yaml @@ -0,0 +1,114 @@ +# Default values for memgraph-high-availability. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +memgraph: + replicaCount: 3 + image: + repository: memgraph/memgraph + pullPolicy: IfNotPresent + tag: "2.16.0" + memgraphConfig: + - "--also-log-to-stderr=true" + service: + type: ClusterIP + port: 7687 + persistentVolumeClaim: + storagePVC: true + logPVC: true + + +# replicaCount: 1 + +# image: +# repository: nginx +# pullPolicy: IfNotPresent +# # Overrides the image tag whose default is the chart appVersion. +# tag: "" + +# imagePullSecrets: [] +# nameOverride: "" +# fullnameOverride: "" + +# serviceAccount: +# # Specifies whether a service account should be created +# create: true +# # Automatically mount a ServiceAccount's API credentials? +# automount: true +# # Annotations to add to the service account +# annotations: {} +# # The name of the service account to use. +# # If not set and create is true, a name is generated using the fullname template +# name: "" + +# podAnnotations: {} +# podLabels: {} + +# podSecurityContext: {} +# # fsGroup: 2000 + +# securityContext: {} +# # capabilities: +# # drop: +# # - ALL +# # readOnlyRootFilesystem: true +# # runAsNonRoot: true +# # runAsUser: 1000 + +# service: +# type: ClusterIP +# port: 80 + +# ingress: +# enabled: false +# className: "" +# annotations: {} +# # kubernetes.io/ingress.class: nginx +# # kubernetes.io/tls-acme: "true" +# hosts: +# - host: chart-example.local +# paths: +# - path: / +# pathType: ImplementationSpecific +# tls: [] +# # - secretName: chart-example-tls +# # hosts: +# # - chart-example.local + +# resources: {} +# # We usually recommend not to specify default resources and to leave this as a conscious +# # choice for the user. This also increases chances charts run on environments with little +# # resources, such as Minikube. If you do want to specify resources, uncomment the following +# # lines, adjust them as necessary, and remove the curly braces after 'resources:'. +# # limits: +# # cpu: 100m +# # memory: 128Mi +# # requests: +# # cpu: 100m +# # memory: 128Mi + +# autoscaling: +# enabled: false +# minReplicas: 1 +# maxReplicas: 100 +# targetCPUUtilizationPercentage: 80 +# # targetMemoryUtilizationPercentage: 80 + +# # Additional volumes on the output Deployment definition. +# volumes: [] +# # - name: foo +# # secret: +# # secretName: mysecret +# # optional: false + +# # Additional volumeMounts on the output Deployment definition. +# volumeMounts: [] +# # - name: foo +# # mountPath: "/etc/foo" +# # readOnly: true + +# nodeSelector: {} + +# tolerations: [] + +# affinity: {} From 551ff33c779e477d98a326248a13ea1f6d8a062c Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 2 May 2024 15:45:46 +0200 Subject: [PATCH 02/18] Update HA. --- charts/memgraph-high-availability/Chart.lock | 2 +- .../charts/memgraph-0.1.2.tgz | Bin 7094 -> 7093 bytes .../templates/_helpers.tpl | 62 ------------------ .../templates/coordinators.yaml | 29 ++++++++ .../templates/main.yaml | 23 +++++++ .../templates/replica.yaml | 23 +++++++ charts/memgraph-high-availability/values.yaml | 58 +++++++++++++--- 7 files changed, 124 insertions(+), 73 deletions(-) delete mode 100644 charts/memgraph-high-availability/templates/_helpers.tpl create mode 100644 charts/memgraph-high-availability/templates/coordinators.yaml create mode 100644 charts/memgraph-high-availability/templates/main.yaml create mode 100644 charts/memgraph-high-availability/templates/replica.yaml diff --git a/charts/memgraph-high-availability/Chart.lock b/charts/memgraph-high-availability/Chart.lock index 6d8077a..76559f3 100644 --- a/charts/memgraph-high-availability/Chart.lock +++ b/charts/memgraph-high-availability/Chart.lock @@ -3,4 +3,4 @@ dependencies: repository: file://../memgraph version: 0.1.2 digest: sha256:adc3cf9945b8b2cd9bfc23cb257bf0990fde78f12620d95f8955345f799d408c -generated: "2024-04-30T14:15:55.895968+02:00" +generated: "2024-05-02T14:40:10.824062+02:00" diff --git a/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz b/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz index 277eb796a4b7ad02819cb5dc0c23a627e9210d2a..71950530e62f14d6f614e779f2f112bde3943d5c 100644 GIT binary patch delta 6970 zcmV-A8^z?dH?=pAxPSe6u>I=gi?0U57lXm8uVC=tlyp3Wu}pt8_-tH@gZqO#EEhj; zZG@5|xZDa@o>zZvMZ;IoAV|20wa6`fci_e4&3EuOo@PK&6U1tXQlz3- zWt)MBv0wQvFUF~eLuL%OCTg`T{|HkxRh#%vm@+-(Q7)&!1%IDkDV>;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(x8E@?q5T1X3p!GG0?CbXqvkh)oIeQM7^rH<(or?#_GP4+H@#i)=EcaKm1 zc69d3{^`-X-Lw6p!woojyZh#sy`zJJ{j;;TZ~Wiy536sQgQ}4GAbA-cl3G@tmBH`d z+2n%3SSw0(`MQZLV^BMjWl?}@1azue>7Y-aMy?LO6}ns?%y6ufHGfvK+$Vrs`U+KV zm44+i)^m4?how`cg`H(J(^!F?ob{Fe3plELYz-rkVt)ePz;L6w2hGJU zhev0$C|zTo0JA8--ha&}L^MarYDcujQnYpn%gQt7P z?`bWSiIlqAGy1+8PL=-Bg+z`AeR%4eZnrQK@}LW8jsM{`Uw;rsYxfz|XVLLS#~&l; zXb;8@<-Q9>2{ZB&lOk?964huIjA_tsZnd^cLH1>w7N*?$Eq8LuD+t)C9a=g!U2eVj z?cU~wt~a>O9{YSUib`$2D|_rJQOK8}ppjPzTeb|2B(OSTm}`D1RAJDH^Xh!w>V4&k zB%I`GbGbTU`7|U9Cndoja)_2=a2CGX8-^I N|NrWI?dbr1001ac=B5Au diff --git a/charts/memgraph-high-availability/templates/_helpers.tpl b/charts/memgraph-high-availability/templates/_helpers.tpl deleted file mode 100644 index d19757a..0000000 --- a/charts/memgraph-high-availability/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "memgraph-high-availability.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "memgraph-high-availability.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "memgraph-high-availability.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "memgraph-high-availability.labels" -}} -helm.sh/chart: {{ include "memgraph-high-availability.chart" . }} -{{ include "memgraph-high-availability.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "memgraph-high-availability.selectorLabels" -}} -app.kubernetes.io/name: {{ include "memgraph-high-availability.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "memgraph-high-availability.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "memgraph-high-availability.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml new file mode 100644 index 0000000..6df9240 --- /dev/null +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -0,0 +1,29 @@ +{{- range $index, $coord := .Values.memgraph.coordinators }} +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "memgraph.fullname" $ }}-coordinator-{{ $coord.id }} +spec: + serviceName: {{ include "memgraph.fullname" $ }}-coordinator-{{ $coord.id }} + replicas: 1 + selector: + matchLabels: + app: {{ include "memgraph.fullname" $ }}-coordinator + coordinator-id: "{{ $coord.id }}" + template: + metadata: + labels: + app: {{ include "memgraph.fullname" $ }}-coordinator + coordinator-id: "{{ $coord.id }}" + spec: + containers: + - name: memgraph-coordinator-{{ $coord.id }} + image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" + imagePullPolicy: "{{ $.Values.memgraph.image.pullPolicy }}" + args: {{ toYaml $coord.args | nindent 10 }} + ports: + - name: coord-port + containerPort: {{ $coord.port }} +... +{{- end }} diff --git a/charts/memgraph-high-availability/templates/main.yaml b/charts/memgraph-high-availability/templates/main.yaml new file mode 100644 index 0000000..1b4075b --- /dev/null +++ b/charts/memgraph-high-availability/templates/main.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "memgraph.fullname" . }}-main +spec: + serviceName: {{ include "memgraph.fullname" . }}-main + replicas: 1 + selector: + matchLabels: + app: {{ include "memgraph.fullname" . }}-main + template: + metadata: + labels: + app: {{ include "memgraph.fullname" . }}-main + spec: + containers: + - name: memgraph-main + image: "{{ .Values.memgraph.image.repository }}:{{ .Values.memgraph.image.tag }}" + imagePullPolicy: "{{ .Values.memgraph.image.pullPolicy }}" + args: {{ toYaml .Values.memgraph.main.memgraphConfig | nindent 12 }} + ports: + - name: bolt + containerPort: 7687 diff --git a/charts/memgraph-high-availability/templates/replica.yaml b/charts/memgraph-high-availability/templates/replica.yaml new file mode 100644 index 0000000..2bbf823 --- /dev/null +++ b/charts/memgraph-high-availability/templates/replica.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ include "memgraph.fullname" . }}-replica +spec: + serviceName: {{ include "memgraph.fullname" . }}-replica + replicas: 1 + selector: + matchLabels: + app: {{ include "memgraph.fullname" . }}-replica + template: + metadata: + labels: + app: {{ include "memgraph.fullname" . }}-replica + spec: + containers: + - name: memgraph-replica + image: "{{ .Values.memgraph.image.repository }}:{{ .Values.memgraph.image.tag }}" + imagePullPolicy: "{{ .Values.memgraph.image.pullPolicy }}" + args: {{ toYaml .Values.memgraph.replica.memgraphConfig | nindent 12 }} + ports: + - name: bolt + containerPort: 7688 diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 3aee935..0fdf752 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -3,19 +3,57 @@ # Declare variables to be passed into your templates. memgraph: - replicaCount: 3 image: repository: memgraph/memgraph + tag: 2.16.0 pullPolicy: IfNotPresent - tag: "2.16.0" - memgraphConfig: - - "--also-log-to-stderr=true" - service: - type: ClusterIP - port: 7687 - persistentVolumeClaim: - storagePVC: true - logPVC: true + + + main: + memgraphConfig: + - "--experimental-enabled=high-availability" + - "--management-port=19001" + - "--bolt-port=7687" + + replica: + memgraphConfig: + - "--experimental-enabled=high-availability" + - "--management-port=19002" + - "--bolt-port=7688" + + coordinators: + - id: 1 + port: 20001 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=1" + - "--coordinator-port=20001" + - id: 2 + port: 20002 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=2" + - "--coordinator-port=20002" + - id: 3 + port: 20003 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=3" + - "--coordinator-port=20003" + + + +# ha: +# main: +# args: +# - "--experimental-enabled=high-availability" +# - "--management-port=19001" +# - "--bolt-port=7687" +# replica: +# args: +# - "--experimental-enabled=high-availability" +# - "--management-port=19002" +# - "--bolt-port=7688" # replicaCount: 1 From 98bd1d16ca338d988f764b5214c9aac22c9bd61f Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Mon, 6 May 2024 23:58:59 +0200 Subject: [PATCH 03/18] Update setup --- charts/memgraph-high-availability/Chart.lock | 6 -- charts/memgraph-high-availability/Chart.yaml | 5 -- .../charts/memgraph-0.1.2.tgz | Bin 7093 -> 0 bytes .../templates/_helpers.tpl | 32 ++++++++ .../templates/cluster-setup.yaml | 39 ++++++++++ .../templates/coordinators.yaml | 25 +++--- .../templates/data.yaml | 26 +++++++ .../templates/main.yaml | 23 ------ .../templates/replica.yaml | 23 ------ .../templates/services-coordinators.yaml | 20 +++++ .../templates/services-data.yaml | 20 +++++ charts/memgraph-high-availability/values.yaml | 73 ++++++++++-------- 12 files changed, 189 insertions(+), 103 deletions(-) delete mode 100644 charts/memgraph-high-availability/Chart.lock delete mode 100644 charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz create mode 100644 charts/memgraph-high-availability/templates/_helpers.tpl create mode 100644 charts/memgraph-high-availability/templates/cluster-setup.yaml create mode 100644 charts/memgraph-high-availability/templates/data.yaml delete mode 100644 charts/memgraph-high-availability/templates/main.yaml delete mode 100644 charts/memgraph-high-availability/templates/replica.yaml create mode 100644 charts/memgraph-high-availability/templates/services-coordinators.yaml create mode 100644 charts/memgraph-high-availability/templates/services-data.yaml diff --git a/charts/memgraph-high-availability/Chart.lock b/charts/memgraph-high-availability/Chart.lock deleted file mode 100644 index 76559f3..0000000 --- a/charts/memgraph-high-availability/Chart.lock +++ /dev/null @@ -1,6 +0,0 @@ -dependencies: -- name: memgraph - repository: file://../memgraph - version: 0.1.2 -digest: sha256:adc3cf9945b8b2cd9bfc23cb257bf0990fde78f12620d95f8955345f799d408c -generated: "2024-05-02T14:40:10.824062+02:00" diff --git a/charts/memgraph-high-availability/Chart.yaml b/charts/memgraph-high-availability/Chart.yaml index 57782d0..4c2c088 100644 --- a/charts/memgraph-high-availability/Chart.yaml +++ b/charts/memgraph-high-availability/Chart.yaml @@ -5,11 +5,6 @@ description: A Helm chart for Kubernetes with Memgraph High availabiliy capabili version: 0.1.0 appVersion: "2.16.0" -dependencies: -- name: memgraph - version: 0.1.2 - repository: "file://../memgraph" - type: application keywords: diff --git a/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz b/charts/memgraph-high-availability/charts/memgraph-0.1.2.tgz deleted file mode 100644 index 71950530e62f14d6f614e779f2f112bde3943d5c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7093 zcmV;m8%pFKiwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PKC+aw9jgpr7k2@{l{xmr<2SwYuBGwH!xQ_jt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~z=q_%+I4%|br!tz{Bsxno=m3X}24UF|MGCFA*Xt)lPqi=?a(Z_nl%hv> zjr->iN*t4m$V=jEu@9Q;A%w^+R`yd-K@4g zwdbHx$8?HQ+u5lmdzZpuRLFxra=~D%6{Wg--9(l#sGZ5OD8MxWI#sQ7(5Fu$ zSBKvUT`mx2I9AFUt6A<7KrVfSs<%qNavAHnJH^A&snWvEvYKhEKu^y4%Krr%RX(L6BUHmDV<03Uomt0uHL@z^MA`=!mtp)Vwc0CGg_3cF;9S56kzY>6QYCN{log_V{l!>&KQE^ zSKe80Q7(&Ts4w0gzuVv2UC@h-a}?$0kZ^_*swI^5-wHz3 z>V}P#`*}gog_Q0G*Ua2lp25?-uEmOHuS6$EV64lSLVF1KF%c5ib-*Be}Ck9|HFMWwdil|6QqDCEmf(8#NVEn5ah z5?Gxv%r(ChsxWB9d38Q-^}cdN5>9fpxm=yFd=iF}l)3ET6FOe$w|3p$*ogjUwAt~_ f9aT>}*1bGFkI&=tM|l1-00960Ez6=R0Db@f%UA-l diff --git a/charts/memgraph-high-availability/templates/_helpers.tpl b/charts/memgraph-high-availability/templates/_helpers.tpl new file mode 100644 index 0000000..96b8af0 --- /dev/null +++ b/charts/memgraph-high-availability/templates/_helpers.tpl @@ -0,0 +1,32 @@ + +{{/* Full name of the application */}} +{{- define "memgraph.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end -}} +{{- end -}} + + + +{{/* Define the chart version and app version */}} +{{- define "memgraph.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end -}} + + +{{/* Define the name of the application */}} +{{- define "memgraph.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end -}} + + +{{/* Common labels */}} +{{- define "memgraph.labels" -}} +app.kubernetes.io/name: {{ include "memgraph.name" . }} +helm.sh/chart: {{ include "memgraph.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml new file mode 100644 index 0000000..b2c36d6 --- /dev/null +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -0,0 +1,39 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: memgraph-setup +spec: + template: + spec: + containers: + - name: memgraph-setup + image: memgraph/memgraph:latest + command: ["/bin/bash", "-c"] + args: + - | + # Install netcat + echo "Installing netcat..." + apt-get update && apt-get install -y netcat-openbsd + + # Wait until the services are available + # echo "Waiting for services to become available..." + until nc -z memgraph-coordinator-1.default.svc.cluster.local 17687; do sleep 1; done + until nc -z memgraph-coordinator-2.default.svc.cluster.local 17690; do sleep 1; done + until nc -z memgraph-coordinator-3.default.svc.cluster.local 17691; do sleep 1; done + until nc -z memgraph-data-0.default.svc.cluster.local 7687; do sleep 1; done + until nc -z memgraph-data-1.default.svc.cluster.local 7688; do sleep 1; done + + sleep 10 + + # Run the mgconsole commands + echo "Running mgconsole commands..." + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002";}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003";}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7688", "management_server": "memgraph-data-1.default.svc.cluster.local:19002", "replication_server": "memgraph-data-1.default.svc.cluster.local:18002"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + securityContext: + runAsUser: 0 + + restartPolicy: Never + backoffLimit: 4 diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index 6df9240..bfcde6b 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -1,29 +1,26 @@ -{{- range $index, $coord := .Values.memgraph.coordinators }} ---- +{{- range $index, $coordinator := .Values.coordinators }} apiVersion: apps/v1 kind: StatefulSet metadata: - name: {{ include "memgraph.fullname" $ }}-coordinator-{{ $coord.id }} + name: memgraph-coordinator-{{ $coordinator.id }} spec: - serviceName: {{ include "memgraph.fullname" $ }}-coordinator-{{ $coord.id }} + serviceName: "memgraph-coordinator-{{ $coordinator.id }}" replicas: 1 selector: matchLabels: - app: {{ include "memgraph.fullname" $ }}-coordinator - coordinator-id: "{{ $coord.id }}" + app: memgraph-coordinator-{{ $coordinator.id }} template: metadata: labels: - app: {{ include "memgraph.fullname" $ }}-coordinator - coordinator-id: "{{ $coord.id }}" + app: memgraph-coordinator-{{ $coordinator.id }} spec: containers: - - name: memgraph-coordinator-{{ $coord.id }} + - name: memgraph-coordinator image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" - imagePullPolicy: "{{ $.Values.memgraph.image.pullPolicy }}" - args: {{ toYaml $coord.args | nindent 10 }} + imagePullPolicy: {{ $.Values.memgraph.image.pullPolicy }} ports: - - name: coord-port - containerPort: {{ $coord.port }} -... + - containerPort: {{ $coordinator.boltPort }} + - containerPort: {{ $coordinator.coordinatorPort }} + args: {{ $coordinator.args }} +--- {{- end }} diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml new file mode 100644 index 0000000..f2a51ad --- /dev/null +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -0,0 +1,26 @@ +{{- range $index, $data := .Values.data }} +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: memgraph-data-{{ $data.id }} +spec: + serviceName: "memgraph-data-{{ $data.id }}" + replicas: 1 + selector: + matchLabels: + app: memgraph-data-{{ $data.id }} + template: + metadata: + labels: + app: memgraph-data-{{ $data.id }} + spec: + containers: + - name: memgraph-data + image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" + imagePullPolicy: {{ $.Values.memgraph.image.pullPolicy }} + ports: + - containerPort: {{ $data.boltPort }} + - containerPort: {{ $data.managementPort }} + args: {{ $data.memgraphConfig }} +--- +{{- end }} diff --git a/charts/memgraph-high-availability/templates/main.yaml b/charts/memgraph-high-availability/templates/main.yaml deleted file mode 100644 index 1b4075b..0000000 --- a/charts/memgraph-high-availability/templates/main.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: {{ include "memgraph.fullname" . }}-main -spec: - serviceName: {{ include "memgraph.fullname" . }}-main - replicas: 1 - selector: - matchLabels: - app: {{ include "memgraph.fullname" . }}-main - template: - metadata: - labels: - app: {{ include "memgraph.fullname" . }}-main - spec: - containers: - - name: memgraph-main - image: "{{ .Values.memgraph.image.repository }}:{{ .Values.memgraph.image.tag }}" - imagePullPolicy: "{{ .Values.memgraph.image.pullPolicy }}" - args: {{ toYaml .Values.memgraph.main.memgraphConfig | nindent 12 }} - ports: - - name: bolt - containerPort: 7687 diff --git a/charts/memgraph-high-availability/templates/replica.yaml b/charts/memgraph-high-availability/templates/replica.yaml deleted file mode 100644 index 2bbf823..0000000 --- a/charts/memgraph-high-availability/templates/replica.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: {{ include "memgraph.fullname" . }}-replica -spec: - serviceName: {{ include "memgraph.fullname" . }}-replica - replicas: 1 - selector: - matchLabels: - app: {{ include "memgraph.fullname" . }}-replica - template: - metadata: - labels: - app: {{ include "memgraph.fullname" . }}-replica - spec: - containers: - - name: memgraph-replica - image: "{{ .Values.memgraph.image.repository }}:{{ .Values.memgraph.image.tag }}" - imagePullPolicy: "{{ .Values.memgraph.image.pullPolicy }}" - args: {{ toYaml .Values.memgraph.replica.memgraphConfig | nindent 12 }} - ports: - - name: bolt - containerPort: 7688 diff --git a/charts/memgraph-high-availability/templates/services-coordinators.yaml b/charts/memgraph-high-availability/templates/services-coordinators.yaml new file mode 100644 index 0000000..06c0179 --- /dev/null +++ b/charts/memgraph-high-availability/templates/services-coordinators.yaml @@ -0,0 +1,20 @@ +# Service for coordinator instances +{{- range .Values.coordinators }} +--- +apiVersion: v1 +kind: Service +metadata: + name: memgraph-coordinator-{{ .id }} +spec: + selector: + app: memgraph-coordinator-{{ .id }} + ports: + - protocol: TCP + name: bolt + port: {{ .boltPort }} + targetPort: {{ .boltPort }} + - protocol: TCP + name: coordinator + port: {{ .coordinatorPort }} + targetPort: {{ .coordinatorPort }} +{{- end }} diff --git a/charts/memgraph-high-availability/templates/services-data.yaml b/charts/memgraph-high-availability/templates/services-data.yaml new file mode 100644 index 0000000..ff4463a --- /dev/null +++ b/charts/memgraph-high-availability/templates/services-data.yaml @@ -0,0 +1,20 @@ +# Service for data instances +{{- range .Values.data }} +--- +apiVersion: v1 +kind: Service +metadata: + name: memgraph-data-{{ .id }} +spec: + selector: + app: memgraph-data-{{ .id }} + ports: + - protocol: TCP + name: bolt + port: {{ .boltPort }} + targetPort: {{ .boltPort }} + - protocol: TCP + name: management + port: {{ .managementPort }} + targetPort: {{ .managementPort }} +{{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 0fdf752..afd2605 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -8,38 +8,47 @@ memgraph: tag: 2.16.0 pullPolicy: IfNotPresent - - main: - memgraphConfig: - - "--experimental-enabled=high-availability" - - "--management-port=19001" - - "--bolt-port=7687" - - replica: - memgraphConfig: - - "--experimental-enabled=high-availability" - - "--management-port=19002" - - "--bolt-port=7688" - - coordinators: - - id: 1 - port: 20001 - args: - - "--experimental-enabled=high-availability" - - "--coordinator-id=1" - - "--coordinator-port=20001" - - id: 2 - port: 20002 - args: - - "--experimental-enabled=high-availability" - - "--coordinator-id=2" - - "--coordinator-port=20002" - - id: 3 - port: 20003 - args: - - "--experimental-enabled=high-availability" - - "--coordinator-id=3" - - "--coordinator-port=20003" +data: +- id: "0" + boltPort: 7687 + managementPort: 19001 + memgraphConfig: + - "--experimental-enabled=high-availability" + - "--management-port=19001" + - "--bolt-port=7687" +- id: "1" + boltPort: 7688 + managementPort: 19002 + memgraphConfig: + - "--experimental-enabled=high-availability" + - "--management-port=19002" + - "--bolt-port=7688" + +coordinators: +- id: "1" + boltPort: 17687 + coordinatorPort: 20001 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=1" + - "--coordinator-port=20001" + - "--bolt-port=17687" +- id: "2" + boltPort: 17690 + coordinatorPort: 20002 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=2" + - "--coordinator-port=20002" + - "--bolt-port=17690" +- id: "3" + boltPort: 17691 + coordinatorPort: 20003 + args: + - "--experimental-enabled=high-availability" + - "--coordinator-id=3" + - "--coordinator-port=20003" + - "--bolt-port=17691" From 9490a0c78954bb8cb75b12127699b6508bfc8f64 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 7 May 2024 00:37:39 +0200 Subject: [PATCH 04/18] Update args. --- .../templates/coordinators.yaml | 5 ++++- .../templates/data.yaml | 5 ++++- charts/memgraph-high-availability/values.yaml | 16 +++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index bfcde6b..de972cb 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -21,6 +21,9 @@ spec: ports: - containerPort: {{ $coordinator.boltPort }} - containerPort: {{ $coordinator.coordinatorPort }} - args: {{ $coordinator.args }} + args: + {{- range $arg := $coordinator.args }} + - "{{ $arg }}" + {{- end }} --- {{- end }} diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index f2a51ad..48e3377 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -21,6 +21,9 @@ spec: ports: - containerPort: {{ $data.boltPort }} - containerPort: {{ $data.managementPort }} - args: {{ $data.memgraphConfig }} + args: + {{- range $arg := $data.args }} + - "{{ $arg }}" + {{- end }} --- {{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index afd2605..25bf128 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -1,6 +1,6 @@ # Default values for memgraph-high-availability. # This is a YAML-formatted file. -# Declare variables to be passed into your templates. +# Declare variables to be passed into your templates.| memgraph: image: @@ -12,17 +12,21 @@ data: - id: "0" boltPort: 7687 managementPort: 19001 - memgraphConfig: + args: - "--experimental-enabled=high-availability" - "--management-port=19001" - "--bolt-port=7687" + - "--also-log-to-stderr" + - "--log-level=TRACE" - id: "1" boltPort: 7688 managementPort: 19002 - memgraphConfig: + args: - "--experimental-enabled=high-availability" - "--management-port=19002" - "--bolt-port=7688" + - "--also-log-to-stderr" + - "--log-level=TRACE" coordinators: - id: "1" @@ -33,6 +37,8 @@ coordinators: - "--coordinator-id=1" - "--coordinator-port=20001" - "--bolt-port=17687" + - "--also-log-to-stderr" + - "--log-level=TRACE" - id: "2" boltPort: 17690 coordinatorPort: 20002 @@ -41,6 +47,8 @@ coordinators: - "--coordinator-id=2" - "--coordinator-port=20002" - "--bolt-port=17690" + - "--also-log-to-stderr" + - "--log-level=TRACE" - id: "3" boltPort: 17691 coordinatorPort: 20003 @@ -49,6 +57,8 @@ coordinators: - "--coordinator-id=3" - "--coordinator-port=20003" - "--bolt-port=17691" + - "--also-log-to-stderr" + - "--log-level=TRACE" From 25c94d7dc8bc8b7f5000b5c19bcdd0e90ff21094 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 7 May 2024 15:37:38 +0200 Subject: [PATCH 05/18] Add env support. --- .../memgraph-high-availability/templates/cluster-setup.yaml | 4 ++-- .../memgraph-high-availability/templates/coordinators.yaml | 5 +++++ charts/memgraph-high-availability/templates/data.yaml | 5 +++++ charts/memgraph-high-availability/values.yaml | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml index b2c36d6..e5f02f6 100644 --- a/charts/memgraph-high-availability/templates/cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -27,8 +27,8 @@ spec: # Run the mgconsole commands echo "Running mgconsole commands..." - echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002";}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003";}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7688", "management_server": "memgraph-data-1.default.svc.cluster.local:19002", "replication_server": "memgraph-data-1.default.svc.cluster.local:18002"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index de972cb..22572a6 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -25,5 +25,10 @@ spec: {{- range $arg := $coordinator.args }} - "{{ $arg }}" {{- end }} + env: + - name: MEMGRAPH_ENTERPRISE_LICENSE + value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}" + - name: MEMGRAPH_ORGANIZATION_NAME + value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}" --- {{- end }} diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 48e3377..1802288 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -25,5 +25,10 @@ spec: {{- range $arg := $data.args }} - "{{ $arg }}" {{- end }} + env: + - name: MEMGRAPH_ENTERPRISE_LICENSE + value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}" + - name: MEMGRAPH_ORGANIZATION_NAME + value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}" --- {{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 25bf128..2e1627e 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -7,6 +7,9 @@ memgraph: repository: memgraph/memgraph tag: 2.16.0 pullPolicy: IfNotPresent + env: + MEMGRAPH_ENTERPRISE_LICENSE: "" + MEMGRAPH_ORGANIZATION_NAME: "" data: - id: "0" From 7d65d7debb87017838279f56924fa317d51aaa05 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 7 May 2024 15:47:42 +0200 Subject: [PATCH 06/18] Updated running commands. --- .../templates/cluster-setup.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml index e5f02f6..2012132 100644 --- a/charts/memgraph-high-availability/templates/cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -16,7 +16,7 @@ spec: apt-get update && apt-get install -y netcat-openbsd # Wait until the services are available - # echo "Waiting for services to become available..." + echo "Waiting for services to become available..." until nc -z memgraph-coordinator-1.default.svc.cluster.local 17687; do sleep 1; done until nc -z memgraph-coordinator-2.default.svc.cluster.local 17690; do sleep 1; done until nc -z memgraph-coordinator-3.default.svc.cluster.local 17691; do sleep 1; done @@ -27,10 +27,11 @@ spec: # Run the mgconsole commands echo "Running mgconsole commands..." - echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7688", "management_server": "memgraph-data-1.default.svc.cluster.local:19002", "replication_server": "memgraph-data-1.default.svc.cluster.local:18002"}' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7688", "management_server": "memgraph-data-1.default.svc.cluster.local:19002", "replication_server": "memgraph-data-1.default.svc.cluster.local:18002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 securityContext: runAsUser: 0 From de4ed70c4a2bf849bdfd4e36161545677d0ea7a1 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 7 May 2024 16:18:43 +0200 Subject: [PATCH 07/18] Add setup echo. --- .../templates/cluster-setup.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml index 2012132..ec6ac5a 100644 --- a/charts/memgraph-high-availability/templates/cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -7,7 +7,7 @@ spec: spec: containers: - name: memgraph-setup - image: memgraph/memgraph:latest + image: memgraph/memgraph:2.16.0 command: ["/bin/bash", "-c"] args: - | @@ -27,6 +27,12 @@ spec: # Run the mgconsole commands echo "Running mgconsole commands..." + echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-2.default.svc.cluster.local --port 17690 + echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-3.default.svc.cluster.local --port 17691 + echo 'RETURN 0;' | mgconsole --host memgraph-data-0.default.svc.cluster.local --port 7687 + echo 'RETURN 0;' | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7688 + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 From 9d6a9c3ede8078b3d770e4b3804f8269f7623b32 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 14 May 2024 11:28:07 +0200 Subject: [PATCH 08/18] Update port. --- .../templates/cluster-setup.yaml | 8 +++++--- charts/memgraph-high-availability/templates/data.yaml | 1 + .../templates/services-data.yaml | 4 ++++ charts/memgraph-high-availability/values.yaml | 11 +++++++++-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml index ec6ac5a..6f1ac6b 100644 --- a/charts/memgraph-high-availability/templates/cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -15,15 +15,16 @@ spec: echo "Installing netcat..." apt-get update && apt-get install -y netcat-openbsd - # Wait until the services are available - echo "Waiting for services to become available..." + # Wait until the pods are available + echo "Waiting for pods to become available..." until nc -z memgraph-coordinator-1.default.svc.cluster.local 17687; do sleep 1; done until nc -z memgraph-coordinator-2.default.svc.cluster.local 17690; do sleep 1; done until nc -z memgraph-coordinator-3.default.svc.cluster.local 17691; do sleep 1; done until nc -z memgraph-data-0.default.svc.cluster.local 7687; do sleep 1; done until nc -z memgraph-data-1.default.svc.cluster.local 7688; do sleep 1; done + echo "Services are available!" - sleep 10 + sleep 5 # Run the mgconsole commands echo "Running mgconsole commands..." @@ -33,6 +34,7 @@ spec: echo 'RETURN 0;' | mgconsole --host memgraph-data-0.default.svc.cluster.local --port 7687 echo 'RETURN 0;' | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7688 + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 1802288..638edf4 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -21,6 +21,7 @@ spec: ports: - containerPort: {{ $data.boltPort }} - containerPort: {{ $data.managementPort }} + - containerPort: {{ $data.replicationPort }} args: {{- range $arg := $data.args }} - "{{ $arg }}" diff --git a/charts/memgraph-high-availability/templates/services-data.yaml b/charts/memgraph-high-availability/templates/services-data.yaml index ff4463a..954fe5c 100644 --- a/charts/memgraph-high-availability/templates/services-data.yaml +++ b/charts/memgraph-high-availability/templates/services-data.yaml @@ -17,4 +17,8 @@ spec: name: management port: {{ .managementPort }} targetPort: {{ .managementPort }} + - protocol: TCP + name: replication + port: {{ .replicationPort }} + targetPort: {{ .replicationPort }} {{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 2e1627e..5521793 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -4,8 +4,8 @@ memgraph: image: - repository: memgraph/memgraph - tag: 2.16.0 + repository: memgraph + tag: 2.16.0_65_bdff2fefa pullPolicy: IfNotPresent env: MEMGRAPH_ENTERPRISE_LICENSE: "" @@ -15,21 +15,25 @@ data: - id: "0" boltPort: 7687 managementPort: 19001 + replicationPort: 18001 args: - "--experimental-enabled=high-availability" - "--management-port=19001" - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" + - "--replication-restore-state-on-startup=true" - id: "1" boltPort: 7688 managementPort: 19002 + replicationPort: 18002 args: - "--experimental-enabled=high-availability" - "--management-port=19002" - "--bolt-port=7688" - "--also-log-to-stderr" - "--log-level=TRACE" + - "--replication-restore-state-on-startup=true" coordinators: - id: "1" @@ -42,6 +46,7 @@ coordinators: - "--bolt-port=17687" - "--also-log-to-stderr" - "--log-level=TRACE" + - "--replication-restore-state-on-startup=true" - id: "2" boltPort: 17690 coordinatorPort: 20002 @@ -52,6 +57,7 @@ coordinators: - "--bolt-port=17690" - "--also-log-to-stderr" - "--log-level=TRACE" + - "--replication-restore-state-on-startup=true" - id: "3" boltPort: 17691 coordinatorPort: 20003 @@ -62,6 +68,7 @@ coordinators: - "--bolt-port=17691" - "--also-log-to-stderr" - "--log-level=TRACE" + - "--replication-restore-state-on-startup=true" From 529ec059402b5515e089855a6be7e01c62e14e61 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 14 May 2024 11:47:21 +0200 Subject: [PATCH 09/18] Add readiness, livenessProbe and startupProbe. --- .../templates/data.yaml | 24 +++++++++++++++++++ charts/memgraph-high-availability/values.yaml | 11 +++++++++ 2 files changed, 35 insertions(+) diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 638edf4..7e6a49a 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -31,5 +31,29 @@ spec: value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}" - name: MEMGRAPH_ORGANIZATION_NAME value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}" + livenessProbe: + exec: + command: + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + initialDelaySeconds: {{ $.Values.memgraph.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ $.Values.memgraph.probes.liveness.periodSeconds }} + readinessProbe: + exec: + command: + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + initialDelaySeconds: {{ $.Values.memgraph.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ $.Values.memgraph.probes.readiness.periodSeconds }} + startupProbe: + exec: + command: + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }} + periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }} --- {{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 5521793..be96341 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -10,6 +10,17 @@ memgraph: env: MEMGRAPH_ENTERPRISE_LICENSE: "" MEMGRAPH_ORGANIZATION_NAME: "" + probes: + startup: + failureThreshold: 30 + periodSeconds: 10 + readiness: + initialDelaySeconds: 5 + periodSeconds: 5 + liveness: + initialDelaySeconds: 30 + periodSeconds: 10 + data: - id: "0" From 9121b037592fe66547e69dafb00ea75695ef59bd Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 14 May 2024 13:46:12 +0200 Subject: [PATCH 10/18] Add coordinator probes and remove grep. --- .../templates/coordinators.yaml | 25 +++++++++++++++++++ .../templates/data.yaml | 6 ++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index 22572a6..e26bab9 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -30,5 +30,30 @@ spec: value: "{{ $.Values.memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE }}" - name: MEMGRAPH_ORGANIZATION_NAME value: "{{ $.Values.memgraph.env.MEMGRAPH_ORGANIZATION_NAME }}" + livenessProbe: + exec: + command: + - sh + - -c + - echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }} + initialDelaySeconds: {{ $.Values.memgraph.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ $.Values.memgraph.probes.liveness.periodSeconds }} + readinessProbe: + exec: + command: + - sh + - -c + - echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }} + initialDelaySeconds: {{ $.Values.memgraph.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ $.Values.memgraph.probes.readiness.periodSeconds }} + startupProbe: + exec: + command: + - sh + - -c + - echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }} + failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }} + periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }} + --- {{- end }} diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index 7e6a49a..fc87922 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -36,7 +36,7 @@ spec: command: - sh - -c - - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} initialDelaySeconds: {{ $.Values.memgraph.probes.liveness.initialDelaySeconds }} periodSeconds: {{ $.Values.memgraph.probes.liveness.periodSeconds }} readinessProbe: @@ -44,7 +44,7 @@ spec: command: - sh - -c - - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} initialDelaySeconds: {{ $.Values.memgraph.probes.readiness.initialDelaySeconds }} periodSeconds: {{ $.Values.memgraph.probes.readiness.periodSeconds }} startupProbe: @@ -52,7 +52,7 @@ spec: command: - sh - -c - - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} | grep '+-*+\n| 0 |' + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }} periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }} --- From 27e44e0a898b0ec44f41d20dc1c12b45c77b9dff Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 14 May 2024 15:43:55 +0200 Subject: [PATCH 11/18] Add volumes to coordinators and data instances. --- .../templates/coordinators.yaml | 59 ++++++++++++++++++- .../templates/data.yaml | 59 +++++++++++++++++++ charts/memgraph-high-availability/values.yaml | 18 ++++++ 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/charts/memgraph-high-availability/templates/coordinators.yaml b/charts/memgraph-high-availability/templates/coordinators.yaml index e26bab9..0dbf75e 100644 --- a/charts/memgraph-high-availability/templates/coordinators.yaml +++ b/charts/memgraph-high-availability/templates/coordinators.yaml @@ -14,6 +14,28 @@ spec: labels: app: memgraph-coordinator-{{ $coordinator.id }} spec: + initContainers: + - name: init + image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" + volumeMounts: + {{- if $.Values.memgraph.coordinators.volumeClaim.storagePVC }} + - name: memgraph-coordinator-{{ $coordinator.id }}-lib-storage + mountPath: /var/lib/memgraph + {{- end }} + {{- if $.Values.memgraph.coordinators.volumeClaim.logPVC }} + - name: memgraph-coordinator-{{ $coordinator.id }}-log-storage + mountPath: /var/log/memgraph + {{- end }} + command: [ "/bin/sh","-c" ] + args: [ "chown -R memgraph:memgraph /var/log; chown -R memgraph:memgraph /var/lib" ] + securityContext: + privileged: true + readOnlyRootFilesystem: false + capabilities: + drop: [ "all" ] + add: [ "CHOWN" ] + runAsUser: 0 + runAsNonRoot: false containers: - name: memgraph-coordinator image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" @@ -54,6 +76,41 @@ spec: - echo 'SHOW INSTANCES;' | mgconsole --host localhost --port {{ $coordinator.boltPort }} failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }} periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }} - + volumeMounts: + {{- if $.Values.memgraph.coordinators.volumeClaim.storagePVC }} + - name: memgraph-coordinator-{{ $coordinator.id }}-lib-storage + mountPath: /var/lib/memgraph + {{- end }} + {{- if $.Values.memgraph.coordinators.volumeClaim.logPVC}} + - name: memgraph-coordinator-{{ $coordinator.id }}-log-storage + mountPath: /var/log/memgraph + {{- end }} + volumeClaimTemplates: + {{- if $.Values.memgraph.coordinators.volumeClaim.storagePVC }} + - metadata: + name: memgraph-coordinator-{{ $coordinator.id }}-lib-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if $.Values.memgraph.coordinators.volumeClaim.storagePVCClassName }} + storageClassName: {{ $.Values.memgraph.coordinators.volumeClaim.storagePVCClassName }} + {{- end }} + resources: + requests: + storage: {{ $.Values.memgraph.coordinators.volumeClaim.storagePVCSize }} + {{- end }} + {{- if $.Values.memgraph.coordinators.volumeClaim.logPVC }} + - metadata: + name: memgraph-coordinator-{{ $coordinator.id }}-log-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if $.Values.memgraph.coordinators.volumeClaim.logPVCClassName }} + storageClassName: {{ $.Values.memgraph.coordinators.volumeClaim.logPVCClassName }} + {{- end }} + resources: + requests: + storage: {{ $.Values.memgraph.coordinators.volumeClaim.storagePVC.logPVCSize }} + {{- end }} --- {{- end }} diff --git a/charts/memgraph-high-availability/templates/data.yaml b/charts/memgraph-high-availability/templates/data.yaml index fc87922..a3bbad3 100644 --- a/charts/memgraph-high-availability/templates/data.yaml +++ b/charts/memgraph-high-availability/templates/data.yaml @@ -14,6 +14,28 @@ spec: labels: app: memgraph-data-{{ $data.id }} spec: + initContainers: + - name: init + image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" + volumeMounts: + {{- if $.Values.memgraph.data.volumeClaim.storagePVC }} + - name: memgraph-data-{{ $data.id }}-lib-storage + mountPath: /var/lib/memgraph + {{- end }} + {{- if $.Values.memgraph.data.volumeClaim.logPVC }} + - name: memgraph-data-{{ $data.id }}-log-storage + mountPath: /var/log/memgraph + {{- end }} + command: [ "/bin/sh","-c" ] + args: [ "chown -R memgraph:memgraph /var/log; chown -R memgraph:memgraph /var/lib" ] + securityContext: + privileged: true + readOnlyRootFilesystem: false + capabilities: + drop: [ "all" ] + add: [ "CHOWN" ] + runAsUser: 0 + runAsNonRoot: false containers: - name: memgraph-data image: "{{ $.Values.memgraph.image.repository }}:{{ $.Values.memgraph.image.tag }}" @@ -55,5 +77,42 @@ spec: - echo 'RETURN 0;' | mgconsole --host localhost --port {{ $data.boltPort }} failureThreshold: {{ $.Values.memgraph.probes.startup.failureThreshold }} periodSeconds: {{ $.Values.memgraph.probes.startup.periodSeconds }} + volumeMounts: + {{- if $.Values.memgraph.data.volumeClaim.storagePVC }} + - name: memgraph-data-{{ $data.id }}-lib-storage + mountPath: /var/lib/memgraph + {{- end }} + {{- if $.Values.memgraph.data.volumeClaim.logPVC}} + - name: memgraph-data-{{ $data.id }}-log-storage + mountPath: /var/log/memgraph + {{- end }} + volumeClaimTemplates: + {{- if $.Values.memgraph.data.volumeClaim.storagePVC }} + - metadata: + name: memgraph-data-{{ $data.id }}-lib-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if $.Values.memgraph.data.volumeClaim.storagePVCClassName }} + storageClassName: {{ $.Values.memgraph.data.volumeClaim.storagePVCClassName }} + {{- end }} + resources: + requests: + storage: {{ $.Values.memgraph.data.volumeClaim.storagePVCSize }} + {{- end }} + {{- if $.Values.memgraph.data.volumeClaim.logPVC }} + - metadata: + name: memgraph-data-{{ $data.id }}-log-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if $.Values.memgraph.data.volumeClaim.logPVCClassName }} + storageClassName: {{ $.Values.memgraph.data.volumeClaim.logPVCClassName }} + {{- end }} + resources: + requests: + storage: {{ $.Values.memgraph.data.volumeClaim.logPVCSize }} + {{- end }} + --- {{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index be96341..11c5558 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -20,6 +20,23 @@ memgraph: liveness: initialDelaySeconds: 30 periodSeconds: 10 + data: + volumeClaim: + storagePVCClassName: "" + storagePVC: true + storagePVCSize: "1Gi" + logPVCClassName: "" + logPVC: false + logPVCSize: "256Mi" + coordinators: + volumeClaim: + storagePVCClassName: "" + storagePVC: true + storagePVCSize: "1Gi" + logPVCClassName: "" + logPVC: false + logPVCSize: "256Mi" + data: @@ -34,6 +51,7 @@ data: - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" + - id: "1" boltPort: 7688 managementPort: 19002 From 0bd1785a3b0f6fb48193f996970eaea68ba1ef31 Mon Sep 17 00:00:00 2001 From: Andi Skrgat Date: Wed, 15 May 2024 12:43:35 +0200 Subject: [PATCH 12/18] Improve setup, change ports --- .../templates/cluster-setup.yaml | 39 ++++++++-------- charts/memgraph-high-availability/values.yaml | 46 +++++++++---------- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/charts/memgraph-high-availability/templates/cluster-setup.yaml b/charts/memgraph-high-availability/templates/cluster-setup.yaml index 6f1ac6b..b046eb4 100644 --- a/charts/memgraph-high-availability/templates/cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/cluster-setup.yaml @@ -16,31 +16,34 @@ spec: apt-get update && apt-get install -y netcat-openbsd # Wait until the pods are available - echo "Waiting for pods to become available..." - until nc -z memgraph-coordinator-1.default.svc.cluster.local 17687; do sleep 1; done - until nc -z memgraph-coordinator-2.default.svc.cluster.local 17690; do sleep 1; done - until nc -z memgraph-coordinator-3.default.svc.cluster.local 17691; do sleep 1; done + echo "Waiting for pods to become available for Bolt connection..." + until nc -z memgraph-coordinator-1.default.svc.cluster.local 7687; do sleep 1; done + until nc -z memgraph-coordinator-2.default.svc.cluster.local 7687; do sleep 1; done + until nc -z memgraph-coordinator-3.default.svc.cluster.local 7687; do sleep 1; done until nc -z memgraph-data-0.default.svc.cluster.local 7687; do sleep 1; done - until nc -z memgraph-data-1.default.svc.cluster.local 7688; do sleep 1; done - echo "Services are available!" + until nc -z memgraph-data-1.default.svc.cluster.local 7687; do sleep 1; done + echo "Pods are available for Bolt connection!" sleep 5 # Run the mgconsole commands echo "Running mgconsole commands..." - echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-2.default.svc.cluster.local --port 17690 - echo 'RETURN 0;' | mgconsole --host memgraph-coordinator-3.default.svc.cluster.local --port 17691 + echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:7687", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:12000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:10000", "replication_server": "memgraph-data-0.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7687", "management_server": "memgraph-data-1.default.svc.cluster.local:10000", "replication_server": "memgraph-data-1.default.svc.cluster.local:20000"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + sleep 3 + echo "SHOW INSTANCES on coord1" + echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo "SHOW INSTANCES on coord2" + echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-2.default.svc.cluster.local --port 7687 + echo "SHOW INSTANCES on coord3" + echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-3.default.svc.cluster.local --port 7687 + echo "RETURN 0 on 1st data instance" echo 'RETURN 0;' | mgconsole --host memgraph-data-0.default.svc.cluster.local --port 7687 - echo 'RETURN 0;' | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7688 - - - echo 'ADD COORDINATOR 2 WITH CONFIG {"bolt_server": "memgraph-coordinator-2.default.svc.cluster.local:17690", "coordinator_server": "memgraph-coordinator-2.default.svc.cluster.local:20002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'ADD COORDINATOR 3 WITH CONFIG {"bolt_server": "memgraph-coordinator-3.default.svc.cluster.local:17691", "coordinator_server": "memgraph-coordinator-3.default.svc.cluster.local:20003"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'REGISTER INSTANCE instance_1 WITH CONFIG {"bolt_server": "memgraph-data-0.default.svc.cluster.local:7687", "management_server": "memgraph-data-0.default.svc.cluster.local:19001", "replication_server": "memgraph-data-0.default.svc.cluster.local:18001"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'REGISTER INSTANCE instance_2 WITH CONFIG {"bolt_server": "memgraph-data-1.default.svc.cluster.local:7688", "management_server": "memgraph-data-1.default.svc.cluster.local:19002", "replication_server": "memgraph-data-1.default.svc.cluster.local:18002"};' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 - echo 'SET INSTANCE instance_1 TO MAIN;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 17687 + echo "RETURN 0 on 2nd data instance" + echo 'RETURN 0;' | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7687 securityContext: runAsUser: 0 diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 11c5558..c02ff5b 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -5,7 +5,7 @@ memgraph: image: repository: memgraph - tag: 2.16.0_65_bdff2fefa + tag: 2.16.0_73_535a6abea pullPolicy: IfNotPresent env: MEMGRAPH_ENTERPRISE_LICENSE: "" @@ -23,7 +23,7 @@ memgraph: data: volumeClaim: storagePVCClassName: "" - storagePVC: true + storagePVC: false storagePVCSize: "1Gi" logPVCClassName: "" logPVC: false @@ -31,7 +31,7 @@ memgraph: coordinators: volumeClaim: storagePVCClassName: "" - storagePVC: true + storagePVC: false storagePVCSize: "1Gi" logPVCClassName: "" logPVC: false @@ -42,59 +42,59 @@ memgraph: data: - id: "0" boltPort: 7687 - managementPort: 19001 - replicationPort: 18001 + managementPort: 10000 + replicationPort: 20000 args: - "--experimental-enabled=high-availability" - - "--management-port=19001" + - "--management-port=10000" - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" - id: "1" - boltPort: 7688 - managementPort: 19002 - replicationPort: 18002 + boltPort: 7687 + managementPort: 10000 + replicationPort: 20000 args: - "--experimental-enabled=high-availability" - - "--management-port=19002" - - "--bolt-port=7688" + - "--management-port=10000" + - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" coordinators: - id: "1" - boltPort: 17687 - coordinatorPort: 20001 + boltPort: 7687 + coordinatorPort: 12000 args: - "--experimental-enabled=high-availability" - "--coordinator-id=1" - - "--coordinator-port=20001" - - "--bolt-port=17687" + - "--coordinator-port=12000" + - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" - id: "2" - boltPort: 17690 - coordinatorPort: 20002 + boltPort: 7687 + coordinatorPort: 12000 args: - "--experimental-enabled=high-availability" - "--coordinator-id=2" - - "--coordinator-port=20002" - - "--bolt-port=17690" + - "--coordinator-port=12000" + - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" - id: "3" - boltPort: 17691 - coordinatorPort: 20003 + boltPort: 7687 + coordinatorPort: 12000 args: - "--experimental-enabled=high-availability" - "--coordinator-id=3" - - "--coordinator-port=20003" - - "--bolt-port=17691" + - "--coordinator-port=12000" + - "--bolt-port=7687" - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" From 01a819b4a8daa11678dfdd6a53a8ff0e1c10b8c0 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 15 May 2024 15:34:16 +0200 Subject: [PATCH 13/18] Add external services support. --- .../templates/services-coordinators.yaml | 21 ++++++++++++++++++- .../templates/services-data.yaml | 21 ++++++++++++++++++- charts/memgraph-high-availability/values.yaml | 2 +- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/charts/memgraph-high-availability/templates/services-coordinators.yaml b/charts/memgraph-high-availability/templates/services-coordinators.yaml index 06c0179..62742c9 100644 --- a/charts/memgraph-high-availability/templates/services-coordinators.yaml +++ b/charts/memgraph-high-availability/templates/services-coordinators.yaml @@ -1,4 +1,4 @@ -# Service for coordinator instances +# Service for coordinator instances internal {{- range .Values.coordinators }} --- apiVersion: v1 @@ -6,6 +6,7 @@ kind: Service metadata: name: memgraph-coordinator-{{ .id }} spec: + type: ClusterIP selector: app: memgraph-coordinator-{{ .id }} ports: @@ -18,3 +19,21 @@ spec: port: {{ .coordinatorPort }} targetPort: {{ .coordinatorPort }} {{- end }} + +# Service for coordinators instances external +{{- range .Values.coordinators }} +--- +apiVersion: v1 +kind: Service +metadata: + name: memgraph-coordinator-{{ .id }}-external +spec: + type: NodePort + selector: + app: memgraph-coordinator-{{ .id }} + ports: + - protocol: TCP + name: bolt + port: 7687 + targetPort: 7687 +{{- end }} diff --git a/charts/memgraph-high-availability/templates/services-data.yaml b/charts/memgraph-high-availability/templates/services-data.yaml index 954fe5c..30b5c22 100644 --- a/charts/memgraph-high-availability/templates/services-data.yaml +++ b/charts/memgraph-high-availability/templates/services-data.yaml @@ -1,4 +1,4 @@ -# Service for data instances +# Service for data instances internal {{- range .Values.data }} --- apiVersion: v1 @@ -6,6 +6,7 @@ kind: Service metadata: name: memgraph-data-{{ .id }} spec: + type: ClusterIP selector: app: memgraph-data-{{ .id }} ports: @@ -22,3 +23,21 @@ spec: port: {{ .replicationPort }} targetPort: {{ .replicationPort }} {{- end }} + +# Service for data instances external +{{- range .Values.data }} +--- +apiVersion: v1 +kind: Service +metadata: + name: memgraph-data-{{ .id }}-external +spec: + type: NodePort + selector: + app: memgraph-data-{{ .id }} + ports: + - protocol: TCP + name: bolt + port: {{ .boltPort }} + targetPort: {{ .boltPort }} +{{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index c02ff5b..6bcb99c 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -5,7 +5,7 @@ memgraph: image: repository: memgraph - tag: 2.16.0_73_535a6abea + tag: 2.16.0_72_437f6f0b7 pullPolicy: IfNotPresent env: MEMGRAPH_ENTERPRISE_LICENSE: "" From 43acb69f80b12ec910456b12ae92136dc828134d Mon Sep 17 00:00:00 2001 From: Andi Skrgat Date: Wed, 15 May 2024 15:38:00 +0200 Subject: [PATCH 14/18] notes arch --- charts/memgraph-high-availability/templates/NOTES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/memgraph-high-availability/templates/NOTES.txt b/charts/memgraph-high-availability/templates/NOTES.txt index bc34b0d..41cf313 100644 --- a/charts/memgraph-high-availability/templates/NOTES.txt +++ b/charts/memgraph-high-availability/templates/NOTES.txt @@ -1,3 +1,3 @@ -Running Memgraph in High-availability configuraiton! +Running Memgraph in High-availability configuration with one hybrid node which hosts both control-plane nodes and workers. + -TODO: Fill the details From 6ae461300ca548626c48972d734bf9237ec08a35 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 15 May 2024 16:19:18 +0200 Subject: [PATCH 15/18] Update the values file and readme --- .../templates/NOTES.txt | 13 +++ .../templates/_helpers.tpl | 12 ++ .../templates/serviceaccount.yaml | 12 ++ charts/memgraph-high-availability/values.yaml | 110 ------------------ 4 files changed, 37 insertions(+), 110 deletions(-) create mode 100644 charts/memgraph-high-availability/templates/serviceaccount.yaml diff --git a/charts/memgraph-high-availability/templates/NOTES.txt b/charts/memgraph-high-availability/templates/NOTES.txt index 41cf313..d809c84 100644 --- a/charts/memgraph-high-availability/templates/NOTES.txt +++ b/charts/memgraph-high-availability/templates/NOTES.txt @@ -1,3 +1,16 @@ +Thank you for installing the Memgraph High-availability cluster! 🎉 + +Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability". + Running Memgraph in High-availability configuration with one hybrid node which hosts both control-plane nodes and workers. +The cluster setup requires the proper enterprise license to work since HA is an enterprise feature. + +You can connect to Memgraph instances via Lab, mgconsole, or any other client. By default, all Memgraph instances (coordinators and data instances) listen on port 7687 for a bolt connection. +Make sure your are connecting to the correct ip address and port. For details check the configuration on your cloud provider(aws, gcp, azure, etc.) + +If you are connecting via mgconsole, you can use the following command: + +mgconsole --host --port +If you are connecting via Lab, specify your instance IP address and port in Memgraph Lab GUI. diff --git a/charts/memgraph-high-availability/templates/_helpers.tpl b/charts/memgraph-high-availability/templates/_helpers.tpl index 96b8af0..c43a5d1 100644 --- a/charts/memgraph-high-availability/templates/_helpers.tpl +++ b/charts/memgraph-high-availability/templates/_helpers.tpl @@ -30,3 +30,15 @@ helm.sh/chart: {{ include "memgraph.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} + + +{{/* +Create the name of the service account to use +*/}} +{{- define "memgraph.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "memgraph.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/memgraph-high-availability/templates/serviceaccount.yaml b/charts/memgraph-high-availability/templates/serviceaccount.yaml new file mode 100644 index 0000000..513ee9a --- /dev/null +++ b/charts/memgraph-high-availability/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "memgraph.serviceAccountName" . }} + labels: + {{- include "memgraph.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index 6bcb99c..e4fedff 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -98,113 +98,3 @@ coordinators: - "--also-log-to-stderr" - "--log-level=TRACE" - "--replication-restore-state-on-startup=true" - - - -# ha: -# main: -# args: -# - "--experimental-enabled=high-availability" -# - "--management-port=19001" -# - "--bolt-port=7687" -# replica: -# args: -# - "--experimental-enabled=high-availability" -# - "--management-port=19002" -# - "--bolt-port=7688" - - -# replicaCount: 1 - -# image: -# repository: nginx -# pullPolicy: IfNotPresent -# # Overrides the image tag whose default is the chart appVersion. -# tag: "" - -# imagePullSecrets: [] -# nameOverride: "" -# fullnameOverride: "" - -# serviceAccount: -# # Specifies whether a service account should be created -# create: true -# # Automatically mount a ServiceAccount's API credentials? -# automount: true -# # Annotations to add to the service account -# annotations: {} -# # The name of the service account to use. -# # If not set and create is true, a name is generated using the fullname template -# name: "" - -# podAnnotations: {} -# podLabels: {} - -# podSecurityContext: {} -# # fsGroup: 2000 - -# securityContext: {} -# # capabilities: -# # drop: -# # - ALL -# # readOnlyRootFilesystem: true -# # runAsNonRoot: true -# # runAsUser: 1000 - -# service: -# type: ClusterIP -# port: 80 - -# ingress: -# enabled: false -# className: "" -# annotations: {} -# # kubernetes.io/ingress.class: nginx -# # kubernetes.io/tls-acme: "true" -# hosts: -# - host: chart-example.local -# paths: -# - path: / -# pathType: ImplementationSpecific -# tls: [] -# # - secretName: chart-example-tls -# # hosts: -# # - chart-example.local - -# resources: {} -# # We usually recommend not to specify default resources and to leave this as a conscious -# # choice for the user. This also increases chances charts run on environments with little -# # resources, such as Minikube. If you do want to specify resources, uncomment the following -# # lines, adjust them as necessary, and remove the curly braces after 'resources:'. -# # limits: -# # cpu: 100m -# # memory: 128Mi -# # requests: -# # cpu: 100m -# # memory: 128Mi - -# autoscaling: -# enabled: false -# minReplicas: 1 -# maxReplicas: 100 -# targetCPUUtilizationPercentage: 80 -# # targetMemoryUtilizationPercentage: 80 - -# # Additional volumes on the output Deployment definition. -# volumes: [] -# # - name: foo -# # secret: -# # secretName: mysecret -# # optional: false - -# # Additional volumeMounts on the output Deployment definition. -# volumeMounts: [] -# # - name: foo -# # mountPath: "/etc/foo" -# # readOnly: true - -# nodeSelector: {} - -# tolerations: [] - -# affinity: {} From 51b0cb5ad89986410fa71f5ac6afd257b5f7c085 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 15 May 2024 16:29:53 +0200 Subject: [PATCH 16/18] Add test cluster setup --- .../templates/serviceaccount.yaml | 12 ------ .../templates/tests/test-cluster-setup.yaml | 40 +++++++++++++++++++ 2 files changed, 40 insertions(+), 12 deletions(-) delete mode 100644 charts/memgraph-high-availability/templates/serviceaccount.yaml create mode 100644 charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml diff --git a/charts/memgraph-high-availability/templates/serviceaccount.yaml b/charts/memgraph-high-availability/templates/serviceaccount.yaml deleted file mode 100644 index 513ee9a..0000000 --- a/charts/memgraph-high-availability/templates/serviceaccount.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "memgraph.serviceAccountName" . }} - labels: - {{- include "memgraph.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml b/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml new file mode 100644 index 0000000..2afce9b --- /dev/null +++ b/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml @@ -0,0 +1,40 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Release.Name }}-memgraph-test-cluster-setup" + labels: + {{- include "memgraph.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + template: + metadata: + labels: + app: memgraph + spec: + containers: + - name: memgraph-test-cluster-setup + image: memgraph/memgraph:2.16.0 + command: ["/bin/sh", "-c"] + args: + - | + check_mgconsole() { + local host=$1 + local command=$2 + local expected=$3 + + result=$(echo $command | mgconsole --host $host --port 7687) + if [[ $result != *$expected* ]]; then + echo "Unexpected mgconsole result for host $host:" + echo $result + exit 1 + fi + } + + check_mgconsole "memgraph-coordinator-1.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_1" + check_mgconsole "memgraph-coordinator-2.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_2" + check_mgconsole "memgraph-coordinator-3.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_3" + check_mgconsole "memgraph-data-0.default.svc.cluster.local" "RETURN 0;" "0" + check_mgconsole "memgraph-data-1.default.svc.cluster.local" "RETURN 0;" "0" + restartPolicy: Never + backoffLimit: 4 From dd5470e2a3182d01019519179780a12a5cab6789 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 16 May 2024 10:35:26 +0200 Subject: [PATCH 17/18] Update tests. --- .../templates/tests/test-cluster-setup.yaml | 49 ++++++++++++------- .../templates/tests/test-connection.yaml | 15 ++++-- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml b/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml index 2afce9b..3bb7c57 100644 --- a/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml +++ b/charts/memgraph-high-availability/templates/tests/test-cluster-setup.yaml @@ -15,26 +15,39 @@ spec: containers: - name: memgraph-test-cluster-setup image: memgraph/memgraph:2.16.0 - command: ["/bin/sh", "-c"] + command: ["/bin/bash", "-c"] args: - | - check_mgconsole() { - local host=$1 - local command=$2 - local expected=$3 + echo "Running cluster test setup..." + result=$(echo 'SHOW INSTANCES;' | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687) + echo "$result" - result=$(echo $command | mgconsole --host $host --port 7687) - if [[ $result != *$expected* ]]; then - echo "Unexpected mgconsole result for host $host:" - echo $result - exit 1 - fi + # Use awk to check if all instances have health status "up" and there are exactly 5 instances + echo "$result" | awk ' + BEGIN { + FS = "|" + instance_count = 0 + health_ok = 1 } - - check_mgconsole "memgraph-coordinator-1.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_1" - check_mgconsole "memgraph-coordinator-2.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_2" - check_mgconsole "memgraph-coordinator-3.default.svc.cluster.local" "SHOW INSTANCES;" "coordinator_3" - check_mgconsole "memgraph-data-0.default.svc.cluster.local" "RETURN 0;" "0" - check_mgconsole "memgraph-data-1.default.svc.cluster.local" "RETURN 0;" "0" + NR > 3 && NR <= 8 { + gsub(/^ *| *$/, "", $6) # Trim spaces from health + health = $6 + print "Health: [" health "]" # Debug print + instance_count++ + if (health != "up") { + health_ok = 0 + print "Non-up health found: [" health "]" # Debug print + } + } + END { + print "Instance count: " instance_count # Debug print + print "Health OK: " health_ok # Debug print + if (instance_count == 5 && health_ok == 1) { + print "All instances are up and there are exactly 5 instances." + } else { + print "Check failed. Either not all instances are up or the count is not 5." + } + } + ' restartPolicy: Never - backoffLimit: 4 + backoffLimit: 3 diff --git a/charts/memgraph-high-availability/templates/tests/test-connection.yaml b/charts/memgraph-high-availability/templates/tests/test-connection.yaml index f164143..272c41c 100644 --- a/charts/memgraph-high-availability/templates/tests/test-connection.yaml +++ b/charts/memgraph-high-availability/templates/tests/test-connection.yaml @@ -1,7 +1,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: "{{ .Release.Name }}-memgraph-test" + name: "{{ .Release.Name }}-memgraph-test-connection" labels: {{- include "memgraph.labels" . | nindent 4 }} annotations: @@ -15,6 +15,15 @@ spec: command: ["/bin/sh", "-c"] args: - | - echo "RETURN 0;" | mgconsole --host {{ include "memgraph.fullname" . }} --port 7687 + echo "Running connection test on data instances..." + echo "RETURN 0;" | mgconsole --host memgraph-data-0.default.svc.cluster.local --port 7687 + echo "RETURN 0;" | mgconsole --host memgraph-data-1.default.svc.cluster.local --port 7687 + + echo "Running a connection test on coordinator instances..." + echo "SHOW INSTANCES;" | mgconsole --host memgraph-coordinator-1.default.svc.cluster.local --port 7687 + echo "SHOW INSTANCES;" | mgconsole --host memgraph-coordinator-2.default.svc.cluster.local --port 7687 + echo "SHOW INSTANCES;" | mgconsole --host memgraph-coordinator-3.default.svc.cluster.local --port 7687 + + restartPolicy: Never - backoffLimit: 4 + backoffLimit: 3 From 8a5cc2a8af54cebf9624d9a75e3edc0d78ee0bb3 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Thu, 16 May 2024 11:40:22 +0200 Subject: [PATCH 18/18] Update readme and values. --- README.md | 20 ++++++ charts/memgraph-high-availability/Chart.yaml | 2 +- charts/memgraph-high-availability/README.md | 72 +++++++++++++++++++ .../templates/NOTES.txt | 3 +- charts/memgraph-high-availability/values.yaml | 8 +-- 5 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 charts/memgraph-high-availability/README.md diff --git a/README.md b/README.md index 16f62f4..5426d10 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Welcome to the Memgraph Helm Charts repository. This repository provides Helm ch ## Available charts - [**Memgraph standalone**](#memgraph-standalone) - [**Memgraph Lab**](#memgraph-lab) +- [**Memgraph high availability](#memgraph-high-availability) ## Prerequisites Helm version 3 or above installed. @@ -59,6 +60,25 @@ Refer to the [Data visualization in Memgraph Lab](https://memgraph.com/docs/data To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands. + +## Memgraph high availability +Deploys high available Memgraph cluster, that includes two data instances and three coordinators. + +For detailed information and usage instructions, please refer to the [chart's individual README file](./charts/memgraph/README.md). + +To install Memgraph standalone, run the following command: + +``` +helm install my-release memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=,memgraph.env.MEMGRAPH_ORGANIZATION_NAME= +``` +Replace `my-release` with a name of your choice for the release. + + +Once Memgraph cluster is up and running, you can access it using the provided services and endpoints. Refer to the [Memgraph documentation](https://memgraph.com/docs/memgraph/connect-to-memgraph) for details on how to connect to and interact with Memgraph. + +To upgrade or uninstall a deployed Memgraph release, you can use the `helm upgrade` or `helm uninstall` commands, respectively. Refer to the [Helm documentation](https://helm.sh/docs/) for more details on these commands. + + ## Contributing Contributions are welcome! If you have any improvements, bug fixes, or new charts to add, please follow the contribution guidelines outlined in the [`CONTRIBUTING.md`](https://github.com/memgraph/helm-charts/blob/main/CONTRIBUTING.md) file. If you have questions and are unsure of how to contribute, please join our Discord server to get in touch with us. diff --git a/charts/memgraph-high-availability/Chart.yaml b/charts/memgraph-high-availability/Chart.yaml index 4c2c088..23525e5 100644 --- a/charts/memgraph-high-availability/Chart.yaml +++ b/charts/memgraph-high-availability/Chart.yaml @@ -3,7 +3,7 @@ name: memgraph-high-availability description: A Helm chart for Kubernetes with Memgraph High availabiliy capabilites version: 0.1.0 -appVersion: "2.16.0" +appVersion: "2.17.0" type: application diff --git a/charts/memgraph-high-availability/README.md b/charts/memgraph-high-availability/README.md new file mode 100644 index 0000000..51010ae --- /dev/null +++ b/charts/memgraph-high-availability/README.md @@ -0,0 +1,72 @@ +## Memgraph high availability Kubernetes Helm Chart +A Helm Chart for deploying Memgraph in [high-availability setup](https://memgraph.com/docs/clustering/high-availability). + +Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability". +The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails. + +## Installing the Memgraph Helm Chart +To install the Memgraph HA Helm Chart, follow the steps below: +``` +helm install memgraph/memgraph-high-availability --set memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE=,memgraph.env.MEMGRAPH_ORGANIZATION_NAME= +``` +Replace `` with a name of your choice for the release and set the enterprise license. + +## Changing the default chart values +To change the default chart values, run the command with the specified set of flags: +``` +helm install memgraph/memgraph-high-availability --set =,=,... +``` +Or you can modify a `values.yaml` file and override the desired values: +``` +helm install memgraph/memgraph-high-availability-f values.yaml +``` + + +## Configuration Options + +The following table lists the configurable parameters of the Memgraph chart and their default values. + +| Parameter | Description | Default | +|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------| +| `memgraph.image.repository` | Memgraph Docker image repository | `memgraph/memgraph` | +| `memgraph.image.tag` | Specific tag for the Memgraph Docker image. Overrides the image tag whose default is chart version. | `2.17.0` | +| `memgraph.image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `memgraph.env.MEMGRAPH_ENTERPRISE_LICENSE` | Memgraph enterprise license | `` | +| `memgraph.env.MEMGRAPH_ORGANIZATION_NAME` | Organization name | `` | +| `memgraph.probes.startup.failureThreshold` | Startup probe failure threshold | `30` | +| `memgraph.probes.startup.periodSeconds` | Startup probe period in seconds | `10` | +| `memgraph.probes.readiness.initialDelaySeconds` | Readiness probe initial delay in seconds | `5` | +| `memgraph.probes.readiness.periodSeconds` | Readiness probe period in seconds | `5` | +| `memgraph.probes.liveness.initialDelaySeconds` | Liveness probe initial delay in seconds | `30` | +| `memgraph.probes.liveness.periodSeconds` | Liveness probe period in seconds | `10` | +| `memgraph.data.volumeClaim.storagePVC` | Enable storage PVC | `true` | +| `memgraph.data.volumeClaim.storagePVCSize` | Size of the storage PVC | `1Gi` | +| `memgraph.data.volumeClaim.logPVC` | Enable log PVC | `false` | +| `memgraph.data.volumeClaim.logPVCSize` | Size of the log PVC | `256Mi` | +| `memgraph.coordinators.volumeClaim.storagePVC` | Enable storage PVC for coordinators | `true` | +| `memgraph.coordinators.volumeClaim.storagePVCSize` | Size of the storage PVC for coordinators | `1Gi` | +| `memgraph.coordinators.volumeClaim.logPVC` | Enable log PVC for coordinators | `false` | +| `memgraph.coordinators.volumeClaim.logPVCSize` | Size of the log PVC for coordinators | `256Mi` | +| `data` | Configuration for data instances | See `data` section | +| `coordinators` | Configuration for coordinator instances | See `coordinators` section | + +For the `data` and `coordinators` sections, each item in the list has the following parameters: + +| Parameter | Description | Default | +|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------| +| `id` | ID of the instance | `0` for data, `1` for coordinators | +| `boltPort` | Bolt port of the instance | `7687` | +| `managementPort` (data only) | Management port of the data instance | `10000` | +| `replicationPort` (data only) | Replication port of the data instance | `20000` | +| `coordinatorPort` (coordinators only) | Coordinator port of the coordinator instance | `12000` | +| `args` | List of arguments for the instance | See `args` section | + +The `args` section contains a list of arguments for the instance. The default values are the same for all instances: + +```markdown +- "--also-log-to-stderr" +- "--log-level=TRACE" +- "--replication-restore-state-on-startup=true" +``` + +For all available database settings, refer to the [Configuration settings reference guide](https://memgraph.com/docs/memgraph/reference-guide/configuration). diff --git a/charts/memgraph-high-availability/templates/NOTES.txt b/charts/memgraph-high-availability/templates/NOTES.txt index d809c84..71f966a 100644 --- a/charts/memgraph-high-availability/templates/NOTES.txt +++ b/charts/memgraph-high-availability/templates/NOTES.txt @@ -1,8 +1,7 @@ Thank you for installing the Memgraph High-availability cluster! 🎉 Memgraph HA cluster includes 3 coordinators, 2 data instances by default. The cluster setup is performed via the cluster-setup job. The HA cluster is still work in progress and started with "--experimental-enabled=high-availability". - -Running Memgraph in High-availability configuration with one hybrid node which hosts both control-plane nodes and workers. +The cluster is started in the configuration without the node selector, which means that in the current configuration, it is not highly available if the node fails. The cluster setup requires the proper enterprise license to work since HA is an enterprise feature. diff --git a/charts/memgraph-high-availability/values.yaml b/charts/memgraph-high-availability/values.yaml index e4fedff..44a48b8 100644 --- a/charts/memgraph-high-availability/values.yaml +++ b/charts/memgraph-high-availability/values.yaml @@ -4,8 +4,8 @@ memgraph: image: - repository: memgraph - tag: 2.16.0_72_437f6f0b7 + repository: memgraph/memgraph + tag: 2.17.0 pullPolicy: IfNotPresent env: MEMGRAPH_ENTERPRISE_LICENSE: "" @@ -23,7 +23,7 @@ memgraph: data: volumeClaim: storagePVCClassName: "" - storagePVC: false + storagePVC: true storagePVCSize: "1Gi" logPVCClassName: "" logPVC: false @@ -31,7 +31,7 @@ memgraph: coordinators: volumeClaim: storagePVCClassName: "" - storagePVC: false + storagePVC: true storagePVCSize: "1Gi" logPVCClassName: "" logPVC: false