Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update security context for HA chart #106

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions charts/memgraph-high-availability/templates/coordinators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,23 +82,21 @@ spec:
- name: memgraph-coordinator-{{ $coordinator.id }}-log-storage
mountPath: /var/log/memgraph
command: [ "/bin/sh","-c" ]
args: [ "chown -R memgraph:memgraph /var/log; chown -R memgraph:memgraph /var/lib" ]
args: [ "chown -R memgraph:memgraph /var/log/memgraph; chown -R memgraph:memgraph /var/lib/memgraph" ]
securityContext:
privileged: true
readOnlyRootFilesystem: false
readOnlyRootFilesystem: true
runAsUser: 0 # Run as root
capabilities:
drop: [ "all" ]
drop: [ "ALL" ]
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}
{{- end }}

containers:
- name: memgraph-coordinator
Expand Down Expand Up @@ -134,15 +132,19 @@ spec:
mountPath: /var/lib/memgraph
- name: memgraph-coordinator-{{ $coordinator.id }}-log-storage
mountPath: /var/log/memgraph
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ "ALL" ]
# Run by 'memgraph' user as specified in the Dockerfile

volumeClaimTemplates:
- metadata:
name: memgraph-coordinator-{{ $coordinator.id }}-lib-storage
spec:
accessModes:
- {{ $.Values.storage.libStorageAccessMode}}
{{- if $.Values.storage.libStorageClassName }}
storageClassName: {{ $.Values.storage.libStorageClassName }}
{{- end }}
resources:
requests:
storage: {{ $.Values.storage.libPVCSize }}
Expand All @@ -152,9 +154,7 @@ spec:
spec:
accessModes:
- {{ $.Values.storage.logStorageAccessMode}}
{{- if $.Values.storage.logStorageClassName }}
storageClassName: {{ $.Values.storage.logStorageClassName }}
{{- end }}
resources:
requests:
storage: {{ $.Values.storage.logPVCSize }}
Expand Down
24 changes: 12 additions & 12 deletions charts/memgraph-high-availability/templates/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,21 @@ spec:
- name: memgraph-data-{{ $data.id }}-log-storage
mountPath: /var/log/memgraph
command: [ "/bin/sh","-c" ]
args: [ "chown -R memgraph:memgraph /var/log; chown -R memgraph:memgraph /var/lib" ]
args: [ "chown -R memgraph:memgraph /var/log/memgraph; chown -R memgraph:memgraph /var/lib/memgraph" ]
securityContext:
privileged: true
readOnlyRootFilesystem: false
readOnlyRootFilesystem: true
runAsUser: 0 # Run as root
capabilities:
drop: [ "all" ]
drop: [ "ALL" ]
add: [ "CHOWN" ]
runAsUser: 0
runAsNonRoot: false
{{- if $.Values.sysctlInitContainer.enabled }}
{{- if $.Values.sysctlInitContainer.enabled }}
- name: init-sysctl
image: busybox
command: ['sh', '-c', 'sysctl -w vm.max_map_count={{ $.Values.sysctlInitContainer.maxMapCount }}']
securityContext:
privileged: true
runAsUser: 0
{{- end }}
{{- end }}

containers:
- name: memgraph-data
Expand Down Expand Up @@ -144,15 +142,19 @@ spec:
mountPath: /var/lib/memgraph
- name: memgraph-data-{{ $data.id }}-log-storage
mountPath: /var/log/memgraph
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: [ "ALL" ]
# Run by 'memgraph' user as specified in the Dockerfile

volumeClaimTemplates:
- metadata:
name: memgraph-data-{{ $data.id }}-lib-storage
spec:
accessModes:
- {{ $.Values.storage.libStorageAccessMode}}
{{- if $.Values.storage.libStorageClassName }}
storageClassName: {{ $.Values.storage.libStorageClassName }}
{{- end }}
resources:
requests:
storage: {{ $.Values.storage.libPVCSize }}
Expand All @@ -161,9 +163,7 @@ spec:
spec:
accessModes:
- {{ $.Values.storage.logStorageAccessMode}}
{{- if $.Values.storage.logStorageClassName }}
storageClassName: {{ $.Values.storage.logStorageClassName }}
{{- end }}
resources:
requests:
storage: {{ $.Values.storage.logPVCSize }}
Expand Down
Loading