From 8397295997c27db4c91f889bfe32032170c77722 Mon Sep 17 00:00:00 2001 From: "Schiller, Tjorben" Date: Tue, 2 Jul 2024 17:29:47 +0200 Subject: [PATCH] wip: cleanup, fix postgres requests --- README.md | 34 +++++++++---------- .../templates/deployment.yaml | 14 +++++--- .../templates/configMap.yml | 9 ----- .../templates/deployment.yaml | 20 +++-------- terminfinder-chart/values.yaml | 22 +++--------- 5 files changed, 35 insertions(+), 64 deletions(-) delete mode 100644 terminfinder-chart/charts/terminfinder-frontend/templates/configMap.yml diff --git a/README.md b/README.md index 9df500e..66caab8 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,7 @@ Complete Helm Chart repository for deploying the Terminfinder to any kubernetes [SECURITY.md](./docs/SECURITY.md) -## Components - -* Frontend: `registry.opencode.de/ig-bvc/demo-apps/terminfinder-sh/terminfinder-sh-frontend:v2.2.0` -* Backend: `registry.opencode.de/ig-bvc/demo-apps/terminfinder-sh/terminfinder-sh-backend:V1.0.9` -* Postgres (part of Backend): - Using [this public Helm chart](https://github.com/bitnami/charts/tree/main/bitnami/postgresql/) as fundament, but can - be disabled through `values.yaml` of the backend file. - -Please modify the `values.yaml` files or use the CLI method for deployment and configuration. It's recommended to use a -dedicated PostgreSQL instance for production usage. +It's recommended to use a dedicated PostgreSQL instance for production usage. ## Installation @@ -38,8 +29,8 @@ dedicated PostgreSQL instance for production usage. ### Installation steps -1. Prepare the value files for the backend and frontend each. -2. Install the helm charts with `helm install ...` CLI Command +1. Prepare the value files. +2. Install the helm charts with `helm install ...` CLI Command: ```bash # Create a namespace (or use default), where to work in: @@ -51,21 +42,28 @@ $ helm install terminfinder-demo terminfinder-chart -n terminfinder-demo # Verify installation of helm charts: $ helm list -n terminfinder-demo $ kubectl get deploy -n terminfinder-demo +``` + +## Upgrade Helmchart + +To upgrade the helm chart, use the `helm upgrade ...` command: -# Go to your configured ingress host domain (e.g. terminfinder.open-code.local) and test it out! -# The URL of the ingresses you can get here: -$ kubectl get ingress -n terminfinder-demo +```bash +# Upgrade HelmChart +$ helm upgrade terminfinder-demo terminfinder-chart -n terminfinder-demo ``` ## Delete Namespace +To delete the helm chart (release), use the `helm uninstall...` command. + +Note that the persistent volume may be available even if the helm release is uninstalled. + ```bash # Delete Namespace -$ kubectl delete namespace terminfinder-demo +$ helm uninstall terminfinder-demo -n terminfinder-demo ``` -Your can upgrade the helm chart as usually with `helm upgrade ...` command. - ### Using an own PostgreSQL DB instance The helm chart deployment of the `terminfinder-frontend` will be kept untouched. diff --git a/terminfinder-chart/charts/terminfinder-backend/templates/deployment.yaml b/terminfinder-chart/charts/terminfinder-backend/templates/deployment.yaml index 173053f..b5ff016 100644 --- a/terminfinder-chart/charts/terminfinder-backend/templates/deployment.yaml +++ b/terminfinder-chart/charts/terminfinder-backend/templates/deployment.yaml @@ -1,4 +1,4 @@ -{{- $svc := .Values.global.postgresql.service.name | default (printf "%s-postgresql-hl" (include "terminfinder-backend.fullname" .)) }} +{{- $svc := .Values.global.postgresql.service.name | default (printf "%s-postgresql-hl" (include "common.names.namespace" .)) }} apiVersion: apps/v1 kind: Deployment metadata: @@ -35,14 +35,13 @@ spec: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - # TODO Logs of backend: An error occurred using the connection to database 'terminfinder' on server ''. env: - name: DB_DATABASE value: {{ .Values.global.postgresql.auth.database }} - name: DB_PORT value: {{ .Values.global.postgresql.service.ports.postgresql | quote }} - name: DB_ADDRESS - value: {{ printf "%s.%s.svc" $svc .Release.Namespace }} + value: {{ printf "%s" $svc }} - name: DB_USERNAME value: {{ .Values.global.postgresql.auth.username }} - name: ASPNETCORE_URLS @@ -61,12 +60,19 @@ spec: - name: Terminfinder__Log4NetConfigFilename value: log4net.Console.debug.config - name: ConnectionStrings__TerminfinderConnection - value: "Server=$(DB_ADDRESS);Port=$(DB_PORT);Database=$(DB_DATABASE);User ID=$(DB_USERNAME);password=$(DB_PASSWORD);" + value: "Server=$(DB_ADDRESS),$(DB_PORT);Database=$(DB_DATABASE);User ID=$(DB_USERNAME);password=$(DB_PASSWORD);" ports: - name: http containerPort: 8080 protocol: TCP + startupProbe: + failureThreshold: 3 + periodSeconds: 10 + httpGet: + path: /app + port: http livenessProbe: + initialDelaySeconds: 10 httpGet: path: /app port: http diff --git a/terminfinder-chart/charts/terminfinder-frontend/templates/configMap.yml b/terminfinder-chart/charts/terminfinder-frontend/templates/configMap.yml deleted file mode 100644 index 6fa82e2..0000000 --- a/terminfinder-chart/charts/terminfinder-frontend/templates/configMap.yml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ .Release.Name }}-customer-config -data: - Anrede: "{{ .Values.customerConfig.ADDRESSING }}" - Sprache: "{{ .Values.customerConfig.LOCALE }}" - Titel: "{{ .Values.customerConfig.TITLE }}" - email: "{{ .Values.customerConfig.EMAIL }}" diff --git a/terminfinder-chart/charts/terminfinder-frontend/templates/deployment.yaml b/terminfinder-chart/charts/terminfinder-frontend/templates/deployment.yaml index 146b62a..7ccaa11 100644 --- a/terminfinder-chart/charts/terminfinder-frontend/templates/deployment.yaml +++ b/terminfinder-chart/charts/terminfinder-frontend/templates/deployment.yaml @@ -36,25 +36,13 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} env: - name: ADDRESSING - valueFrom: - configMapKeyRef: - name: {{ .Release.Name }}-customer-config - key: Anrede + value: {{ .Values.customerConfig.ADDRESSING }} - name: LOCALE - valueFrom: - configMapKeyRef: - name: {{ .Release.Name }}-customer-config - key: Sprache + value: {{ .Values.customerConfig.LOCALE }} - name: TITLE - valueFrom: - configMapKeyRef: - name: {{ .Release.Name }}-customer-config - key: Titel + value: {{ .Values.customerConfig.TITLE }} - name: EMAIL - valueFrom: - configMapKeyRef: - name: {{ .Release.Name }}-customer-config - key: email + value: {{ .Values.customerConfig.EMAIL }} - name: API_URL value: {{ .Values.app.backend_url }} ports: diff --git a/terminfinder-chart/values.yaml b/terminfinder-chart/values.yaml index b0ba66d..53baa6b 100644 --- a/terminfinder-chart/values.yaml +++ b/terminfinder-chart/values.yaml @@ -1,4 +1,4 @@ -terminfinder-frontend-oss: +terminfinder-frontend: # Default values for terminfinder-frontend. # This is a YAML-formatted file. # Declare variables to be passed into your templates. @@ -14,12 +14,6 @@ terminfinder-frontend-oss: replicaCount: 1 # Not HA for now! - image: - repository: registry.opencode.de/dataport/terminfinder/terminfinder-frontend - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - imagePullSecrets: [ ] nameOverride: "" fullnameOverride: "" @@ -96,19 +90,13 @@ terminfinder-frontend-oss: affinity: { } -terminfinder-backend-oss: +terminfinder-backend: # Default values for terminfinder-backend. # This is a YAML-formatted file. # Declare variables to be passed into your templates. replicaCount: 1 - image: - repository: registry.opencode.de/dataport/terminfinder/terminfinder-backend - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - imagePullSecrets: [ ] nameOverride: "" fullnameOverride: "" @@ -212,7 +200,7 @@ terminfinder-backend-oss: cpu: 250m containerSecurityContext: - enabled: true + enabled: false runAsUser: 1001 runAsGroup: 1001 allowPrivilegeEscalation: false @@ -224,12 +212,12 @@ terminfinder-backend-oss: primary: ## Enable security context with non-root user podSecurityContext: - enabled: true + enabled: false runAsUser: 1001 runAsGroup: 1001 fsGroup: 1001 containerSecurityContext: - enabled: true + enabled: false runAsUser: 1001 runAsGroup: 1001 allowPrivilegeEscalation: false