fix(kitchenowl): assign backend environment variables (#17050)

This commit is contained in:
jfrazx 2024-01-12 15:37:04 -08:00 committed by GitHub
parent b7b7aca08d
commit 87294826b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 66 deletions

View File

@ -1,7 +1,7 @@
kubeVersion: ">=1.24.0-0" kubeVersion: ">=1.24.0-0"
apiVersion: v2 apiVersion: v2
name: kitchenowl name: kitchenowl
version: 8.2.2 version: 8.3.0
appVersion: latest appVersion: latest
description: KitchenOwl is a smart self-hosted grocery list and recipe manager. description: KitchenOwl is a smart self-hosted grocery list and recipe manager.
home: https://truecharts.org/charts/stable/kitchenowl home: https://truecharts.org/charts/stable/kitchenowl

View File

@ -1,10 +0,0 @@
{{/* Define the configmap */}}
{{- define "kitchenowl.configmap" -}}
{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}}
enabled: true
data:
BACK_URL: {{ printf "%v-backend:%v" $fullname .Values.service.backend.ports.backend.port }}
{{- end -}}

View File

@ -1,15 +1,14 @@
{{/* Define the secrets */}} {{/* Define the secrets */}}
{{- define "kitchenowl.secrets" -}} {{- define "kitchenowl.secrets" -}}
{{- $secretName := (printf "%s-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }}
{{- $kitchenowlprevious := lookup "v1" "Secret" .Release.Namespace $secretName }} {{- $secretName := printf "%s-kitchenowl-secrets" (include "tc.v1.common.lib.chart.names.fullname" $) }}
{{- $jwt := randAlphaNum 50 -}}
{{- with lookup "v1" "Secret" .Release.Namespace $secretName -}}
{{- $jwt = index .data "JWT_SECRET_KEY" | b64dec -}}
{{- end }}
enabled: true enabled: true
data: data:
{{- if $kitchenowlprevious }} JWT_SECRET_KEY: {{ $jwt }}
JWT_SECRET_KEY: {{ index $kitchenowlprevious.data "JWT_SECRET_KEY" | b64dec }}
{{- else }}
{{- $jwtsecret := randAlphaNum 50 }}
JWT_SECRET_KEY: {{ $jwtsecret }}
{{- end }}
{{- end -}} {{- end -}}

View File

@ -6,10 +6,4 @@
{{- $_ := set .Values.secret "kitchenowl-secrets" $secrets -}} {{- $_ := set .Values.secret "kitchenowl-secrets" $secrets -}}
{{- end -}} {{- end -}}
{{/* Render configmap for Kitchenowl */}}
{{- $configmap := include "kitchenowl.configmap" . | fromYaml -}}
{{- if $configmap -}}
{{- $_ := set .Values.configmap "kitchenowl-config" $configmap -}}
{{- end -}}
{{ include "tc.v1.common.loader.apply" . }} {{ include "tc.v1.common.loader.apply" . }}

View File

@ -6,82 +6,66 @@ backendImage:
repository: tombursch/kitchenowl repository: tombursch/kitchenowl
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
tag: latest@sha256:0a4ae56f82b25a9e6362689af500b3f7f6248e898db7e4c5fcbd1b42bfa9b119 tag: latest@sha256:0a4ae56f82b25a9e6362689af500b3f7f6248e898db7e4c5fcbd1b42bfa9b119
service: service:
main: main:
enabled: true enabled: true
targetSelector: main # Target frontend pod
targetSelector: frontend
ports: ports:
main: main:
enabled: true enabled: true
targetSelector: main # Target frontend container
targetSelector: frontend
protocol: http protocol: http
targetPort: 80 targetPort: 80
port: 10246 port: 10246
backend: backend:
enabled: true enabled: true
targetSelector: backend # Target main(backend) pod
targetSelector: main
ports: ports:
backend: backend:
enabled: true enabled: true
targetSelector: backend # Target main(backend) container
targetSelector: main
protocol: http protocol: http
targetPort: 5000 targetPort: 5000
port: 10247 port: 10247
persistence: persistence:
data: data:
enabled: true enabled: true
targetSelector: targetSelector:
backend: main:
backend: main:
mountPath: /data mountPath: /data
portal: portal:
open: open:
enabled: true enabled: true
securityContext: securityContext:
container: container:
readOnlyRootFilesystem: false readOnlyRootFilesystem: false
runAsNonRoot: false runAsNonRoot: false
runAsUser: 0 runAsUser: 0
runAsGroup: 0 runAsGroup: 0
workload: workload:
main: main:
enabled: true
primary: true
type: Deployment type: Deployment
strategy: RollingUpdate
replicas: 1
podSpec: podSpec:
containers: containers:
main: main:
enabled: true # Backend
primary: true
envFrom:
- configMapRef:
name: kitchenowl-config
env:
FRONT_URL: "{{ .Values.workload.main.podSpec.containers.main.env.FRONT_URL }}"
probes:
liveness:
type: http
path: /
port: "{{ .Values.service.main.ports.main.targetPort }}"
readiness:
type: http
path: /
port: "{{ .Values.service.main.ports.main.targetPort }}"
startup:
type: http
path: /
port: "{{ .Values.service.main.ports.main.targetPort }}"
backend:
enabled: true
type: Deployment
podSpec:
containers:
backend:
enabled: true enabled: true
primary: true primary: true
imageSelector: backendImage imageSelector: backendImage
env: env:
FRONT_URL: "{{ .Values.workload.main.podSpec.containers.main.env.FRONT_URL }}" FRONT_URL: ""
OIDC_ISSUER: "" OIDC_ISSUER: ""
OIDC_CLIENT_ID: "" OIDC_CLIENT_ID: ""
OIDC_CLIENT_SECRET: "" OIDC_CLIENT_SECRET: ""
@ -89,12 +73,11 @@ workload:
APPLE_CLIENT_SECRET: "" APPLE_CLIENT_SECRET: ""
GOOGLE_CLIENT_ID: "" GOOGLE_CLIENT_ID: ""
GOOGLE_CLIENT_SECRET: "" GOOGLE_CLIENT_SECRET: ""
# Changed port to 10248 to avoid conflict with frontend
HTTP_PORT: "10248"
JWT_SECRET_KEY: JWT_SECRET_KEY:
secretKeyRef: secretKeyRef:
name: kitchenowl-secrets name: kitchenowl-secrets
key: JWT_SECRET_KEY key: JWT_SECRET_KEY
STORAGE_PATH: "{{ .Values.persistence.data.targetSelector.main.main.mountPath }}"
DB_DRIVER: "postgresql" DB_DRIVER: "postgresql"
DB_HOST: DB_HOST:
secretKeyRef: secretKeyRef:
@ -109,20 +92,51 @@ workload:
probes: probes:
liveness: liveness:
enabled: true enabled: true
type: tcp type: exec
port: "{{ .Values.service.backend.ports.backend.targetPort }}" port: "{{ .Values.service.backend.ports.backend.targetPort }}"
command:
- uwsgi_curl
- localhost:5000
- /api/health/8M4F88S8ooi4sMbLBfkkV7ctWwgibW6V
readiness: readiness:
enabled: true enabled: true
type: tcp type: exec
port: "{{ .Values.service.backend.ports.backend.targetPort }}" port: "{{ .Values.service.backend.ports.backend.targetPort }}"
command:
- uwsgi_curl
- localhost:5000
- /api/health/8M4F88S8ooi4sMbLBfkkV7ctWwgibW6V
startup: startup:
enabled: true enabled: true
type: tcp type: tcp
port: "{{ .Values.service.backend.ports.backend.targetPort }}" port: "{{ .Values.service.backend.ports.backend.targetPort }}"
frontend:
enabled: true
type: Deployment
strategy: RollingUpdate
replicas: 1
podSpec:
containers:
frontend:
enabled: true
primary: true
env:
BACK_URL: '{{ printf "%s-backend:%v" (include "tc.v1.common.lib.chart.names.fullname" $) .Values.service.backend.ports.backend.port }}'
probes:
liveness:
type: http
path: /
port: "{{ .Values.service.main.ports.main.targetPort }}"
readiness:
type: http
path: /
port: "{{ .Values.service.main.ports.main.targetPort }}"
startup:
type: tcp
port: "{{ .Values.service.main.ports.main.targetPort }}"
# Enabled postgres # Enabled postgres
cnpg: cnpg:
main: main:
enabled: true enabled: true
user: kitchenowl user: kitchenowl
database: kitchenowl database: kitchenowl
updated: true