Skip to content

Commit

Permalink
Merge pull request #28 from ibakshay/main
Browse files Browse the repository at this point in the history
Fix: Add SecurityContext to StatefulSet when Persistence is Enabled
  • Loading branch information
nicolastakashi authored Oct 23, 2024
2 parents 0f8b747 + 890b126 commit 8765ba5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
2 changes: 2 additions & 0 deletions charts/perses/templates/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
Expand Down
4 changes: 3 additions & 1 deletion charts/perses/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ spec:
{{- end }}
spec:
serviceAccountName: {{ include "perses.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.persistence.securityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.name }}:{{ .Values.image.version | default .Chart.AppVersion }}"
Expand Down Expand Up @@ -98,4 +100,4 @@ spec:
- name: datasources
configMap:
name: {{ include "perses.fullname" . }}-datasources
{{- end }}
{{- end }}
12 changes: 10 additions & 2 deletions charts/perses/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@
"size": {
"type": "string"
},
"securityContext":{
"type": "object",
"additionalProperties": false,
"properties": {
"fsGroup": {
"type": "integer"
}
}
},
"labels": {
"type": "object"
},
Expand All @@ -421,8 +430,7 @@
"required": [
"accessModes",
"enabled",
"size",
"storageClass"
"size"
]
},
"livenessProbe": {
Expand Down
10 changes: 7 additions & 3 deletions charts/perses/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ persistence:
# -- If disabled, it will use a emptydir volume
enabled: false

# -- Specify the `storageClass` used to provision the volume
storageClass: ""
# -- Specify the `storageClass` to provision the volume for the PVC. If you don't specify a `storageClass`, a default `storageClass` will be used.
# storageClass: ""

# -- PVC Access Modes for data volume
accessModes:
Expand All @@ -159,6 +159,10 @@ persistence:
# -- PVC Storage Request for data volume
size: 8Gi

# -- Security context for the PVC when persistence is enabled
securityContext:
fsGroup: 2000

# -- Labels for the PVC
labels: {}
# -- Annotations for the PVC
Expand Down Expand Up @@ -202,4 +206,4 @@ datasources:
# plugin:
# kind: PrometheusDatasource
# spec:
# directUrl: https://prometheus.demo.do.prometheus.io
# directUrl: https://prometheus.demo.do.prometheus.io

0 comments on commit 8765ba5

Please sign in to comment.