diff --git a/helm/superset-mitm-service/Chart.lock b/helm/superset-mitm-service/Chart.lock index a1e50591889db5f9ed3964d49f3a0912e63e22b8..d0f0b4b95ab75dc77a03f5b1a3c63f500f4f8bb4 100644 --- a/helm/superset-mitm-service/Chart.lock +++ b/helm/superset-mitm-service/Chart.lock @@ -2,5 +2,5 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 16.5.0 -digest: sha256:5d40b9c5bdd615dc56524d8ee9cba1d2d79ff4c711b44f3c5507e378823f1323 -generated: "2025-03-17T17:12:51.0781795+01:00" +digest: sha256:4d3a7a3e13e6cf1645433630c4c9721164bbebdac49984acf9bb76485eb5b40f +generated: "2025-04-14T12:12:50.190808+02:00" diff --git a/helm/superset-mitm-service/templates/deployment.yaml b/helm/superset-mitm-service/templates/deployment.yaml index 0a964a4a65f0d5f5a79fc552b533bc429a89d912..85b8524afaf04d8fb8d49edbb6791222ddb2f654 100644 --- a/helm/superset-mitm-service/templates/deployment.yaml +++ b/helm/superset-mitm-service/templates/deployment.yaml @@ -32,6 +32,16 @@ spec: securityContext: {{- toYaml . | nindent 8 }} {{- end }} + initContainers: + - name: wait-for-db + image: postgres:17-alpine + command: [ "sh", "-c" ] + args: + - | + until pg_isready -h {{ tpl .Values.mitmDB.mitm_database_host . }} -p {{ .Values.mitmDB.mitm_database_port }}; do + echo "Waiting for postgres DB..."; + sleep 2; + done containers: - name: {{ .Chart.Name }} {{- with .Values.securityContext }} diff --git a/helm/superset-mitm-service/templates/postgresql-auth-secret.yaml b/helm/superset-mitm-service/templates/postgresql-auth-secret.yaml index 5d626584841fc212b9a220e65083cfab0ab23032..f759443abaa472503b11b87e46f620067875c1c5 100644 --- a/helm/superset-mitm-service/templates/postgresql-auth-secret.yaml +++ b/helm/superset-mitm-service/templates/postgresql-auth-secret.yaml @@ -25,9 +25,7 @@ metadata: namespace: {{ .Release.Namespace }} type: Opaque stringData: - postgres-user: {{.Values.mitmDB.mitm_database_user | quote }} + username: {{.Values.mitmDB.mitm_database_user | quote }} + password: {{.Values.mitmDB.mitm_database_password | quote }} postgres-password: {{.Values.mitmDB.mitm_database_password | quote }} - postgres-database: {{.Values.mitmDB.mitm_database_db | quote }} - # POSTGRES_USER: {{.Values.mitmDB.mitm_database_user | quote }} - # POSTGRES_PASSWORD: {{.Values.mitmDB.mitm_database_password | quote }} - # POSTGRES_DATABASE: {{.Values.mitmDB.mitm_database_db | quote }} + database: {{.Values.mitmDB.mitm_database_db | quote }} diff --git a/helm/superset-mitm-service/values.yaml b/helm/superset-mitm-service/values.yaml index ad95f31cf3e0fd34ec313c719ce386706a757359..b13369eadc23c19fec514e169c84f592710f0940 100644 --- a/helm/superset-mitm-service/values.yaml +++ b/helm/superset-mitm-service/values.yaml @@ -165,10 +165,18 @@ mitm-postgresql: # tag: latest-pg16 auth: + username: "mitm-pg-user" + database: "mitm_db" + + # apparently this does *not* override the username and database setting which is annoying existingSecret: '{{ .Values.global.postgresql.configPrefix }}-postgresql-auth-env' + serviceAccount: + automountServiceAccountToken: true primary: + podAnnotations: + sidecar.istio.io/inject: "false" ## ## Persistent Volume Storage configuration. ## ref: https://kubernetes.io/docs/user-guide/persistent-volumes @@ -179,15 +187,15 @@ mitm-postgresql: ## ## Persistent class # storageClass: classname + size: 1Gi ## ## Access modes: accessModes: - ReadWriteOnce ## PostgreSQL port service: - ports: - postgresql: 5432 + postgresql: "5432" # initScripts: # timescaledb: | diff --git a/justfile b/justfile index 5f3fb10ba5c9bdeac375d0347d73d6387bbd8de9..835a43cc921985efc91ea67adecbd618d816e8a7 100644 --- a/justfile +++ b/justfile @@ -24,10 +24,27 @@ down: docker compose down helm-package: - helm package helm/superset-mitm-service helm/ + cd helm/ && helm package superset-mitm-service helm-push a: helm-package # helm registry login registry-1.docker.io -u leahtgu - helm push {{a}} oci://registry-1.docker.io/leahtgu + cd helm/ && helm push {{a}} oci://registry-1.docker.io/leahtgu -kube: +helm-install: + helm --kube-context c4c -n mdata install superset-mitm-service helm/superset-mitm-service + +helm-install-dry: + helm --kube-context c4c -n mdata install superset-mitm-service helm/superset-mitm-service --dry-run > dryrun.yaml + +helm-uninstall: + helm --kube-context c4c -n mdata uninstall superset-mitm-service + +kube-forward: + #! powershell + $POD_NAME = kubectl --context=c4c get pods --namespace mdata -l "app.kubernetes.io/name=superset-mitm-service,app.kubernetes.io/instance=superset-mitm-service" -o jsonpath="{.items[0].metadata.name}" + $CONTAINER_PORT = kubectl --context=c4c get pod --namespace mdata $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}" + Write-Output "Visit http://127.0.0.1:8080 to use your application" + kubectl --context=c4c --namespace mdata port-forward $POD_NAME 8080:$CONTAINER_PORT + +kube *arg: + kubectl --context=c4c -n mdata {{arg}} \ No newline at end of file diff --git a/test/http-client.env.json b/test/http-client.env.json index 5139377f525e03ca026d850a27c154277c327978..6816d229c420f41142d9f5bb2708f55abc883831 100644 --- a/test/http-client.env.json +++ b/test/http-client.env.json @@ -10,5 +10,9 @@ "superset": { "port": "8180", "uuid": "b4004d6a-bcaa-4a48-aa54-271b074109ca" + }, + "kubernetes": { + "port": "8080", + "uuid": "b4004d6a-bcaa-4a48-aa54-271b074109ca" } } \ No newline at end of file diff --git a/test/upload.http b/test/upload.http index 90bb54474792864e7a398d8d0a58ca14f27f3ad3..a1ca8aec6f66577cdd40821e68cc658b060e1f96 100644 --- a/test/upload.http +++ b/test/upload.http @@ -1,3 +1,7 @@ +### + +# @name Upload MAED dataset +# @connection-timeout 180 POST http://localhost:{{port}}/mitm_dataset/upload?dataset_name=myname_0&mitm=MAED Accept: application/json Content-Type: multipart/form-data; boundary=WebAppBoundary @@ -15,6 +19,7 @@ GET http://localhost:{{port}}/mitm_dataset/ ### + POST http://localhost:{{port}}/mitm_dataset/upload?dataset_name=myname_1&mitm=MAED Accept: application/json Content-Type: multipart/form-data; boundary=WebAppBoundary