chore(kimai): Migrate to new common and update app (#9831)

**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
- [ ] 🪛 Bugfix
- [x] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [x] 🔃 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:**

- [x] ⚖️ My code follows the style guidelines of this project
- [x] 👀 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
- [x] ⬆️ 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._

---------

Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com>
Co-authored-by: Stavros kois <s.kois@outlook.com>
This commit is contained in:
Sukarn
2023-10-07 19:23:59 +03:00
committed by GitHub
co-authored by Stavros Kois Stavros kois
parent 4c0965e8b0
commit b700ec2ddc
8 changed files with 162 additions and 103 deletions
+3 -3
View File
@@ -3,11 +3,11 @@ appVersion: "1.20"
dependencies: dependencies:
- name: common - name: common
repository: https://library-charts.truecharts.org repository: https://library-charts.truecharts.org
version: 11.1.2 version: 14.0.1
- condition: mariadb.enabled - condition: mariadb.enabled
name: mariadb name: mariadb
repository: https://deps.truecharts.org/ repository: https://deps.truecharts.org/
version: 5.0.35 version: 9.0.17
description: Kimai is a free, open source and online time-tracking software designed for small businesses and freelancers. description: Kimai is a free, open source and online time-tracking software designed for small businesses and freelancers.
home: https://truecharts.org/charts/incubator/kimai home: https://truecharts.org/charts/incubator/kimai
icon: https://truecharts.org/img/hotlink-ok/chart-icons/kimai.png icon: https://truecharts.org/img/hotlink-ok/chart-icons/kimai.png
@@ -25,7 +25,7 @@ sources:
- https://github.com/truecharts/charts/tree/master/charts/incubator/kimai - https://github.com/truecharts/charts/tree/master/charts/incubator/kimai
- https://github.com/kevinpapst/kimai2 - https://github.com/kevinpapst/kimai2
- https://github.com/tobybatch/kimai2 - https://github.com/tobybatch/kimai2
version: 7.0.0 version: 8.0.0
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- productivity - productivity
+44 -35
View File
@@ -6,48 +6,57 @@ questions:
# Include{global} # Include{global}
# Include{workload} # Include{workload}
# Include{workloadDeployment} # Include{workloadDeployment}
# Include{replicas1} # Include{replicas1}
# Include{podSpec} # Include{podSpec}
# Include{containerMain} # Include{containerMain}
- variable: env
group: "App Configuration"
label: "Image Environment"
schema:
additional_attrs: true
type: dict
attrs:
- variable: ADMINMAIL
label: "Admin E-mail"
schema:
type: string
default: ""
required: true
- variable: ADMINPASS
label: "Admin Password"
schema:
type: string
default: ""
required: true
private: true
- variable: trust_hosts
label: "TRUSTED_HOSTS"
description: "Comma separated list of trusted hosts."
schema:
type: string
default: "YOUR.FQDN or YOUR.NAS.IP"
# Include{containerBasic} # Include{containerBasic}
# Include{containerAdvanced} # Include{containerAdvanced}
# Include{containerConfig} # Include{containerConfig}
# Include{podOptions} - variable: kimai
# Include{serviceRoot} group: App Configuration
- variable: main label: Kimai
label: "Main Service" schema:
description: "The Primary service on which the healthcheck runs, often the webUI" additional_attrs: true
type: dict
attrs:
- variable: credentials
group: App Configuration
label: Admin Credentials
schema: schema:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: adminMail
label: Admin e-mail address
description: Email address of the admin account.
schema:
type: string
default: ""
required: true
- variable: adminPass
label: Admin password
description: Password for the admin account.
schema:
type: string
default: ""
required: true
private: true
- variable: trusted_hosts
label: Trusted Hosts
description: Comma separated list of trusted hosts. Sets the environment variable TRUSTED_HOSTS.
schema:
type: list
default: []
items:
- variable: hostEntry
label: Trusted Host
schema:
type: string
default: ""
required: true
# Include{podOptions}
# Include{serviceRoot}
# Include{serviceMain}
# Include{serviceSelectorLoadBalancer} # Include{serviceSelectorLoadBalancer}
# Include{serviceSelectorExtras} # Include{serviceSelectorExtras}
- variable: main - variable: main
@@ -103,13 +112,13 @@ questions:
description: "The UserID of the user running the application" description: "The UserID of the user running the application"
schema: schema:
type: int type: int
default: 33 default: 0
- variable: runAsGroup - variable: runAsGroup
label: "runAsGroup" label: "runAsGroup"
description: "The groupID of the user running the application" description: "The groupID of the user running the application"
schema: schema:
type: int type: int
default: 33 default: 0
# Include{securityContextContainer} # Include{securityContextContainer}
# Include{securityContextAdvanced} # Include{securityContextAdvanced}
# Include{securityContextPod} # Include{securityContextPod}
@@ -118,7 +127,7 @@ questions:
description: "The group that should own ALL storage." description: "The group that should own ALL storage."
schema: schema:
type: int type: int
default: 568 default: 33
# Include{resources} # Include{resources}
# Include{advanced} # Include{advanced}
@@ -0,0 +1 @@
{{- include "tc.v1.common.lib.chart.notes" $ -}}
@@ -0,0 +1,23 @@
{{/* Define the configmap */}}
{{- define "kimai.configmap" -}}
{{- $trusted_hosts := .Values.kimai.trusted_hosts -}}
{{- if not (mustHas "localhost" $trusted_hosts) -}}
{{- $trusted_hosts = mustAppend $trusted_hosts "localhost" -}}
{{- end }}
kimai-config:
enabled: true
data:
APP_ENV: prod
DB_TYPE: mysql
DB_PORT: "3306"
DB_USER: {{ .Values.mariadb.mariadbDatabase }}
DB_BASE: {{ .Values.mariadb.mariadbUsername }}
{{/* Admin credentials */}}
ADMINMAIL: {{ .Values.kimai.credentials.adminMail }}
ADMINPASS: {{ .Values.kimai.credentials.adminPass }}
{{/* Trusted Hosts */}}
TRUSTED_HOSTS: {{ join "," $trusted_hosts }}
memory_limit: 256M
{{- end -}}
+10 -16
View File
@@ -1,20 +1,14 @@
{{/* Define the secrets */}} {{/* Define the secrets */}}
{{- define "kimai.secrets" -}} {{- define "kimai.secret" -}}
--- {{- $secretName := (printf "%s-kimai-secret" (include "tc.v1.common.lib.chart.names.fullname" $)) -}}
apiVersion: v1 {{- $app_secret := randAlphaNum 32 -}}
kind: Secret {{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}}
type: Opaque {{- $app_secret = index .data "APP_SECRET" | b64dec -}}
metadata: {{- end }}
name: kimai-secrets
{{- $kimaiprevious := lookup "v1" "Secret" .Release.Namespace "kimai-secrets" }}
{{- $app_secret := "" }}
data:
{{- if $kimaiprevious}}
APP_SECRET: {{ index $kimaiprevious.data "APP_SECRET" }}
{{- else }}
{{- $app_secret := randAlphaNum 32 }}
APP_SECRET: {{ $app_secret | b64enc }}
{{- end }}
kimai-secret:
enabled: true
data:
APP_SECRET: {{ $app_secret }}
{{- end -}} {{- end -}}
+14 -4
View File
@@ -1,8 +1,18 @@
{{/* Make sure all variables are set properly */}} {{/* Make sure all variables are set properly */}}
{{- include "tc.common.loader.init" . }} {{- include "tc.v1.common.loader.init" . }}
{{- $secret := include "kimai.secret" . | fromYaml -}}
{{- if $secret -}}
{{ $secret := (mustMergeOverwrite .Values.secret $secret) }}
{{- $_ := set .Values "secret" $secret -}}
{{- end -}}
{{- $config := include "kimai.configmap" . | fromYaml -}}
{{- if $config -}}
{{ $config := (mustMergeOverwrite .Values.configmap $config) }}
{{- $_ := set .Values "configmap" $config -}}
{{- end -}}
{{/* Render secrets for kimai */}}
{{- include "kimai.secrets" . }}
{{/* Render the templates */}} {{/* Render the templates */}}
{{ include "tc.common.loader.apply" . }} {{ include "tc.v1.common.loader.apply" . }}
+62 -44
View File
@@ -1,40 +1,62 @@
image: image:
repository: tccr.io/truecharts/kimai repository: tccr.io/truecharts/kimai
tag: v1.20@sha256:f13b70aa746b3d8a754bcf1f78dbdfde95b94f443ee17b9e3474ab0ebf6068e3 tag: v2.0.35@sha256:064005e7296208101c07aa22c911bd3b886ae1d33ecc144e8cc158f47de0fe8e
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
securityContext: kimai:
readOnlyRootFilesystem: false credentials:
adminMail: admin@change.me
adminPass: ChangeME
trusted_hosts:
- localhost
podSecurityContext: workload:
runAsUser: 33 main:
runAsGroup: 33 podSpec:
securityContext:
secretEnv: fsGroup: 33
ADMINMAIL: "admin@mysecretdomain.com" containers:
ADMINPASS: "MvvTfjagiaqDprGNVA" main:
securityContext:
env: readOnlyRootFilesystem: false
DB_TYPE: "mysql" runAsUser: 0
DB_PORT: "3306" runAsGroup: 0
DB_USER: "{{ .Values.mariadb.mariadbDatabase }}" capabilities:
DB_BASE: "{{ .Values.mariadb.mariadbUsername }}" disableS6Caps: true
APP_ENV: "prod" add:
TRUSTED_HOSTS: "{{ .Values.env.trust_hosts }},localhost" - CHOWN
# User Defined - DAC_OVERRIDE
trust_hosts: "127.0.0.1" - FOWNER
DB_PASS: - SETGID
secretKeyRef: - SETUID
name: mariadbcreds env:
key: mariadb-password DB_PASS:
DB_HOST: secretKeyRef:
secretKeyRef: expandObjectName: false
name: mariadbcreds name: '{{ printf "%s-%s" .Release.Name "mariadbcreds" }}'
key: plainhost key: mariadb-password
APP_SECRET: DB_HOST:
secretKeyRef: secretKeyRef:
name: kimai-secrets expandObjectName: false
key: APP_SECRET name: '{{ printf "%s-%s" .Release.Name "mariadbcreds" }}'
key: plainhost
APP_SECRET:
secretKeyRef:
name: kimai-secret
key: APP_SECRET
envFrom:
- configMapRef:
name: kimai-config
probes:
liveness:
enabled: true
path: /en/login
readiness:
enabled: true
path: /en/login
startup:
enabled: true
type: tcp
service: service:
main: main:
@@ -43,27 +65,23 @@ service:
port: 10198 port: 10198
targetPort: 8001 targetPort: 8001
probes:
liveness:
path: "/en/login"
readiness:
path: "/en/login"
startup:
path: "/en/login"
persistence: persistence:
data: data:
enabled: true enabled: true
mountPath: "/opt/kimai/var/data" mountPath: /opt/kimai/var/data
plugins: plugins:
enabled: true enabled: true
mountPath: "/opt/kimai/var/plugins" mountPath: /opt/kimai/var/plugins
varlock:
enabled: true
type: emptyDir
mountPath: /var/lock
mariadb: mariadb:
enabled: true enabled: true
mariadbUsername: kimai mariadbUsername: kimai
mariadbDatabase: kimai mariadbDatabase: kimai
existingSecret: "mariadbcreds"
portal: portal:
enabled: true open:
enabled: true
+5 -1
View File
@@ -73,6 +73,7 @@ words:
- flemmarr - flemmarr
- flushtables - flushtables
- forcegc - forcegc
- FOWNER
- fullname - fullname
- geoip - geoip
- geoipupdate - geoipupdate
@@ -112,6 +113,7 @@ words:
- kavita - kavita
- keepalive - keepalive
- killswitch - killswitch
- kimai
- kiwix - kiwix
- kjeld - kjeld
- kube - kube
@@ -240,6 +242,8 @@ words:
- servername - servername
- serverstransports - serverstransports
- serviceexpert - serviceexpert
- SETGID
- SETUID
- sgateway - sgateway
- signup - signup
- smallblock - smallblock
@@ -287,11 +291,11 @@ words:
- unet - unet
- unifi - unifi
- upsnap - upsnap
- upsnap
- upstreams - upstreams
- userspace - userspace
- vaapi - vaapi
- valheim - valheim
- varlock
- vaultwarden - vaultwarden
- vdev - vdev
- vikunja - vikunja