moves helm chart

This commit is contained in:
simon.franken
2026-03-25 10:25:29 +01:00
parent ca521000bf
commit 88866f73e6
12 changed files with 1 additions and 1 deletions

45
helm/templates/NOTES.txt Normal file
View File

@@ -0,0 +1,45 @@
CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}
** Please be patient while the chart is being deployed **
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
- http{{ if .Values.ingress.tls.enabled }}s{{ end }}://{{ (index .Values.ingress.hosts 0).host }}
{{- else if contains "NodePort" .Values.frontend.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "timetracker.fullname" . }}-frontend)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.frontend.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "timetracker.fullname" . }}-frontend'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "timetracker.fullname" . }}-frontend --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP
{{- else if contains "ClusterIP" .Values.frontend.service.type }}
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "timetracker.fullname" . }}-frontend 8080:80
echo "Visit http://127.0.0.1:8080 to use your application"
{{- end }}
2. Check the status of the pods:
kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "timetracker.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"
3. External PostgreSQL:
This chart requires an existing PostgreSQL database.
Configured connection: {{ .Values.postgresql.url }}
IMPORTANT NOTES:
- Ensure your external PostgreSQL database is reachable from within the cluster before installing.
- Set postgresql.url in values.yaml to point to your existing database.
- Make sure to change the OIDC configuration in values.yaml
- Change the SESSION_SECRET from the default value for production
- Set backend.jwt.secret to a dedicated secret in production (falls back to SESSION_SECRET if empty)
- Configure ingress host and TLS settings for your environment
OIDC Configuration Required:
issuerUrl: {{ .Values.backend.oidc.issuerUrl | default "NOT SET - REQUIRED" }}
clientId: {{ .Values.backend.oidc.clientId | default "NOT SET - REQUIRED" }}
iosRedirectUri: {{ .Values.backend.oidc.iosRedirectUri }}
JWT (iOS Bearer auth):
jwt.secret: {{ if .Values.backend.jwt.secret }}(set){{ else }}NOT SET - falling back to session.secret{{ end }}

View File

@@ -0,0 +1,95 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "timetracker.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "timetracker.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "timetracker.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "timetracker.labels" -}}
helm.sh/chart: {{ include "timetracker.chart" . }}
{{ include "timetracker.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "timetracker.selectorLabels" -}}
app.kubernetes.io/name: {{ include "timetracker.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "timetracker.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "timetracker.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{/*
Backend labels
*/}}
{{- define "timetracker.backend.labels" -}}
{{ include "timetracker.labels" . }}
app.kubernetes.io/component: backend
{{- end }}
{{/*
Frontend labels
*/}}
{{- define "timetracker.frontend.labels" -}}
{{ include "timetracker.labels" . }}
app.kubernetes.io/component: frontend
{{- end }}
{{/*
Backend selector labels
*/}}
{{- define "timetracker.backend.selectorLabels" -}}
{{ include "timetracker.selectorLabels" . }}
app.kubernetes.io/component: backend
{{- end }}
{{/*
Frontend selector labels
*/}}
{{- define "timetracker.frontend.selectorLabels" -}}
{{ include "timetracker.selectorLabels" . }}
app.kubernetes.io/component: frontend
{{- end }}

View File

@@ -0,0 +1,84 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "timetracker.fullname" . }}-backend
labels:
{{- include "timetracker.backend.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.backend.replicaCount }}
selector:
matchLabels:
{{- include "timetracker.backend.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "timetracker.backend.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "timetracker.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: backend
image: "{{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }}"
imagePullPolicy: {{ .Values.backend.image.pullPolicy }}
env:
- name: NODE_ENV
value: {{ .Values.backend.env.nodeEnv | quote }}
- name: PORT
value: {{ .Values.backend.env.port | quote }}
- name: PG_USERNAME
{{- if .Values.postgresql.auth.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.auth.existingSecret }}
key: username
{{- else }}
value: {{ .Values.postgresql.auth.username | quote }}
{{- end }}
- name: PG_PASSWORD
{{- if .Values.postgresql.auth.existingSecret }}
valueFrom:
secretKeyRef:
name: {{ .Values.postgresql.auth.existingSecret }}
key: password
{{- else }}
value: {{ .Values.postgresql.auth.password | quote }}
{{- end }}
- name: DATABASE_URL
value: "postgresql://$(PG_USERNAME):$(PG_PASSWORD)@{{ .Values.postgresql.host }}:{{ .Values.postgresql.port }}/{{ .Values.postgresql.database }}"
- name: OIDC_ISSUER_URL
value: {{ .Values.backend.oidc.issuerUrl | quote }}
- name: OIDC_CLIENT_ID
value: {{ .Values.backend.oidc.clientId | quote }}
- name: OIDC_REDIRECT_URI
value: {{ (index .Values.ingress.hosts 0).host | printf "https://%s/api/auth/callback" | quote }}
- name: OIDC_IOS_REDIRECT_URI
value: {{ .Values.backend.oidc.iosRedirectUri | quote }}
- name: SESSION_SECRET
value: {{ .Values.backend.session.secret | quote }}
- name: JWT_SECRET
value: {{ .Values.backend.jwt.secret | quote }}
- name: APP_URL
value: {{ (index .Values.ingress.hosts 0).host | printf "https://%s" | quote }}
ports:
- name: http
containerPort: 3001
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 5
periodSeconds: 5
resources:
{{- toYaml .Values.backend.resources | nindent 12 }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "timetracker.fullname" . }}-backend
labels:
{{- include "timetracker.backend.labels" . | nindent 4 }}
spec:
type: {{ .Values.backend.service.type }}
ports:
- port: {{ .Values.backend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "timetracker.backend.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,45 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "timetracker.fullname" . }}-frontend
labels:
{{- include "timetracker.frontend.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.frontend.replicaCount }}
selector:
matchLabels:
{{- include "timetracker.frontend.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "timetracker.frontend.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "timetracker.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: frontend
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
ports:
- name: http
containerPort: 8080
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 10
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 5
resources:
{{- toYaml .Values.frontend.resources | nindent 12 }}

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "timetracker.fullname" . }}-frontend
labels:
{{- include "timetracker.frontend.labels" . | nindent 4 }}
spec:
type: {{ .Values.frontend.service.type }}
ports:
- port: {{ .Values.frontend.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "timetracker.frontend.selectorLabels" . | nindent 4 }}

View File

@@ -0,0 +1,47 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "timetracker.fullname" . }}
labels:
{{- include "timetracker.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
# Backend API routes first (more specific)
# $2 capture group strips the /api prefix via rewrite-target annotation
- path: /api(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: {{ include "timetracker.fullname" $ }}-backend
port:
number: {{ $.Values.backend.service.port }}
# Frontend (catch-all)
- path: /()(.*)
pathType: ImplementationSpecific
backend:
service:
name: {{ include "timetracker.fullname" $ }}-frontend
port:
number: {{ $.Values.frontend.service.port }}
{{- end }}
{{- if .Values.ingress.tls.enabled }}
tls:
- hosts:
{{- range .Values.ingress.hosts }}
- {{ .host | quote }}
{{- end }}
secretName: {{ .Values.ingress.tls.secretName }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "timetracker.serviceAccountName" . }}
labels:
{{- include "timetracker.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}