Skip to content

Commit

Permalink
Fix static number of volumes - fixes #11 (#12)
Browse files Browse the repository at this point in the history
* fix(storage): use volumeClaimTemplates instead of static PVCs - fixes #11

* feat(storage): enable specifying non-default storage class

* delete the extra volume claims.

* update README.md and bump up the version.

---------

Co-authored-by: Ante Javor <[email protected]>
  • Loading branch information
hpdobrica and antejavor authored Apr 25, 2024
1 parent d1106f0 commit 09dbecc
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 61 deletions.
18 changes: 9 additions & 9 deletions charts/memgraph/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ apiVersion: v2
name: memgraph
home: https://memgraph.com/
type: application
version: 0.1.1
appVersion: "2.10.0"
version: 0.1.2
appVersion: "2.16.0"
description: MemgraphDB Helm Chart
keywords:
- graph
- database
- cypher
- analytics
- graph
- database
- cypher
- analytics
icon: https://public-assets.memgraph.com/memgraph-logo/logo-large.png
sources:
- https://github.com/memgraph/memgraph
- https://github.com/memgraph/memgraph
maintainers:
- name: Memgraph
email: [email protected]
- name: Memgraph
email: [email protected]
54 changes: 41 additions & 13 deletions charts/memgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,51 @@ Or you can modify a `values.yaml` file and override the desired values:
helm install <resource-name> memgraph/memgraph -f values.yaml
```

## Configuration options
## Configuration Options

The following table lists the configurable parameters of the Memgraph chart and their default values.

parameter | description | default
--- | --- | ---
`image` | Memgraph Docker image repository | `memgraph`
`persistentVolumeClaim.storagePVC` | Enable persistent volume claim for storage | `true`
`persistanceVolumeClaim.storagePVCSize` | Size of the persistent volume claim for storage | `1Gi`
`persistentVolumeClaim.logPVC` | Enable persistent volume claim for logs | `true`
`persistanceVolumeClaim.logPVCSize` | Size of the persistent volume claim for logs | `256Mi`
`service.type` | Kubernetes service type | `NodePort`
`service.port` | Kubernetes service port | `7687`
`service.targetPort` | Kubernetes service target port | `7687`
`memgraphConfig` | Memgraph configuration settings | `["--also-log-to-stderr=true"]`
| Parameter | Description | Default |
|---------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------------------------------------|
| `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` |
| `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` |
| `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` |
| `memgraphConfig` | List of strings defining Memgraph configuration settings | `["--also-log-to-stderr=true"]` |
| `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) |
| `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. | `""` |

**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:

```yaml
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "100m"
memory: "128Mi"

The `memgraphConfig` parameter should be a list of strings defining the values of Memgraph configuration settings. For example, this is how you can define `memgraphConfig` parameter in your `values.yaml`:
```

The `memgraphConfig` parameter should be a list of strings defining the values of Memgraph configuration settings. For example, this is how you can define `memgraphConfig` parameter in your `values.yaml`:

```yaml
memgraphConfig:
- "--also-log-to-stderr=true"
- "--log-level=TRACE"
Expand Down
26 changes: 0 additions & 26 deletions charts/memgraph/templates/persistentvolumeclaim.yaml

This file was deleted.

42 changes: 29 additions & 13 deletions charts/memgraph/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ spec:
{{- end }}
spec:
securityContext:
volumes:
{{- if .Values.persistentVolumeClaim.storagePVC }}
- name: memgraph-lib-storage
persistentVolumeClaim:
claimName: {{ include "memgraph.fullname" . }}-lib-storage
{{- end }}
{{- if .Values.persistentVolumeClaim.logPVC }}
- 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 }}"
Expand All @@ -58,10 +47,37 @@ spec:
{{- end }}
volumeMounts:
{{- if .Values.persistentVolumeClaim.storagePVC }}
- name: memgraph-lib-storage
- name: {{ include "memgraph.fullname" . }}-lib-storage
mountPath: /var/lib/memgraph
{{- end }}
{{- if .Values.persistentVolumeClaim.logPVC }}
- name: memgraph-log-storage
- name: {{ include "memgraph.fullname" . }}-log-storage
mountPath: /var/log/memgraph
{{- end }}
volumeClaimTemplates:
{{- if .Values.persistentVolumeClaim.storagePVC }}
- metadata:
name: {{ include "memgraph.fullname" . }}-lib-storage
spec:
accessModes:
- "ReadWriteOnce"
{{- if .Values.persistentVolumeClaim.storagePVCClassName }}
storageClassName: {{ .Values.persistentVolumeClaim.storagePVCClassName }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistentVolumeClaim.storagePVCSize }}
{{- end }}
{{- if .Values.persistentVolumeClaim.logPVC }}
- metadata:
name: {{ include "memgraph.fullname" . }}-log-storage
spec:
accessModes:
- "ReadWriteOnce"
{{- if .Values.persistentVolumeClaim.logPVCClassName }}
storageClassName: {{ .Values.persistentVolumeClaim.logPVCClassName }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistentVolumeClaim.logPVCSize }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/memgraph/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ image:
tag: ""
pullPolicy: IfNotPresent

# Can be increased to more but there is no replication or HA support in this chart.
replicaCount: 1

service:
Expand All @@ -14,8 +15,10 @@ service:
annotations: {}

persistentVolumeClaim:
storagePVCClassName: ""
storagePVC: true
storagePVCSize: 1Gi
logPVCClassName: ""
logPVC: true
logPVCSize: 256Mi

Expand Down

0 comments on commit 09dbecc

Please sign in to comment.