From 5f9adad495f4fcf9557174d4d8271f619573f81d Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Tue, 28 May 2024 12:46:20 +0300 Subject: [PATCH 01/10] Persistent Storage Existing Claim, NodeAffinity, ImagePullSecrets, App version 2.17, Added User, Password ENV, Enterprise License and Organization ENV --- charts/memgraph/README.md | 2 + charts/memgraph/templates/service.yaml | 13 +++- charts/memgraph/templates/statefulset.yaml | 87 ++++++++++++++++++---- charts/memgraph/values.yaml | 62 ++++++++++++--- 4 files changed, 138 insertions(+), 26 deletions(-) diff --git a/charts/memgraph/README.md b/charts/memgraph/README.md index c236b59..95b5ca1 100644 --- a/charts/memgraph/README.md +++ b/charts/memgraph/README.md @@ -66,5 +66,7 @@ The `memgraphConfig` parameter should be a list of strings defining the values o memgraphConfig: - "--also-log-to-stderr=true" - "--log-level=TRACE" + - "--log-file=''" + ``` 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/templates/service.yaml b/charts/memgraph/templates/service.yaml index 7e7ac6c..0257bfb 100644 --- a/charts/memgraph/templates/service.yaml +++ b/charts/memgraph/templates/service.yaml @@ -14,6 +14,13 @@ spec: - port: {{ .Values.service.port }} targetPort: {{ .Values.service.targetPort}} protocol: {{ .Values.service.protocol }} - name: bolt - selector: - {{- include "memgraph.selectorLabels" . | nindent 4 }} + name: memgraph + - port: 7444 + protocol: {{ .Values.service.protocol }} + name: websocket + - port: 9091 + protocol: {{ .Values.service.protocol }} + name: http + + selector: + {{- include "memgraph.selectorLabels" . | nindent 4 }} \ No newline at end of file diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index 1e258a1..52ed195 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -27,7 +27,25 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} spec: + terminationGracePeriodSeconds: 1800 securityContext: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: memgraph-lib-storage + persistentVolumeClaim: + {{- if .Values.persistentVolumeClaim.existingClaim }} + claimName: {{ .Values.persistentVolumeClaim.existingClaim }} + {{- else}} + claimName: {{ include "memgraph.fullname" . }}-lib-storage + {{- end }} + {{- if .Values.persistentVolumeClaim.createLogStorage }} + - name: memgraph-log-storage + persistentVolumeClaim: + claimName: {{ include "memgraph.fullname" . }}-log-storage + {{- end }} containers: - name: memgraph image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" @@ -35,49 +53,92 @@ spec: {{- range .Values.memgraphConfig }} - {{ . | quote }} {{- end }} + {{- if not createLogStorage }} + - "--log-file=''" + {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: runAsUser: 0 ports: - name: memgraph containerPort: {{ .Values.service.port }} + - name: websocket + containerPort: 7444 + - name: http + containerPort: 9091 + startupProbe: + tcpSocket: + port: memgraph + failureThreshold: 240 + periodSeconds: 30 + livenessProbe: + tcpSocket: + port: memgraph + periodSeconds: 30 + timeoutSeconds: 20 + readinessProbe: + tcpSocket: + port: memgraph + periodSeconds: 30 {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} + env: + - name: MEMGRAPH_USER + value: {{ .Values.memgraphUser }} + - name: MEMGRAPH_PASSWORD + value: {{ .Values.memgraphPassword }} + - name: MEMGRAPH_ENTERPRISE_LICENSE + value: {{ .Values.memgraphEnterpriseLicense }} + - name: MEMGRAPH_ORGANIZATION_NAME + value: {{ .Values.memgraphOrganizationName }} volumeMounts: - {{- if .Values.persistentVolumeClaim.storagePVC }} - - name: {{ include "memgraph.fullname" . }}-lib-storage + - name: memgraph-lib-storage mountPath: /var/lib/memgraph - {{- end }} - {{- if .Values.persistentVolumeClaim.logPVC }} - - name: {{ include "memgraph.fullname" . }}-log-storage + {{- if .Values.persistentVolumeClaim.createLogStorage }} + - name: memgraph-log-storage mountPath: /var/log/memgraph {{- end }} + {{- if .Values.nodeAffinity }} + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + preference: + matchExpressions: + - key: {{ .Values.nodeKey }} + operator: In + values: + - {{ .Values.nodeAffinity }} + {{- end }} volumeClaimTemplates: - {{- if .Values.persistentVolumeClaim.storagePVC }} + {{- if .Values.persistentVolumeClaim.createStorageClaim }} - metadata: name: {{ include "memgraph.fullname" . }}-lib-storage spec: accessModes: - "ReadWriteOnce" - {{- if .Values.persistentVolumeClaim.storagePVCClassName }} - storageClassName: {{ .Values.persistentVolumeClaim.storagePVCClassName }} + {{- if .Values.persistentVolumeClaim.storageClassName }} + storageClassName: {{ .Values.persistentVolumeClaim.storageClassName }} {{- end }} resources: requests: - storage: {{ .Values.persistentVolumeClaim.storagePVCSize }} + storage: {{ .Values.persistentVolumeClaim.storageSize }} + {{- if .Values.persistentVolumeClaim.storageVolumeName }} + volumeName: {{ .Values.persistentVolumeClaim.storageVolumeName }} + {{- end }} {{- end }} - {{- if .Values.persistentVolumeClaim.logPVC }} + {{- if .Values.persistentVolumeClaim.createLogStorage }} - metadata: name: {{ include "memgraph.fullname" . }}-log-storage spec: accessModes: - "ReadWriteOnce" - {{- if .Values.persistentVolumeClaim.logPVCClassName }} - storageClassName: {{ .Values.persistentVolumeClaim.logPVCClassName }} + {{- if .Values.persistentVolumeClaim.logStorageClassName }} + storageClassName: {{ .Values.persistentVolumeClaim.logStorageClassName }} {{- end }} resources: requests: - storage: {{ .Values.persistentVolumeClaim.logPVCSize }} + storage: {{ .Values.persistentVolumeClaim.logStorageSize }} {{- end }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 237f18e..f5a4f6b 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -1,30 +1,72 @@ image: - repository: memgraph/memgraph + repository: memgraph/memgraph-mage # Overrides the image tag whose default is v{{ .Chart.AppVersion }} tag: "" pullPolicy: IfNotPresent -# Can be increased to more but there is no replication or HA support in this chart. +## Image Secrets for custom images +imagePullSecrets: [{ name: regcred }] + replicaCount: 1 +## Node Affinity Preferred +# By setting theses parameters the PREFERRED deployment will be done first on the match LABELS with key and value then on other nodes. +# nodeKey: "nodegroup" give the name of a key +# Operator is In +# nodeAffinity: "memgraph" give the value of the key + +nodeKey: +nodeAffinity: + service: - type: NodePort + ## ClusterIP, NodePort, LoadBalancer + # ClusterIP keep the service inside the cluster makes it secure + # NodePort would create a external port change port: between 30000-32767 accessible to all the nodes and Public IPs if not in a VPC + # LoadBalancer is compabile with Cloud Providers on port: 80 without SSL redirected to the 7687 + type: ClusterIP port: 7687 targetPort: 7687 protocol: TCP annotations: {} - + persistentVolumeClaim: - storagePVCClassName: "" - storagePVC: true - storagePVCSize: 1Gi - logPVCClassName: "" - logPVC: true - logPVCSize: 256Mi + ## createStoragePVC `true` will create for each statefulset server a Persistant Volume Claim + ## `false` will let you choose an existing Persistant Volume Claim or will create one with an existing volume + createStorageClaim: false + ## Using a Storage Class Name with policy `retain` will keep the Persistant Volume Claim and the Volume + ## If you use a Storage Class Name with policy `delete` the Persistant Volume Claim and Volume will be deleted when the helm release is deleted + storageClassName: retain + ## Storage Size must me at minimum 4x the maximum size of your Dataset for Snapshots + ## See documentation for choosing the right size depending on the number of Snapshots you want to keep + ## Default is 3 snapshots and you need space to create a new one and WAL files + storageSize: 500Gi + + ## if `createStoragePVC` is `false` + ## Write the name and exising Persistant Volume Claim + existingClaim: memgraph-0 + ## If you want to create a Persistant Volume Claim for an existing Volume + storageVolumeName: + # storageVolumeName: pvc-fc30d4e1-c036-4702-9692-32a1235bdfc3 #sn15-1 + + ## Create a Dynamic Persistant Volume Claim for Logs + # `false` will only write logs to stdout / stderr + createLogStorage: false + logStorageClassName: "" + logStorageSize: 256Mi memgraphConfig: - "--also-log-to-stderr=true" +memgraphUser: +memgraphPassword: + +## Memgraph Enterprise Licence +# memgraphEnterpriseLicense: "" +# memgraphOrganizationName: "" + +memgraphEnterpriseLicense: "" +memgraphOrganizationName: "" + # Annotations to add to the statefulSet statefulSetAnnotations: {} # Annotations to add to the Pod From 25e545c06fa2b848fb2991b4af4ed648010256a5 Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Tue, 28 May 2024 14:27:30 +0300 Subject: [PATCH 02/10] Removed comment --- charts/memgraph/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index f5a4f6b..a3327bb 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -46,7 +46,6 @@ persistentVolumeClaim: existingClaim: memgraph-0 ## If you want to create a Persistant Volume Claim for an existing Volume storageVolumeName: - # storageVolumeName: pvc-fc30d4e1-c036-4702-9692-32a1235bdfc3 #sn15-1 ## Create a Dynamic Persistant Volume Claim for Logs # `false` will only write logs to stdout / stderr From da79f1bc8769c591f91726ab1b3d65d82f85b88a Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Sun, 9 Jun 2024 08:45:52 +0300 Subject: [PATCH 03/10] Fixed default values and Enterprise License only if filled default user and password --- charts/memgraph/Chart.yaml | 2 +- charts/memgraph/templates/service.yaml | 2 +- charts/memgraph/templates/statefulset.yaml | 18 ++- charts/memgraph/values.yaml | 8 +- test-memgraph.yaml | 168 +++++++++++++++++++++ 5 files changed, 184 insertions(+), 14 deletions(-) create mode 100644 test-memgraph.yaml diff --git a/charts/memgraph/Chart.yaml b/charts/memgraph/Chart.yaml index 1fdb1e3..561f284 100644 --- a/charts/memgraph/Chart.yaml +++ b/charts/memgraph/Chart.yaml @@ -3,7 +3,7 @@ name: memgraph home: https://memgraph.com/ type: application version: 0.1.2 -appVersion: "2.17.0" +appVersion: "1.17-memgraph-2.17" description: MemgraphDB Helm Chart keywords: - graph diff --git a/charts/memgraph/templates/service.yaml b/charts/memgraph/templates/service.yaml index 0257bfb..bd602c3 100644 --- a/charts/memgraph/templates/service.yaml +++ b/charts/memgraph/templates/service.yaml @@ -14,7 +14,7 @@ spec: - port: {{ .Values.service.port }} targetPort: {{ .Values.service.targetPort}} protocol: {{ .Values.service.protocol }} - name: memgraph + name: bolt - port: 7444 protocol: {{ .Values.service.protocol }} name: websocket diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index 52ed195..e900bad 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -53,14 +53,14 @@ spec: {{- range .Values.memgraphConfig }} - {{ . | quote }} {{- end }} - {{- if not createLogStorage }} + {{- if not .Values.persistentVolumeClaim.createLogStorage }} - "--log-file=''" {{- end }} imagePullPolicy: {{ .Values.image.pullPolicy }} securityContext: runAsUser: 0 ports: - - name: memgraph + - name: bolt containerPort: {{ .Values.service.port }} - name: websocket containerPort: 7444 @@ -68,17 +68,17 @@ spec: containerPort: 9091 startupProbe: tcpSocket: - port: memgraph + port: bolt failureThreshold: 240 periodSeconds: 30 livenessProbe: tcpSocket: - port: memgraph + port: bolt periodSeconds: 30 timeoutSeconds: 20 readinessProbe: tcpSocket: - port: memgraph + port: bolt periodSeconds: 30 {{- with .Values.resources }} resources: @@ -86,13 +86,15 @@ spec: {{- end }} env: - name: MEMGRAPH_USER - value: {{ .Values.memgraphUser }} + value: {{ .Values.memgraphUser | default "memgraph"}} - name: MEMGRAPH_PASSWORD - value: {{ .Values.memgraphPassword }} + value: {{ .Values.memgraphPassword | default "memgraph" }} + {{ if ne .Values.memgraphEnterpriseLicense "" }} - name: MEMGRAPH_ENTERPRISE_LICENSE value: {{ .Values.memgraphEnterpriseLicense }} + {{- end}} - name: MEMGRAPH_ORGANIZATION_NAME - value: {{ .Values.memgraphOrganizationName }} + value: {{ .Values.memgraphOrganizationName | default "" }} volumeMounts: - name: memgraph-lib-storage mountPath: /var/lib/memgraph diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index a3327bb..3d86ee1 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -5,7 +5,7 @@ image: pullPolicy: IfNotPresent ## Image Secrets for custom images -imagePullSecrets: [{ name: regcred }] +# imagePullSecrets: [{ name: regcred }] replicaCount: 1 @@ -32,10 +32,10 @@ service: persistentVolumeClaim: ## createStoragePVC `true` will create for each statefulset server a Persistant Volume Claim ## `false` will let you choose an existing Persistant Volume Claim or will create one with an existing volume - createStorageClaim: false + createStorageClaim: true ## Using a Storage Class Name with policy `retain` will keep the Persistant Volume Claim and the Volume ## If you use a Storage Class Name with policy `delete` the Persistant Volume Claim and Volume will be deleted when the helm release is deleted - storageClassName: retain + storageClassName: "" ## Storage Size must me at minimum 4x the maximum size of your Dataset for Snapshots ## See documentation for choosing the right size depending on the number of Snapshots you want to keep ## Default is 3 snapshots and you need space to create a new one and WAL files @@ -45,7 +45,7 @@ persistentVolumeClaim: ## Write the name and exising Persistant Volume Claim existingClaim: memgraph-0 ## If you want to create a Persistant Volume Claim for an existing Volume - storageVolumeName: + storageVolumeName: "" ## Create a Dynamic Persistant Volume Claim for Logs # `false` will only write logs to stdout / stderr diff --git a/test-memgraph.yaml b/test-memgraph.yaml new file mode 100644 index 0000000..286a4db --- /dev/null +++ b/test-memgraph.yaml @@ -0,0 +1,168 @@ +--- +# Source: memgraph/templates/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: memgraph + labels: + helm.sh/chart: memgraph-0.1.2 + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + app.kubernetes.io/version: "2.17.0" + app.kubernetes.io/managed-by: Helm +--- +# Source: memgraph/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: memgraph + labels: + helm.sh/chart: memgraph-0.1.2 + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + app.kubernetes.io/version: "2.17.0" + app.kubernetes.io/managed-by: Helm +spec: + type: ClusterIP + ports: + - port: 7687 + targetPort: 7687 + protocol: TCP + name: memgraph + - port: 7444 + protocol: TCP + name: websocket + - port: 9091 + protocol: TCP + name: http + + selector: + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph +--- +# Source: memgraph/templates/statefulset.yaml +# templates/statefulset.yaml +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: memgraph + labels: + helm.sh/chart: memgraph-0.1.2 + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + app.kubernetes.io/version: "2.17.0" + app.kubernetes.io/managed-by: Helm +spec: + replicas: 1 + serviceName: memgraph + selector: + matchLabels: + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + podManagementPolicy: OrderedReady + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + helm.sh/chart: memgraph-0.1.2 + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + app.kubernetes.io/version: "2.17.0" + app.kubernetes.io/managed-by: Helm + spec: + terminationGracePeriodSeconds: 1800 + securityContext: + imagePullSecrets: + - name: regcred + volumes: + - name: memgraph-lib-storage + persistentVolumeClaim: + claimName: memgraph-ams2 + containers: + - name: memgraph + image: "memgraph/memgraph-mage:2.17.0" + args: + - "--also-log-to-stderr=true" + - "--log-file=''" + imagePullPolicy: IfNotPresent + securityContext: + runAsUser: 0 + ports: + - name: memgraph + containerPort: 7687 + - name: websocket + containerPort: 7444 + - name: http + containerPort: 9091 + startupProbe: + tcpSocket: + port: memgraph + failureThreshold: 240 + periodSeconds: 30 + livenessProbe: + tcpSocket: + port: memgraph + periodSeconds: 30 + timeoutSeconds: 20 + readinessProbe: + tcpSocket: + port: memgraph + periodSeconds: 30 + env: + - name: MEMGRAPH_USER + value: memgraph + - name: MEMGRAPH_PASSWORD + value: + - name: MEMGRAPH_ENTERPRISE_LICENSE + value: + - name: MEMGRAPH_ORGANIZATION_NAME + value: + volumeMounts: + - name: memgraph-lib-storage + mountPath: /var/lib/memgraph + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + preference: + matchExpressions: + - key: name + operator: In + values: + - sn15-ams2 + volumeClaimTemplates: + - metadata: + name: memgraph-lib-storage + spec: + accessModes: + - "ReadWriteOnce" + resources: + requests: + storage: 500Gi +--- +# Source: memgraph/templates/tests/test-connection.yaml +apiVersion: batch/v1 +kind: Job +metadata: + name: "memgraph-memgraph-test" + labels: + helm.sh/chart: memgraph-0.1.2 + app.kubernetes.io/name: memgraph + app.kubernetes.io/instance: memgraph + app.kubernetes.io/version: "2.17.0" + app.kubernetes.io/managed-by: Helm + annotations: + "helm.sh/hook": test +spec: + template: + spec: + containers: + - name: memgraph-test + image: memgraph/memgraph:2.17.0 + command: ["/bin/sh", "-c"] + args: + - | + echo "RETURN 0;" | mgconsole --host memgraph --port 7687 + restartPolicy: Never + backoffLimit: 4 From e557f0bf7e85cb7e8507539e0f985536bf07f62e Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Sun, 9 Jun 2024 08:52:25 +0300 Subject: [PATCH 04/10] Memgraph without Mage --- charts/memgraph/Chart.yaml | 2 +- charts/memgraph/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/memgraph/Chart.yaml b/charts/memgraph/Chart.yaml index 561f284..1fdb1e3 100644 --- a/charts/memgraph/Chart.yaml +++ b/charts/memgraph/Chart.yaml @@ -3,7 +3,7 @@ name: memgraph home: https://memgraph.com/ type: application version: 0.1.2 -appVersion: "1.17-memgraph-2.17" +appVersion: "2.17.0" description: MemgraphDB Helm Chart keywords: - graph diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 3d86ee1..fd3c668 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -1,5 +1,5 @@ image: - repository: memgraph/memgraph-mage + repository: memgraph/memgraph # Overrides the image tag whose default is v{{ .Chart.AppVersion }} tag: "" pullPolicy: IfNotPresent From 49ececadf1a5069594503e86fa956c12ca3ca95a Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Sun, 9 Jun 2024 09:00:37 +0300 Subject: [PATCH 05/10] nodeAffinity improvment --- charts/memgraph/templates/statefulset.yaml | 8 ++++---- charts/memgraph/values.yaml | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index e900bad..94c9946 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -89,7 +89,7 @@ spec: value: {{ .Values.memgraphUser | default "memgraph"}} - name: MEMGRAPH_PASSWORD value: {{ .Values.memgraphPassword | default "memgraph" }} - {{ if ne .Values.memgraphEnterpriseLicense "" }} + {{ if .Values.memgraphEnterpriseLicense }} - name: MEMGRAPH_ENTERPRISE_LICENSE value: {{ .Values.memgraphEnterpriseLicense }} {{- end}} @@ -102,17 +102,17 @@ spec: - name: memgraph-log-storage mountPath: /var/log/memgraph {{- end }} - {{- if .Values.nodeAffinity }} + {{- if .Values.affinity.nodeAffinity }} affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 preference: matchExpressions: - - key: {{ .Values.nodeKey }} + - key: {{ .Values.affinity.nodeKey }} operator: In values: - - {{ .Values.nodeAffinity }} + - {{ .Values.affinity.nodeAffinity }} {{- end }} volumeClaimTemplates: {{- if .Values.persistentVolumeClaim.createStorageClaim }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index fd3c668..8ae0f23 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -14,9 +14,9 @@ replicaCount: 1 # nodeKey: "nodegroup" give the name of a key # Operator is In # nodeAffinity: "memgraph" give the value of the key - -nodeKey: -nodeAffinity: +affinity: + nodeKey: + nodeAffinity: service: ## ClusterIP, NodePort, LoadBalancer @@ -56,6 +56,9 @@ persistentVolumeClaim: memgraphConfig: - "--also-log-to-stderr=true" +## User and Password for the memgraph +## Default user and password: memgraph +# /TODO: create Secrets memgraphUser: memgraphPassword: From 882faa8383a9a6b1a2a589842412761529637891 Mon Sep 17 00:00:00 2001 From: "Pierre A. Manseau" Date: Sun, 9 Jun 2024 09:07:56 +0300 Subject: [PATCH 06/10] Change name variables for nodeKey nodeValue for affinity --- charts/memgraph/templates/statefulset.yaml | 6 +++--- charts/memgraph/values.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index 94c9946..b1083c0 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -29,7 +29,7 @@ spec: spec: terminationGracePeriodSeconds: 1800 securityContext: - {{- with .Values.imagePullSecrets }} + {{{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} @@ -102,7 +102,7 @@ spec: - name: memgraph-log-storage mountPath: /var/log/memgraph {{- end }} - {{- if .Values.affinity.nodeAffinity }} + {{- if and .Values.affinity.nodeKey .Values.affinity.nodeValue }} affinity: nodeAffinity: preferredDuringSchedulingIgnoredDuringExecution: @@ -112,7 +112,7 @@ spec: - key: {{ .Values.affinity.nodeKey }} operator: In values: - - {{ .Values.affinity.nodeAffinity }} + - {{ .Values.affinity.nodeValue }} {{- end }} volumeClaimTemplates: {{- if .Values.persistentVolumeClaim.createStorageClaim }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 8ae0f23..53b5d6b 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -13,10 +13,10 @@ replicaCount: 1 # By setting theses parameters the PREFERRED deployment will be done first on the match LABELS with key and value then on other nodes. # nodeKey: "nodegroup" give the name of a key # Operator is In -# nodeAffinity: "memgraph" give the value of the key +# nodeValue: "memgraph" give the value of the key affinity: nodeKey: - nodeAffinity: + nodeValue: service: ## ClusterIP, NodePort, LoadBalancer From 80052f658c872a6df6f0ed7a383aabad29f75c6a Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 25 Jun 2024 12:47:31 +0200 Subject: [PATCH 07/10] Fix lint and pre-commit. --- charts/memgraph/templates/statefulset.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index b1083c0..9a45a76 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -29,7 +29,7 @@ spec: spec: terminationGracePeriodSeconds: 1800 securityContext: - {{{- with .Values.imagePullSecrets }} + {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} @@ -70,7 +70,7 @@ spec: tcpSocket: port: bolt failureThreshold: 240 - periodSeconds: 30 + periodSeconds: 30 livenessProbe: tcpSocket: port: bolt @@ -113,7 +113,7 @@ spec: operator: In values: - {{ .Values.affinity.nodeValue }} - {{- end }} + {{- end }} volumeClaimTemplates: {{- if .Values.persistentVolumeClaim.createStorageClaim }} - metadata: From 9105560aa0e6912d5475fecf16c49206bbaa1740 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Tue, 2 Jul 2024 15:37:14 +0200 Subject: [PATCH 08/10] Updates. --- charts/memgraph/templates/service.yaml | 33 +++-- charts/memgraph/templates/statefulset.yaml | 147 +++++++++++---------- charts/memgraph/values.yaml | 55 ++++++-- 3 files changed, 143 insertions(+), 92 deletions(-) diff --git a/charts/memgraph/templates/service.yaml b/charts/memgraph/templates/service.yaml index bd602c3..37ee72b 100644 --- a/charts/memgraph/templates/service.yaml +++ b/charts/memgraph/templates/service.yaml @@ -11,16 +11,23 @@ metadata: spec: type: {{ .Values.service.type }} ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.service.targetPort}} - protocol: {{ .Values.service.protocol }} - name: bolt - - port: 7444 - protocol: {{ .Values.service.protocol }} - name: websocket - - port: 9091 - protocol: {{ .Values.service.protocol }} - name: http - - selector: - {{- include "memgraph.selectorLabels" . | nindent 4 }} \ No newline at end of file + {{- if .Values.service.boltPort }} + - port: {{ .Values.service.boltPort }} + targetPort: {{ .Values.service.boltPort }} + protocol: {{ .Values.service.boltProtocol }} + name: bolt-port + {{- end }} + {{- if .Values.service.enableWebsocketMonitoring }} + - port: {{ .Values.service.websocketPortMonitoring }} + targetPort: {{ .Values.service.websocketPortMonitoring }} + protocol: {{ .Values.service.websocketPortMonitoringProtocol }} + name: websocket-monitoring-port + {{- end }} + {{- if .Values.service.enableHttpMonitoring }} + - port: {{ .Values.service.httpPortMonitoring }} + targetPort: {{ .Values.service.httpPortMonitoring }} + protocol: {{ .Values.service.httpPortMonitoringProtocol }} + name: http-monitoring-port + {{- end }} + selector: + {{- include "memgraph.selectorLabels" . | nindent 4 }} diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index 4d6d6d6..a52cc71 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -27,34 +27,34 @@ spec: {{- toYaml . | nindent 4 }} {{- end }} spec: - initContainers: - - name: init-volume-mounts - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - volumeMounts: - {{- if $.Values.persistentVolumeClaim.storagePVC }} - - name: {{ include "memgraph.fullname" . }}-lib-storage - mountPath: /var/lib/memgraph - {{- end }} - {{- if $.Values.persistentVolumeClaim.logPVC }} - - name: {{ include "memgraph.fullname" . }}-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 + initContainers: + - name: init-volume-mounts + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + volumeMounts: + {{- if $.Values.persistentVolumeClaim.storagePVC }} + - name: {{ include "memgraph.fullname" . }}-lib-storage + mountPath: /var/lib/memgraph + {{- end }} + {{- if $.Values.persistentVolumeClaim.logPVC }} + - name: {{ include "memgraph.fullname" . }}-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 - terminationGracePeriodSeconds: 1800 + terminationGracePeriodSeconds: {{ .Values.container.terminationGracePeriodSeconds }} securityContext: - {{- with .Values.imagePullSecrets }} + {{- if .Values.useImagePullSecrets }} imagePullSecrets: - {{- toYaml . | nindent 8 }} + {{- toYaml .Values.imagePullSecrets | nindent 4 }} {{- end }} volumes: - name: memgraph-lib-storage @@ -83,25 +83,38 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - name: bolt - containerPort: {{ .Values.service.port }} - - name: websocket - containerPort: 7444 - - name: http - containerPort: 9091 - startupProbe: - tcpSocket: - port: bolt - failureThreshold: 240 - periodSeconds: 30 + containerPort: {{ .Values.service.boltPort }} + - name: websocket-monitoring + containerPort: {{ .Values.service.websocketPortMonitoring }} + - name: http-monitoring + containerPort: {{ .Values.service.httpPortMonitoring }} livenessProbe: - tcpSocket: - port: bolt - periodSeconds: 30 - timeoutSeconds: 20 + exec: + command: + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ .Values.service.boltPort }} + initialDelaySeconds: {{ .Values.container.probes.liveliness.initialDelaySeconds }} + periodSeconds: {{ .Values.container.probes.liveliness.periodSeconds }} + failureThreshold: {{ .Values.container.probes.liveliness.failureThreshold }} readinessProbe: - tcpSocket: - port: bolt - periodSeconds: 30 + exec: + command: + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ .Values.service.boltPort }} + initialDelaySeconds: {{ .Values.container.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.container.probes.readiness.periodSeconds }} + failureThreshold: {{ .Values.container.probes.readiness.failureThreshold }} + startupProbe: + exec: + command:kubectl describe statefulset memgraph-test + - sh + - -c + - echo 'RETURN 0;' | mgconsole --host localhost --port {{ .Values.service.boltPort }} + failureThreshold: {{ .Values.container.probes.startup.failureThreshold }} + periodSeconds: {{ .Values.container.probes.startup.periodSeconds }} + failureThreshold: {{ .Values.container.probes.startup.failureThreshold }} {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} @@ -138,31 +151,31 @@ spec: {{- end }} volumeClaimTemplates: {{- if .Values.persistentVolumeClaim.createStorageClaim }} - - metadata: - name: {{ include "memgraph.fullname" . }}-lib-storage - spec: - accessModes: - - "ReadWriteOnce" - {{- if .Values.persistentVolumeClaim.storageClassName }} - storageClassName: {{ .Values.persistentVolumeClaim.storageClassName }} - {{- end }} - resources: - requests: - storage: {{ .Values.persistentVolumeClaim.storageSize }} - {{- if .Values.persistentVolumeClaim.storageVolumeName }} - volumeName: {{ .Values.persistentVolumeClaim.storageVolumeName }} - {{- end }} + - metadata: + name: {{ include "memgraph.fullname" . }}-lib-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if .Values.persistentVolumeClaim.storageClassName }} + storageClassName: {{ .Values.persistentVolumeClaim.storageClassName }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistentVolumeClaim.storageSize }} + {{- if .Values.persistentVolumeClaim.storageVolumeName }} + volumeName: {{ .Values.persistentVolumeClaim.storageVolumeName }} + {{- end }} {{- end }} {{- if .Values.persistentVolumeClaim.createLogStorage }} - - metadata: - name: {{ include "memgraph.fullname" . }}-log-storage - spec: - accessModes: - - "ReadWriteOnce" - {{- if .Values.persistentVolumeClaim.logStorageClassName }} - storageClassName: {{ .Values.persistentVolumeClaim.logStorageClassName }} - {{- end }} - resources: - requests: - storage: {{ .Values.persistentVolumeClaim.logStorageSize }} + - metadata: + name: {{ include "memgraph.fullname" . }}-log-storage + spec: + accessModes: + - "ReadWriteOnce" + {{- if .Values.persistentVolumeClaim.logStorageClassName }} + storageClassName: {{ .Values.persistentVolumeClaim.logStorageClassName }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistentVolumeClaim.logStorageSize }} {{- end }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 53b5d6b..3da49e8 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -4,8 +4,10 @@ image: tag: "" pullPolicy: IfNotPresent -## Image Secrets for custom images -# imagePullSecrets: [{ name: regcred }] +## Override the default imagePullSecrets +useImagePullSecrets: false +imagePullSecrets: +- name: regcred replicaCount: 1 @@ -24,11 +26,23 @@ service: # NodePort would create a external port change port: between 30000-32767 accessible to all the nodes and Public IPs if not in a VPC # LoadBalancer is compabile with Cloud Providers on port: 80 without SSL redirected to the 7687 type: ClusterIP - port: 7687 - targetPort: 7687 - protocol: TCP + + #Bolt Port + enableBolt: true + boltPort: 7687 + boltProtocol: TCP + + #Websocket Monitoring + enableWebsocketMonitoring: false + websocketPortMonitoring: 7444 + websocketPortMonitoringProtocol: TCP + + #HTTP Monitoring + enableHttpMonitoring: false + httpPortMonitoring: 9091 + httpPortMonitoringProtocol: http annotations: {} - + persistentVolumeClaim: ## createStoragePVC `true` will create for each statefulset server a Persistant Volume Claim ## `false` will let you choose an existing Persistant Volume Claim or will create one with an existing volume @@ -36,17 +50,17 @@ persistentVolumeClaim: ## Using a Storage Class Name with policy `retain` will keep the Persistant Volume Claim and the Volume ## If you use a Storage Class Name with policy `delete` the Persistant Volume Claim and Volume will be deleted when the helm release is deleted storageClassName: "" - ## Storage Size must me at minimum 4x the maximum size of your Dataset for Snapshots + ## Storage Size must me at minimum 4x the maximum size of your Dataset for Snapshots ## See documentation for choosing the right size depending on the number of Snapshots you want to keep ## Default is 3 snapshots and you need space to create a new one and WAL files - storageSize: 500Gi - + storageSize: 10Gi + ## if `createStoragePVC` is `false` ## Write the name and exising Persistant Volume Claim existingClaim: memgraph-0 ## If you want to create a Persistant Volume Claim for an existing Volume storageVolumeName: "" - + ## Create a Dynamic Persistant Volume Claim for Logs # `false` will only write logs to stdout / stderr createLogStorage: false @@ -59,8 +73,8 @@ memgraphConfig: ## User and Password for the memgraph ## Default user and password: memgraph # /TODO: create Secrets -memgraphUser: -memgraphPassword: +memgraphUser: +memgraphPassword: ## Memgraph Enterprise Licence # memgraphEnterpriseLicense: "" @@ -94,3 +108,20 @@ serviceAccount: # The name of the service account to use. # If not set and create is true, a name is generated using the fullname template name: "" + + +container: + terminationGracePeriodSeconds: 1800 + probes: + liveliness: + initialDelaySeconds: 10 + periodSeconds: 60 + failureThreshold: 3 + readiness: + initialDelaySeconds: 10 + periodSeconds: 30 + failureThreshold: 3 + startup: + initialDelaySeconds: 10 + periodSeconds: 10 + failureThreshold: 30 From eb42dd2fcd65cc2237509b14ec1a5a03784b9d6a Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 3 Jul 2024 00:23:01 +0200 Subject: [PATCH 09/10] Update. --- charts/memgraph/templates/statefulset.yaml | 50 +++--- charts/memgraph/values.yaml | 12 +- test-memgraph.yaml | 168 --------------------- 3 files changed, 35 insertions(+), 195 deletions(-) delete mode 100644 test-memgraph.yaml diff --git a/charts/memgraph/templates/statefulset.yaml b/charts/memgraph/templates/statefulset.yaml index a52cc71..be6e016 100644 --- a/charts/memgraph/templates/statefulset.yaml +++ b/charts/memgraph/templates/statefulset.yaml @@ -31,16 +31,23 @@ spec: - name: init-volume-mounts image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" volumeMounts: - {{- if $.Values.persistentVolumeClaim.storagePVC }} + {{- if .Values.persistentVolumeClaim.createStorageClaim }} - name: {{ include "memgraph.fullname" . }}-lib-storage mountPath: /var/lib/memgraph {{- end }} - {{- if $.Values.persistentVolumeClaim.logPVC }} + {{- if .Values.persistentVolumeClaim.createLogStorage }} - name: {{ include "memgraph.fullname" . }}-log-storage mountPath: /var/log/memgraph {{- end }} command: ["/bin/sh", "-c"] - args: ["chown -R memgraph:memgraph /var/log; chown -R memgraph:memgraph /var/lib"] + args: + - > + {{- if .Values.persistentVolumeClaim.createStorageClaim }} + chown -R memgraph:memgraph /var/lib/memgraph; + {{- end }} + {{- if .Values.persistentVolumeClaim.createLogStorage }} + chown -R memgraph:memgraph /var/log/memgraph; + {{- end }} securityContext: privileged: true readOnlyRootFilesystem: false @@ -57,15 +64,16 @@ spec: {{- toYaml .Values.imagePullSecrets | nindent 4 }} {{- end }} volumes: - - name: memgraph-lib-storage + - name: {{ include "memgraph.fullname" . }}-lib-storage persistentVolumeClaim: - {{- if .Values.persistentVolumeClaim.existingClaim }} - claimName: {{ .Values.persistentVolumeClaim.existingClaim }} - {{- else}} + {{- if .Values.persistentVolumeClaim.createStorageClaim }} claimName: {{ include "memgraph.fullname" . }}-lib-storage - {{- end }} + {{- else }} + claimName: {{ .Values.persistentVolumeClaim.existingClaim }} + {{- end}} + {{- if .Values.persistentVolumeClaim.createLogStorage }} - - name: memgraph-log-storage + - name: {{ include "memgraph.fullname" . }}-log-storage persistentVolumeClaim: claimName: {{ include "memgraph.fullname" . }}-log-storage {{- end }} @@ -84,9 +92,9 @@ spec: ports: - name: bolt containerPort: {{ .Values.service.boltPort }} - - name: websocket-monitoring + - name: websocket containerPort: {{ .Values.service.websocketPortMonitoring }} - - name: http-monitoring + - name: http containerPort: {{ .Values.service.httpPortMonitoring }} livenessProbe: exec: @@ -108,33 +116,35 @@ spec: failureThreshold: {{ .Values.container.probes.readiness.failureThreshold }} startupProbe: exec: - command:kubectl describe statefulset memgraph-test + command: - sh - -c - echo 'RETURN 0;' | mgconsole --host localhost --port {{ .Values.service.boltPort }} failureThreshold: {{ .Values.container.probes.startup.failureThreshold }} periodSeconds: {{ .Values.container.probes.startup.periodSeconds }} - failureThreshold: {{ .Values.container.probes.startup.failureThreshold }} + initialDelaySeconds: {{ .Values.container.probes.startup.initialDelaySeconds }} {{- with .Values.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} env: + {{ if .Values.memgraphUser }} - name: MEMGRAPH_USER - value: {{ .Values.memgraphUser | default "memgraph"}} + value: {{ .Values.memgraphUser }} - name: MEMGRAPH_PASSWORD - value: {{ .Values.memgraphPassword | default "memgraph" }} - {{ if .Values.memgraphEnterpriseLicense }} + value: {{ .Values.memgraphPassword }} + {{- end }} + {{ if .Values.memgraphEnterpriseLicense }} - name: MEMGRAPH_ENTERPRISE_LICENSE value: {{ .Values.memgraphEnterpriseLicense }} - {{- end}} - name: MEMGRAPH_ORGANIZATION_NAME - value: {{ .Values.memgraphOrganizationName | default "" }} + value: {{ .Values.memgraphOrganizationName}} + {{- end}} volumeMounts: - - name: memgraph-lib-storage + - name: {{ include "memgraph.fullname" . }}-lib-storage mountPath: /var/lib/memgraph {{- if .Values.persistentVolumeClaim.createLogStorage }} - - name: memgraph-log-storage + - name: {{ include "memgraph.fullname" . }}-lib-storage mountPath: /var/log/memgraph {{- end }} {{- if and .Values.affinity.nodeKey .Values.affinity.nodeValue }} diff --git a/charts/memgraph/values.yaml b/charts/memgraph/values.yaml index 3da49e8..0234dfe 100644 --- a/charts/memgraph/values.yaml +++ b/charts/memgraph/values.yaml @@ -55,7 +55,7 @@ persistentVolumeClaim: ## Default is 3 snapshots and you need space to create a new one and WAL files storageSize: 10Gi - ## if `createStoragePVC` is `false` + ## if `createStoragePVC` is `false` you can choose to use an existing Persistant Volume Claim ## Write the name and exising Persistant Volume Claim existingClaim: memgraph-0 ## If you want to create a Persistant Volume Claim for an existing Volume @@ -63,18 +63,16 @@ persistentVolumeClaim: ## Create a Dynamic Persistant Volume Claim for Logs # `false` will only write logs to stdout / stderr - createLogStorage: false + createLogStorage: true logStorageClassName: "" - logStorageSize: 256Mi + logStorageSize: 1Gi memgraphConfig: - "--also-log-to-stderr=true" ## User and Password for the memgraph -## Default user and password: memgraph -# /TODO: create Secrets -memgraphUser: -memgraphPassword: +memgraphUser: "" +memgraphPassword: "" ## Memgraph Enterprise Licence # memgraphEnterpriseLicense: "" diff --git a/test-memgraph.yaml b/test-memgraph.yaml deleted file mode 100644 index 286a4db..0000000 --- a/test-memgraph.yaml +++ /dev/null @@ -1,168 +0,0 @@ ---- -# Source: memgraph/templates/serviceaccount.yaml -apiVersion: v1 -kind: ServiceAccount -metadata: - name: memgraph - labels: - helm.sh/chart: memgraph-0.1.2 - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - app.kubernetes.io/version: "2.17.0" - app.kubernetes.io/managed-by: Helm ---- -# Source: memgraph/templates/service.yaml -apiVersion: v1 -kind: Service -metadata: - name: memgraph - labels: - helm.sh/chart: memgraph-0.1.2 - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - app.kubernetes.io/version: "2.17.0" - app.kubernetes.io/managed-by: Helm -spec: - type: ClusterIP - ports: - - port: 7687 - targetPort: 7687 - protocol: TCP - name: memgraph - - port: 7444 - protocol: TCP - name: websocket - - port: 9091 - protocol: TCP - name: http - - selector: - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph ---- -# Source: memgraph/templates/statefulset.yaml -# templates/statefulset.yaml -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: memgraph - labels: - helm.sh/chart: memgraph-0.1.2 - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - app.kubernetes.io/version: "2.17.0" - app.kubernetes.io/managed-by: Helm -spec: - replicas: 1 - serviceName: memgraph - selector: - matchLabels: - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - podManagementPolicy: OrderedReady - updateStrategy: - type: RollingUpdate - template: - metadata: - labels: - helm.sh/chart: memgraph-0.1.2 - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - app.kubernetes.io/version: "2.17.0" - app.kubernetes.io/managed-by: Helm - spec: - terminationGracePeriodSeconds: 1800 - securityContext: - imagePullSecrets: - - name: regcred - volumes: - - name: memgraph-lib-storage - persistentVolumeClaim: - claimName: memgraph-ams2 - containers: - - name: memgraph - image: "memgraph/memgraph-mage:2.17.0" - args: - - "--also-log-to-stderr=true" - - "--log-file=''" - imagePullPolicy: IfNotPresent - securityContext: - runAsUser: 0 - ports: - - name: memgraph - containerPort: 7687 - - name: websocket - containerPort: 7444 - - name: http - containerPort: 9091 - startupProbe: - tcpSocket: - port: memgraph - failureThreshold: 240 - periodSeconds: 30 - livenessProbe: - tcpSocket: - port: memgraph - periodSeconds: 30 - timeoutSeconds: 20 - readinessProbe: - tcpSocket: - port: memgraph - periodSeconds: 30 - env: - - name: MEMGRAPH_USER - value: memgraph - - name: MEMGRAPH_PASSWORD - value: - - name: MEMGRAPH_ENTERPRISE_LICENSE - value: - - name: MEMGRAPH_ORGANIZATION_NAME - value: - volumeMounts: - - name: memgraph-lib-storage - mountPath: /var/lib/memgraph - affinity: - nodeAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - preference: - matchExpressions: - - key: name - operator: In - values: - - sn15-ams2 - volumeClaimTemplates: - - metadata: - name: memgraph-lib-storage - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: 500Gi ---- -# Source: memgraph/templates/tests/test-connection.yaml -apiVersion: batch/v1 -kind: Job -metadata: - name: "memgraph-memgraph-test" - labels: - helm.sh/chart: memgraph-0.1.2 - app.kubernetes.io/name: memgraph - app.kubernetes.io/instance: memgraph - app.kubernetes.io/version: "2.17.0" - app.kubernetes.io/managed-by: Helm - annotations: - "helm.sh/hook": test -spec: - template: - spec: - containers: - - name: memgraph-test - image: memgraph/memgraph:2.17.0 - command: ["/bin/sh", "-c"] - args: - - | - echo "RETURN 0;" | mgconsole --host memgraph --port 7687 - restartPolicy: Never - backoffLimit: 4 From f70ee6a85dc8e434d76a46b51c20e7849019c0f9 Mon Sep 17 00:00:00 2001 From: Ante Javor Date: Wed, 3 Jul 2024 00:35:43 +0200 Subject: [PATCH 10/10] Update README --- charts/memgraph/README.md | 48 ++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/charts/memgraph/README.md b/charts/memgraph/README.md index 95b5ca1..a34d888 100644 --- a/charts/memgraph/README.md +++ b/charts/memgraph/README.md @@ -27,25 +27,51 @@ The following table lists the configurable parameters of the Memgraph chart and | `image.repository` | Memgraph Docker image repository | `memgraph/memgraph` | | `image.tag` | Specific tag for the Memgraph Docker image. Overrides the image tag whose default is chart version. | `""` (Defaults to chart's app version) | | `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `useImagePullSecrets` | Override the default imagePullSecrets | `false` | +| `imagePullSecrets` | Specify image pull secrets | `- name: regcred` | | `replicaCount` | Number of Memgraph instances to run. Note: no replication or HA support. | `1` | -| `service.type` | Kubernetes service type | `NodePort` | -| `service.port` | Kubernetes service port | `7687` | -| `service.targetPort` | Kubernetes service target port | `7687` | -| `service.protocol` | Protocol used by the service | `TCP` | +| `affinity.nodeKey` | Key for node affinity (Preferred) | `""` | +| `affinity.nodeValue` | Value for node affinity (Preferred) | `""` | +| `service.type` | Kubernetes service type | `ClusterIP` | +| `service.enableBolt` | Enable Bolt protocol | `true` | +| `service.boltPort` | Bolt protocol port | `7687` | +| `service.boltProtocol` | Protocol used by Bolt | `TCP` | +| `service.enableWebsocketMonitoring` | Enable WebSocket monitoring | `false` | +| `service.websocketPortMonitoring` | WebSocket monitoring port | `7444` | +| `service.websocketPortMonitoringProtocol` | Protocol used by WebSocket monitoring | `TCP` | +| `service.enableHttpMonitoring` | Enable HTTP monitoring | `false` | +| `service.httpPortMonitoring` | HTTP monitoring port | `9091` | +| `service.httpPortMonitoringProtocol` | Protocol used by HTTP monitoring | `http` | | `service.annotations` | Annotations to add to the service | `{}` | -| `persistentVolumeClaim.storagePVC` | Enable persistent volume claim for storage | `true` | -| `persistentVolumeClaim.storagePVCClassName` | Storage class name for the persistent volume claim for storage. If not specified, default used. | `""` | -| `persistentVolumeClaim.storagePVCSize` | Size of the persistent volume claim for storage | `1Gi` | -| `persistentVolumeClaim.logPVC` | Enable persistent volume claim for logs | `true` | -| `persistentVolumeClaim.logPVCClassName` | Storage class name for the persistent volume claim for logs. If not specified, default used. | `""` | -| `persistentVolumeClaim.logPVCSize` | Size of the persistent volume claim for logs | `256Mi` | +| `persistentVolumeClaim.createStorageClaim` | Enable creation of a Persistent Volume Claim for storage | `true` | +| `persistentVolumeClaim.storageClassName` | Storage class name for the persistent volume claim | `""` | +| `persistentVolumeClaim.storageSize` | Size of the persistent volume claim for storage | `10Gi` | +| `persistentVolumeClaim.existingClaim` | Use an existing Persistent Volume Claim | `memgraph-0` | +| `persistentVolumeClaim.storageVolumeName` | Name of an existing Volume to create a PVC for | `""` | +| `persistentVolumeClaim.createLogStorage` | Enable creation of a Persistent Volume Claim for logs | `true` | +| `persistentVolumeClaim.logStorageClassName` | Storage class name for the persistent volume claim for logs | `""` | +| `persistentVolumeClaim.logStorageSize` | Size of the persistent volume claim for logs | `1Gi` | | `memgraphConfig` | List of strings defining Memgraph configuration settings | `["--also-log-to-stderr=true"]` | +| `memgraphUser` | User for the Memgraph database | `""` | +| `memgraphPassword` | Password for the Memgraph database | `""` | +| `memgraphEnterpriseLicense` | Memgraph Enterprise License | `""` | +| `memgraphOrganizationName` | Organization name for Memgraph Enterprise License | `""` | | `statefulSetAnnotations` | Annotations to add to the stateful set | `{}` | | `podAnnotations` | Annotations to add to the pod | `{}` | -| `resources` | CPU/Memory resource requests/limits. Left empty by default. | `{}` (See note on uncommenting) | +| `resources` | CPU/Memory resource requests/limits. Left empty by default. | `{}` | | `serviceAccount.create` | Specifies whether a service account should be created | `true` | | `serviceAccount.annotations` | Annotations to add to the service account | `{}` | | `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated. | `""` | +| `container.terminationGracePeriodSeconds` | Grace period for pod termination | `1800` | +| `probes.liveliness.initialDelaySeconds` | Initial delay for liveliness probe | `10` | +| `probes.liveliness.periodSeconds` | Period seconds for liveliness probe | `60` | +| `probes.liveliness.failureThreshold` | Failure threshold for liveliness probe | `3` | +| `probes.readiness.initialDelaySeconds` | Initial delay for readiness probe | `10` | +| `probes.readiness.periodSeconds` | Period seconds for readiness probe | `30` | +| `probes.readiness.failureThreshold` | Failure threshold for readiness probe | `3` | +| `probes.startup.initialDelaySeconds` | Initial delay for startup probe | `10` | +| `probes.startup.periodSeconds` | Period seconds for startup probe | `10` | +| `probes.startup.failureThreshold` | Failure threshold for startup probe | `30` | **Note:** It's often recommended not to specify default resources and leave it as a conscious choice for the user. If you want to specify resources, uncomment the following lines in your `values.yaml`, adjust them as necessary: