fix(firefly-iii): fix remembered secrets (#14723)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ Type of change**

- [ ] ⚙️ Feature/App addition
- [x] 🪛 Bugfix
- [ ] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🪞 I have opened a PR on
[truecharts/containers](https://github.com/truecharts/containers) adding
the container to TrueCharts mirror repo.
- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Stavros Kois 2023-11-16 20:23:35 +02:00 committed by GitHub
parent e7130ae20c
commit a5d786005a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 19 deletions

View File

@ -25,7 +25,7 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/stable/fireflyiii
- https://github.com/firefly-iii/firefly-iii/
type: application
version: 21.0.16
version: 21.0.17
annotations:
truecharts.org/category: finacial
truecharts.org/SCALE-support: "true"

View File

@ -1,6 +1,6 @@
{{/* Define the cronjob */}}
{{- define "fireflyiii.cronjob" -}}
{{- $basename := include "tc.v1.common.lib.chart.names.fullname" $ -}}
{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) }}
enabled: true
type: "CronJob"
schedule: "0 8 * * *"
@ -20,11 +20,11 @@ podSpec:
imageSelector: alpineImage
args:
- curl
- "http://{{ $basename }}.ix-{{ .Release.Name }}.svc.cluster.local:{{ .Values.service.main.ports.main.port }}/api/v1/cron/$(STATIC_CRON_TOKEN)"
- "http://{{ $fullname }}:{{ .Values.service.main.ports.main.port }}/api/v1/cron/$(STATIC_CRON_TOKEN)"
env:
STATIC_CRON_TOKEN:
secretKeyRef:
name: secrets
name: firefly-secrets
key: STATIC_CRON_TOKEN

View File

@ -1,17 +1,14 @@
{{/* Define the secrets */}}
{{- define "fireflyiii.secrets" -}}
{{- $secretName := (printf "%s-fireflyiii-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }}
{{- $fireflyiiiprevious := lookup "v1" "Secret" .Release.Namespace $secretName }}
{{- $secretName := (printf "%s-firefly-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }}
{{- $appKey := randAlphaNum 32 -}}
{{- $cronToken := randAlphaNum 32 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
{{- $appKey = index .data "APP_KEY" | b64dec -}}
{{- $cronToken = index .data "STATIC_CRON_TOKEN" | b64dec -}}
{{- end }}
enabled: true
data:
{{- if $fireflyiiiprevious }}
STATIC_CRON_TOKEN: {{ index $fireflyiiiprevious.data "STATIC_CRON_TOKEN" | b64dec }}
APP_KEY: {{ index $fireflyiiiprevious.data "APP_KEY" | b64dec }}
{{- else }}
{{- $static_cron_token := randAlphaNum 32 }}
{{- $app_key := randAlphaNum 32 }}
STATIC_CRON_TOKEN: {{ $static_cron_token }}
APP_KEY: {{ $app_key }}
{{- end }}
STATIC_CRON_TOKEN: {{ $cronToken }}
APP_KEY: {{ $appKey }}
{{- end -}}

View File

@ -4,7 +4,7 @@
{{/* Render secrets for fireflyiii */}}
{{- $secrets := include "fireflyiii.secrets" . | fromYaml -}}
{{- if $secrets -}}
{{- $_ := set .Values.secret "secrets" $secrets -}}
{{- $_ := set .Values.secret "firefly-secrets" $secrets -}}
{{- end -}}
{{/* Render cronjob for fireflyiii */}}

View File

@ -55,11 +55,11 @@ workload:
key: redis-password
STATIC_CRON_TOKEN:
secretKeyRef:
name: secrets
name: firefly-secrets
key: STATIC_CRON_TOKEN
APP_KEY:
secretKeyRef:
name: secrets
name: firefly-secrets
key: APP_KEY
service: