Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ dist
.b2-account-info*
tests-scratch
.mypy_cache
charts/benji/charts/
19 changes: 19 additions & 0 deletions charts/benji/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,22 @@ Create hostname:port pair pointing to the Prometheus pushgateway
{{- define "benji.pushgateway" -}}
{{- printf "%s-%s" .Release.Name .Values.pushgateway.nameOverride | trunc 63 | trimSuffix "-" -}}:{{ .Values.pushgateway.service.port }}
{{- end -}}

{{/*
ceph conf
*/}}
{{- define "benji.ceph-conf" -}}
[global]
mon_host = {{ .Values.ceph.mon_hosts }}

[client.{{ .Values.ceph.user | default "admin" }}]
keyring = /etc/ceph/keyring
{{ end -}}

{{/*
ceph client keyring
*/}}
{{- define "benji.ceph-keyring" -}}
[client.{{ .Values.ceph.user | default "admin" }}]
key = {{ .Values.ceph.key }}
{{ end -}}
16 changes: 16 additions & 0 deletions charts/benji/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.ceph.enabled }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.ceph.configMapName }}
labels:
app.kubernetes.io/name: {{ include "benji.name" . }}
helm.sh/chart: {{ include "benji.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: benji
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
ceph.conf: |
{{ include "benji.ceph-conf" . | indent 4 }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/benji/templates/cron-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ spec:
serviceAccountName: {{ tuple $ "" | include "benji.fullname" }}
dnsPolicy: ClusterFirstWithHostNet
restartPolicy: Never
{{- if $.Values.benji.initContainers }}
initContainers:
{{ toYaml $.Values.benji.initContainers | indent 12 }}
{{- end }}
containers:
- name: benji
image: "{{ $.Values.benji.image.registry }}/{{ $.Values.benji.image.repository }}:{{ $.Values.benji.image.tag }}"
Expand All @@ -62,6 +66,10 @@ spec:
{{- if $.Values.pushgateway.enabled }}
- name: PROM_PUSH_GATEWAY
value: "{{ include "benji.pushgateway" $ }}"
{{- end }}
{{- with $.Values.ceph.user }}
- name: CEPH_ARGS
value: "--name client.{{ . }}"
{{- end }}
- name: TZ
value: "{{ $.Values.timeZone }}"
Expand All @@ -79,9 +87,15 @@ spec:
{{- end }}
hostNetwork: false
volumes:
{{- if $.Values.benji.externalSecretConfig }}
- name: benji-config
secret:
secretName: {{ $.Values.benji.externalSecretConfig }}
{{- else }}
- name: benji-config
secret:
secretName: {{ tuple $ "" | include "benji.fullname" }}
{{- end }}
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/{{ $.Values.timeZone }}
Expand Down
18 changes: 18 additions & 0 deletions charts/benji/templates/maint-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,18 @@ spec:
spec:
serviceAccountName: {{ tuple . "" | include "benji.fullname" }}
dnsPolicy: ClusterFirstWithHostNet
{{- if .Values.benji.initContainers }}
initContainers:
{{ toYaml .Values.benji.initContainers | indent 8 }}
{{- end }}
containers:
- name: benji
image: "{{ .Values.benji.image.registry }}/{{ .Values.benji.image.repository }}:{{ .Values.benji.image.tag }}"
imagePullPolicy: {{ .Values.benji.image.pullPolicy }}
{{- with .Values.benji.command }}
command:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
privileged: true
env:
Expand All @@ -45,6 +53,10 @@ spec:
{{- if .Values.pushgateway.enabled }}
- name: PROM_PUSH_GATEWAY
value: "{{ include "benji.pushgateway" $ }}"
{{- end }}
{{- with .Values.ceph.user }}
- name: CEPH_ARGS
value: "--name client.{{ . }}"
{{- end }}
- name: TZ
value: "{{ .Values.timeZone }}"
Expand All @@ -62,9 +74,15 @@ spec:
{{- end }}
hostNetwork: false
volumes:
{{- if $.Values.benji.externalSecretConfig }}
- name: benji-config
secret:
secretName: {{ $.Values.benji.externalSecretConfig }}
{{- else }}
- name: benji-config
secret:
secretName: {{ tuple . "" | include "benji.fullname" }}
{{- end }}
- name: tz-config
hostPath:
path: /usr/share/zoneinfo/{{ .Values.timeZone }}
Expand Down
20 changes: 20 additions & 0 deletions charts/benji/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if not .Values.benji.externalSecretConfig }}
---
apiVersion: v1
kind: Secret
Expand All @@ -10,3 +11,22 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
data:
benji.yaml: {{ printf "%s\n" (.Values.benji.configuration | toYaml) | b64enc }}
{{ end }}

{{- if .Values.ceph.createKeyringSecret }}
---
apiVersion: v1
kind: Secret
metadata:
name: benji-ceph-keyring
labels:
app.kubernetes.io/name: {{ include "benji.name" . }}
helm.sh/chart: {{ include "benji.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: benji
app.kubernetes.io/managed-by: {{ .Release.Service }}
type: Opaque
data:
keyring: |
{{ include "benji.ceph-keyring" . | b64enc | indent 4 }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/benji/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ benji:

affinity: {}

initContainers: []

command: []

## insert a secret name here that contains your configuration, otherwise the below configuration is used
externalSecretConfig: ""

configuration:
configurationVersion: '1'
databaseEngine: sqlite:////tmp/benji.sqlite
Expand Down Expand Up @@ -177,3 +184,5 @@ pushgateway:
nameOverride: pushgateway
service:
port: 9091

ceph: {}