diff --git a/charts/stable/fireflyiii/Chart.yaml b/charts/stable/fireflyiii/Chart.yaml index 00842d92a02..c33dd359ad6 100644 --- a/charts/stable/fireflyiii/Chart.yaml +++ b/charts/stable/fireflyiii/Chart.yaml @@ -24,7 +24,7 @@ name: fireflyiii sources: - https://github.com/firefly-iii/firefly-iii/ type: application -version: 13.0.10 +version: 13.1.0 annotations: truecharts.org/catagories: | - finacial diff --git a/charts/stable/fireflyiii/questions.yaml b/charts/stable/fireflyiii/questions.yaml index 0810de037e7..e0d978af389 100644 --- a/charts/stable/fireflyiii/questions.yaml +++ b/charts/stable/fireflyiii/questions.yaml @@ -73,7 +73,6 @@ questions: - value: "OnDelete" description: "(Legacy) OnDelete: ignore .spec.template changes" # Include{controllerExpert} - # Docker specific env - variable: env group: "Container Configuration" label: "Image Environment" @@ -81,16 +80,7 @@ questions: type: dict attrs: # Include{fixedEnv} - - variable: APP_KEY - label: "App Key" - description: "Your unique 32 application character key" - schema: - type: string - default: "" - min_length: 32 - max_length: 32 - valid_chars: '[a-zA-Z0-9!@#$%^&*?]{32}' - required: true + # Include{containerConfig} diff --git a/charts/stable/fireflyiii/templates/_cronjob.tpl b/charts/stable/fireflyiii/templates/_cronjob.tpl new file mode 100644 index 00000000000..e32ee9bb70c --- /dev/null +++ b/charts/stable/fireflyiii/templates/_cronjob.tpl @@ -0,0 +1,38 @@ +{{/* Define the cronjob */}} +{{- define "fireflyiii.cronjob" -}} +{{- $jobName := include "common.names.fullname" . }} + +--- +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ printf "%s-cronjob" $jobName }} + labels: + {{- include "common.labels" . | nindent 4 }} +spec: + schedule: "{{ .Values.cronjob.schedule }}" + concurrencyPolicy: Forbid + {{- with .Values.cronjob.failedJobsHistoryLimit }} + failedJobsHistoryLimit: {{ . }} + {{- end }} + {{- with .Values.cronjob.successfulJobsHistoryLimit }} + successfulJobsHistoryLimit: {{ . }} + {{- end }} + jobTemplate: + metadata: + spec: + template: + metadata: + spec: + restartPolicy: Never + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }}" + imagePullPolicy: {{ default .Values.image.pullPolicy }} + args: + - curl + - "http://{{ $jobName }}.ix-{{ .Release.Name }}.svc.cluster.local:{{ .Values.service.main.ports.main.port }}/api/v1/cron/{{ .Values.env.STATIC_CRON_TOKEN }}" + resources: +{{ toYaml .Values.resources | indent 16 }} + +{{- end -}} diff --git a/charts/stable/fireflyiii/templates/_secrets.tpl b/charts/stable/fireflyiii/templates/_secrets.tpl new file mode 100644 index 00000000000..d434a0bf04a --- /dev/null +++ b/charts/stable/fireflyiii/templates/_secrets.tpl @@ -0,0 +1,24 @@ +{{/* Define the secrets */}} +{{- define "fireflyiii.secrets" -}} +--- + +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: fireflyiii-secrets +{{- $fireflyiiiprevious := lookup "v1" "Secret" .Release.Namespace "fireflyiii-secrets" }} +{{- $static_cron_token := "" }} +{{- $app_key := "" }} +data: +{{- if $fireflyiiiprevious}} + STATIC_CRON_TOKEN: {{ index $fireflyiiiprevious.data "STATIC_CRON_TOKEN" }} + APP_KEY: {{ index $fireflyiiiprevious.data "APP_KEY" }} + {{- else }} + {{- $static_cron_token := randAlphaNum 32 }} + {{- $app_key := randAlphaNum 32 }} + STATIC_CRON_TOKEN: {{ $static_cron_token | b64enc | quote }} + APP_KEY: {{ $static_cron_token | b64enc | quote }} + {{- end }} + +{{- end -}} diff --git a/charts/stable/fireflyiii/templates/common.yaml b/charts/stable/fireflyiii/templates/common.yaml index da58e96d9e0..a646e86ff5c 100644 --- a/charts/stable/fireflyiii/templates/common.yaml +++ b/charts/stable/fireflyiii/templates/common.yaml @@ -1,5 +1,11 @@ {{/* Make sure all variables are set properly */}} {{- include "common.setup" . }} +{{/* Render secrets for fireflyiii */}} +{{- include "fireflyiii.secrets" . }} + +{{/* Render cronjob for fireflyiii */}} +{{- include "fireflyiii.cronjob" . }} + {{/* Render the templates */}} {{ include "common.postSetup" . }} diff --git a/charts/stable/fireflyiii/values.yaml b/charts/stable/fireflyiii/values.yaml index 7b5a662f836..1d5d107244b 100644 --- a/charts/stable/fireflyiii/values.yaml +++ b/charts/stable/fireflyiii/values.yaml @@ -33,7 +33,6 @@ env: DB_DATABASE: firefly DB_CONNECTION: pgsql DB_PORT: 5432 - APP_KEY: AGcfkCUS233ZWmBXztYbdyCs2u7kkz55 envValueFrom: DB_HOST: @@ -44,12 +43,25 @@ envValueFrom: secretKeyRef: name: dbcreds key: postgresql-password + STATIC_CRON_TOKEN: + secretKeyRef: + name: fireflyiii-secrets + key: STATIC_CRON_TOKEN + APP_KEY: + secretKeyRef: + name: fireflyiii-secrets + key: APP_KEY persistence: data: enabled: true mountPath: "/var/www/html/storage/upload" +cronjob: + schedule: "0 3 * * *" + annotations: {} + failedJobsHistoryLimit: 5 + successfulJobsHistoryLimit: 2 # Enabled postgres postgresql: