Skip to content

Commit

Permalink
fix(resources): Allow Setting Pod resources
Browse files Browse the repository at this point in the history
fix(serciceaccount): Allow Creating Custom Service Account
fix(labels): Use Label templates
fix(app_version): Use and default to app version instead of latest
  • Loading branch information
jseiser committed Aug 16, 2023
1 parent 31cd83b commit 7ea7ee2
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 34 deletions.
22 changes: 11 additions & 11 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.0
appVersion: "1.16.0"
description: MemgraphDB Helm Chart
keywords:
- graph
- database
- cypher
- analytics
version: 0.1.1
appVersion: "2.10.0"
description: MemgraphDB Helm Chart
keywords:
- graph
- database
- cypher
- analytics
icon: https://public-assets.memgraph.com/memgraph-logo/logo-large.png
sources:
sources:
- https://github.com/memgraph/memgraph
maintainers:
- name: Memgraph
email: [email protected]
- name: Memgraph
email: [email protected]
3 changes: 1 addition & 2 deletions charts/memgraph/templates/persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

{{ if .Values.persistentVolumeClaim.storagePVC }}
apiVersion: v1

kind: PersistentVolumeClaim
metadata:
name: {{ include "memgraph.fullname" . }}-lib-storage
Expand All @@ -24,4 +23,4 @@ spec:
resources:
requests:
storage: {{ .Values.persistentVolumeClaim.logPVCSize }}
{{end}}
{{ end }}
11 changes: 7 additions & 4 deletions charts/memgraph/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ kind: Service
metadata:
name: {{ include "memgraph.fullname" . }}
labels:
app.kubernetes.io/name: memgraph
app.kubernetes.io/managed-by: Helm
{{- include "memgraph.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort}}
protocol: {{ .Values.service.protocol }}
name: bolt
selector:
app.kubernetes.io/name: memgraph
selector:
{{- include "memgraph.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/memgraph/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
39 changes: 25 additions & 14 deletions charts/memgraph/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,64 @@ kind: StatefulSet
metadata:
name: {{ include "memgraph.fullname" . }}
labels:
app.kubernetes.io/name: memgraph
app.kubernetes.io/managed-by: Helm
{{- include "memgraph.labels" . | nindent 4 }}
{{- with .Values.statefulSetAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
serviceName: {{ include "memgraph.fullname" . }}
selector:
matchLabels:
app.kubernetes.io/name: memgraph
{{- include "memgraph.selectorLabels" . | nindent 6 }}
podManagementPolicy: OrderedReady
updateStrategy:
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: memgraph
{{- include "memgraph.labels" . | nindent 8 }}
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
securityContext:
volumes:
{{ if .Values.persistentVolumeClaim.storagePVC }}
{{- if .Values.persistentVolumeClaim.storagePVC }}
- name: memgraph-lib-storage
persistentVolumeClaim:
claimName: {{ include "memgraph.fullname" . }}-lib-storage
{{end}}
{{ if .Values.persistentVolumeClaim.logPVC }}
{{- end }}
{{- if .Values.persistentVolumeClaim.logPVC }}
- name: memgraph-log-storage
persistentVolumeClaim:
claimName: {{ include "memgraph.fullname" . }}-log-storage
{{end}}
{{- end }}
containers:
- name: memgraph
image: {{ .Values.image }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
args:
{{- range .Values.memgraphConfig }}
- {{ . | quote }}
{{- end }}
imagePullPolicy: Always
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
runAsUser: 0
ports:
- name: memgraph
containerPort: {{ .Values.service.port }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{ if .Values.persistentVolumeClaim.storagePVC }}
{{- if .Values.persistentVolumeClaim.storagePVC }}
- name: memgraph-lib-storage
mountPath: /var/lib/memgraph
{{end}}
{{ if .Values.persistentVolumeClaim.logPVC }}
{{- end }}
{{- if .Values.persistentVolumeClaim.logPVC }}
- name: memgraph-log-storage
mountPath: /var/log/memgraph
{{end}}
{{- end }}
38 changes: 35 additions & 3 deletions charts/memgraph/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
image: memgraph/memgraph:latest
image:
repository: memgraph/memgraph
# Overrides the image tag whose default is v{{ .Chart.AppVersion }}
tag: ""
pullPolicy: IfNotPresent

replicaCount: 1

Expand All @@ -7,12 +11,40 @@ service:
port: 7687
targetPort: 7687
protocol: TCP
annotations: {}

persistentVolumeClaim:
storagePVC: true
storagePVCSize: 1Gi
logPVC: true
logPVCSize: 256Mi
logPVCSize: 256Mi

memgraphConfig:
memgraphConfig:
- "--also-log-to-stderr=true"

# Annotations to add to the statefulSet
statefulSetAnnotations: {}
# Annotations to add to the Pod
podAnnotations: {}

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

serviceAccount:
# Specifies whether a service account should be created
create: 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: ""

0 comments on commit 7ea7ee2

Please sign in to comment.