Skip to content

Commit

Permalink
feat: cleanup, fix postgres connection
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove or disable cluster specific resources
  • Loading branch information
tjorbo committed Jul 2, 2024
1 parent 05b7208 commit 6e9fb23
Show file tree
Hide file tree
Showing 37 changed files with 66 additions and 223 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
terminfinder-chart/Chart.lock
42 changes: 22 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -38,29 +29,40 @@ 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:
$ kubectl create ns terminfinder-demo

# First installing the helm chart, to the name
$ helm install terminfinder-backend ./charts/terminfinder-backend -n terminfinder-demo -f demo-backend.values.yaml

# Second installing the helm chart of the frontend
$ helm install terminfinder-frontend ./charts/terminfinder-frontend -n terminfinder-demo -f demo-frontend.values.yaml
$ 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
```

Your can upgrade the helm chart as usually with `helm upgrade ...` command.
## 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
$ helm uninstall terminfinder-demo -n terminfinder-demo
```

### Using an own PostgreSQL DB instance

Expand Down
58 changes: 0 additions & 58 deletions demo-backend.values.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions demo-frontend.values.yaml

This file was deleted.

Binary file not shown.
9 changes: 0 additions & 9 deletions terminfinder-chart/charts/frontend/templates/configMap.yml

This file was deleted.

11 changes: 0 additions & 11 deletions terminfinder-chart/charts/resources/templates/postgresql.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions terminfinder-chart/charts/resources/values.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ dependencies:
version: 12.1.2
- name: common
repository: https://charts.bitnami.com/bitnami
version: 2.2.4
digest: sha256:55f16e9b5bade9e719e7e6673b24d182e9316e8669820cdc68b4c37f518c3e5b
generated: "2023-03-23T11:14:06.498295+01:00"
version: 2.20.3
digest: sha256:8fccf7c770b0e1a7a1f64fcd77a3afede13a967fe7c182ebbfe2d21f9cfed0b7
generated: "2024-07-01T16:33:04.750757+02:00"
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -41,7 +41,7 @@ spec:
- 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
Expand All @@ -50,7 +50,7 @@ spec:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.global.postgresql.auth.existingSecret | default (printf "%s-postgresql" (include "common.names.fullname" .)) }}
name: {{ .Values.global.postgresql.auth.existingSecret | default (printf "%s-postgresql" (include "common.names.namespace" .)) }}
key: {{ .Values.global.postgresql.auth.secretKeys.userPasswordKey | default "password" }}
# Patches
- name: Terminfinder__UseHttps
Expand All @@ -60,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ global:
database: terminfinder
existingSecret: "" # if not set, default: "{{ Release.Name }}-postgres"
secretKeys:
userPasswordKey: "terminfinder"

userPasswordKey: "password"
service:
name: "" # if not set, default: "{{ Release.Name }}-postgres"
ports:
Expand Down Expand Up @@ -105,13 +104,6 @@ postgresql:
serviceAccount:
create: true

image:
registry: docker.io # Notice, may this is not allowed
repository: mxzinke/postgresql-rootless # This is an special image, which is based on bitnami/postgresql
tag: 15
pullPolicy: IfNotPresent
pullSecrets: [ ]

## Set permissions for the data volume
## Only needed when volume has not correct permissions
volumePermissions:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{{- if .Values.grafana.enabled -}}
apiVersion: monitoring.grafana.com/v1alpha1
kind: LogsInstance
metadata:
name: {{ include "terminfinder-resources.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
clients:
- url: {{.Values.loki.endpoint}}
tenantId: {{.Values.loki.tenantId}}
- url: {{.Values.grafana.loki.endpoint}}
tenantId: {{.Values.grafana.loki.tenantId}}
podLogsSelector:
matchLabels:
{{- include "terminfinder-resources.labels" . | nindent 6 }}
Expand All @@ -24,3 +25,4 @@ spec:
- cri: {}
selector:
matchLabels: {}
{{- end }}
8 changes: 8 additions & 0 deletions terminfinder-chart/charts/terminfinder-resources/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
grafana:
loki:
endpoint: http://loki-gateway.logging-system.svc.cluster.local/loki/api/v1/push
tenantId: 6703bd86-3601-4ea8-96e4-ecff048f1de9
enabled: true

traefik:
enabled: true
Loading

0 comments on commit 6e9fb23

Please sign in to comment.