From 5312dc6a34306a81a37833a041fd0254ecae6c8b Mon Sep 17 00:00:00 2001 From: perf3ct Date: Wed, 4 Oct 2023 10:02:37 -0700 Subject: [PATCH] change backend to be api --- README.md | 2 +- templates/backend.yaml | 19 ++++++++++++++----- templates/frontend.yaml | 4 ++-- values.yaml | 27 +++++++++++++++++++-------- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e90b7df..0b50978 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Vikunja Helm Chart === -Deployes both frontend and backend. Also, you can deploy bitnami's PostgreSQL and Redis as subcharts if you want. +Deployes both frontend and api. Also, you can deploy bitnami's PostgreSQL and Redis as subcharts if you want. ## Requirements diff --git a/templates/backend.yaml b/templates/backend.yaml index 37322fa..5343347 100644 --- a/templates/backend.yaml +++ b/templates/backend.yaml @@ -1,6 +1,6 @@ -{{- define "vikunja.backend.hardcodedValues" -}} +{{- define "vikunja.api.hardcodedValues" -}} global: - nameOverride: backend + nameOverride: api service: main: @@ -23,12 +23,21 @@ env: VIKUNJA_TYPESENSE_ENABLED: "true" {{ end }} +# Logic to decide what the api URL should be +{{ if .Values.ingress.enabled }} + VIKUNJA_API_URL: "https://{{ .Values.ingress.host }}{{ .Values.ingress.path }}" +{{ else if .Values.service.main.enabled }} + VIKUNJA_API_URL: "http://{{ .Values.service.main.name }}.{{ .Values.service.main.namespace }}.svc.cluster.local:{{ .Values.service.main.ports.http.port }}{{ .Values.ingress.path }}" +{{ else }} + VIKUNJA_API_URL: "http://localhost:3456{{ .Values.ingress.path }}" +{{ end }} + {{ end }} -{{ if .Values.backend.enabled }} +{{ if .Values.api.enabled }} {{- $ctx := deepCopy . -}} -{{- $_ := get .Values "backend" | mergeOverwrite $ctx.Values -}} -{{- $_ = include "vikunja.backend.hardcodedValues" . | fromYaml | merge $ctx.Values -}} +{{- $_ := get .Values "api" | mergeOverwrite $ctx.Values -}} +{{- $_ = include "vikunja.api.hardcodedValues" . | fromYaml | merge $ctx.Values -}} {{- include "bjw-s.common.loader.all" $ctx }} {{ end }} \ No newline at end of file diff --git a/templates/frontend.yaml b/templates/frontend.yaml index d7f3e1e..722c689 100644 --- a/templates/frontend.yaml +++ b/templates/frontend.yaml @@ -5,14 +5,14 @@ global: service: main: enabled: true - {{- if not .Values.backend.enabled -}} + {{- if not .Values.api.enabled -}} primary: true {{- end }} type: ClusterIP ports: http: enabled: true - {{- if not .Values.backend.enabled -}} + {{- if not .Values.api.enabled -}} primary: true {{- end }} port: 80 diff --git a/values.yaml b/values.yaml index 0264bac..db5eb97 100644 --- a/values.yaml +++ b/values.yaml @@ -1,9 +1,10 @@ ## This chart relies on the common library chart from bjw-s -## You can find it and the values you can provide and modify, at https://github.com/bjw-s/helm-charts/tree/main/charts/library/common -## Refer there for more detail about the supported values - -# These entries are shared between all the vikunja components +## You can find it and the values you can provide and modify, at https://github.com/bjw-s/helm-charts/tree/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common +## Here's the link to the values.yaml file: https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml +## Refer there for more detail about the supported values. +## Any values that you find in the above `values.yaml` can be provided to this chart and are then rendered. +# These environment variables are shared between all the vikunja components env: VIKUNJA_REDIS_HOST: '{{ printf "%s-redis-master" .Release.Name }}' VIKUNJA_REDIS_DB: "{{ .Release.Name }}" @@ -15,7 +16,7 @@ env: VIKUNJA_TYPESENSE_APIKEY: "{{ .Values.typesense.env.TYPESENSE_API_KEY }}" VIKUNJA_TYPESENSE_URL: '{{ printf "%s-typesense" .Release.Name }}' VIKUNJA_FRONTEND_URL: '{{ printf "http://%s-frontend" .Release.Name }}' - VIKUNJA_API_URL: '{{ printf "http://%s-backend:3456" .Release.Name }}' + VIKUNJA_API_URL: '{{ .Values.backened.ingress.main.hosts[0].host }}' image: tag: 0.21.0 @@ -27,12 +28,16 @@ storage: # You have to specify an existing PVC to use existingClaim: -# vikunja components +###################### +# VIKUNJA COMPONENTS # +###################### frontend: enabled: true + # https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L63-L69 image: repository: vikunja/frontend pullPolicy: IfNotPresent + # https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L393-L436 ingress: main: enabled: true @@ -45,7 +50,7 @@ frontend: - path: "/" tls: [] -backend: +api: enabled: true image: repository: vikunja/api @@ -69,7 +74,12 @@ backend: - path: "/api" tls: [] -# Dependencies +########################## +# END VIKUNJA COMPONENTS # +########################## + + +# Optional Dependencies postgresql: enabled: true global: @@ -103,6 +113,7 @@ typesense: tag: 0.25.1 pullPolicy: IfNotPresent +# https://github.com/bjw-s/helm-charts/blob/a081de53024d8328d1ae9ff7e4f6bc500b0f3a29/charts/library/common/values.yaml#L85-L94 serviceAccount: # -- Specifies whether a service account should be created create: false