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"
apiVersion: v2
name: kitchenowl
version: 8.2.2
version: 8.3.0
appVersion: latest
description: KitchenOwl is a smart self-hosted grocery list and recipe manager.
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 "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
data:
{{- if $kitchenowlprevious }}
JWT_SECRET_KEY: {{ index $kitchenowlprevious.data "JWT_SECRET_KEY" | b64dec }}
{{- else }}
{{- $jwtsecret := randAlphaNum 50 }}
JWT_SECRET_KEY: {{ $jwtsecret }}
{{- end }}
JWT_SECRET_KEY: {{ $jwt }}
{{- end -}}

View File

@ -6,10 +6,4 @@
{{- $_ := set .Values.secret "kitchenowl-secrets" $secrets -}}
{{- 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" . }}

View File

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