Skip to content

Commit

Permalink
[WIP]: seg 26 fev 2024 22:55:38 WET
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Santos <[email protected]>
  • Loading branch information
Gabrielopesantos committed Feb 26, 2024
1 parent 88edc9b commit bc655ee
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 14 deletions.
43 changes: 43 additions & 0 deletions charts/perses/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,46 @@ Create the name of the service account to use
{{- define "perses.dns" -}}
http://{{ include "perses.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.targetPort }}
{{- end -}}

{{/*
TODO
*/}}
{{- define "perses.createEncryptionKeyFileSecret" -}}
{{- if and .Values.config.security.encryptionKey .Values.config.security.encryptionKeyFile }}
{{- printf "true" }}
{{- else }}
{{- printf "false" }}
{{- end }}
{{- end }}

{{/*
TODO
*/}}
{{- define "perses.mountEncryptionKeyFileSecret" -}}
{{- if or (include "perses.createEncryptionKeyFileSecret" .) .Values.existingEncryptionKeySecret }}
{{- printf "true" }}
{{- else }}
{{- printf "false" }}
{{- end }}
{{- end }}

{{/*
TODO
*/}}
{{- define "perses.encryptionKeyVolume" -}}
- name: encryptionkey
secret:
secretName: {{ include "perses.fullname" . }}-encryption-key
items:
- key: key
path: "key"
{{- end }}

{{/*
TODO
*/}}
{{- define "perses.encryptionKeyVolumeMount" -}}
- name: encryptionkey
mountPath: {{ .Values.config.security.encryptionKeyFile }}
readOnly: true
{{- end }}
2 changes: 1 addition & 1 deletion charts/perses/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.config.security.encryptionKeyFile .Values.config.security.encryptionKey }}
{{- if eq (include "perses.createEncryptionKeyFileSecret" .) "true" }}
apiVersion: v1
kind: Secret
metadata:
Expand Down
15 changes: 4 additions & 11 deletions charts/perses/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ spec:
- name: datasources
mountPath: /etc/perses/datasources
{{- end }}
{{- if and .Values.config.security.encryptionKeyFile .Values.config.security.encryptionKey }}
- name: encryptionkey
mountPath: {{ .Values.config.security.encryptionKeyFile }}
readOnly: true
{{- if eq (include "perses.mountEncryptionKeyFileSecret" .) "true" }}
{{- include "perses.encryptionKeyVolumeMount" . | nindent 10 }}
{{- end }}
ports:
- name: http
Expand Down Expand Up @@ -103,11 +101,6 @@ spec:
configMap:
name: {{ include "perses.fullname" . }}-datasources
{{- end }}
{{- if and .Values.config.security.encryptionKeyFile .Values.config.security.encryptionKey }}
- name: encryptionkey
secret:
secretName: {{ include "perses.fullname" . }}-encryption-key
items:
- key: key
path: "key"
{{- if eq (include "perses.mountEncryptionKeyFileSecret" .) "true" }}
{{- include "perses.encryptionKeyVolume" . | nindent 8 }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/perses/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,20 @@
"volumeMounts": {
"type": "array"
},
"existingEncryptionKeySecret": {
"type": "object",
"additionalProperties": false,
"properties": {
"secretName": {
"type": "string",
"default": ""
},
"secretKey": {
"type": "string",
"default": "key"
}
}
},
"readinessProbe": {
"type": "object",
"additionalProperties": false,
Expand Down
10 changes: 8 additions & 2 deletions charts/perses/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ volumes: []
# -- Additional VolumeMounts on the output StatefulSet definition.
volumeMounts: []


# -- Mount encryption key with an existing secret
existingEncryptionKeySecret:
secretName: ""
secretKey: ""

# -- Resource limits & requests.
# Update according to your own use case as these values might be too low for a typical deployment.
# ref: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Expand All @@ -97,9 +103,9 @@ config:
# -- Configure Perses instance as readonly
readOnly: false
# -- Encryption key
encryptionKey: ""
encryptionKey: "111234123423411234123423412341234234"
# -- Encryption key file path
encryptionKeyFile: ""
encryptionKeyFile: "/tmp/perses"
# -- Enable Authentication
enableAuth: false

Expand Down

0 comments on commit bc655ee

Please sign in to comment.