diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..bd8c76607784cf40078708da7f34a4d26235cec1 --- /dev/null +++ b/.gitlab/.gitlab-ci.yml @@ -0,0 +1,26 @@ +docker-build: + # Use the official docker image. + image: docker:cli + stage: build + services: + - docker:dind + variables: + DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + DOCKER_TLS_CERTDIR: "" + GIT_SUBMODULE_STRATEGY: recursive + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + # All branches are tagged with $DOCKER_IMAGE_NAME (defaults to commit ref slug) + # release branch is also tagged with `latest` + script: + - docker build --pull -t "$DOCKER_IMAGE_NAME" . + - docker push "$DOCKER_IMAGE_NAME" + - | + if [[ "$CI_COMMIT_BRANCH" == "release" ]]; then + docker tag "$DOCKER_IMAGE_NAME" "$CI_REGISTRY_IMAGE:latest" + docker push "$CI_REGISTRY_IMAGE:latest" + fi + rules: + - if: $CI_COMMIT_BRANCH == "release" + exists: + - Dockerfile diff --git a/helm/superset/values.yaml b/helm/superset/values.yaml index 8a494c0ce2d859da39f95948f375d4cfb84e4a79..de937647b2716eece7771587bc3414f26c11047e 100644 --- a/helm/superset/values.yaml +++ b/helm/superset/values.yaml @@ -666,7 +666,7 @@ supersetCeleryFlower: supersetWebsockets: # -- This is only required if you intend to use `GLOBAL_ASYNC_QUERIES` in `ws` mode # see https://github.com/apache/superset/blob/master/CONTRIBUTING.md#async-chart-queries - enabled: false + enabled: true replicaCount: 1 # -- Sets the [pod disruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) for supersetWebsockets pods podDisruptionBudget: @@ -944,9 +944,13 @@ redis: superset-mitm-service: enabled: true + connections: + origin: '{{ template "superset.fullname" . }}-worker:{{ .Values.service.port }}' # "maed-exporter-frontend-svc.mdata.svc.cluster.local" + mitmDB: mitm_database_password: "supersaferandommitmdbpasswordwillneverbeguessed" + service: port: "8180" diff --git a/justfile b/justfile index fd99d8d8716ee10bafe9ced43043cfb31b3d169b..b88114cb5a352ff605eea7e49ec4775453d9b529 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,10 @@ set windows-shell := ["pwsh", "-c"] +import "kube.just" + +_default: + @just --list + up: docker compose up --build diff --git a/kube.just b/kube.just new file mode 100644 index 0000000000000000000000000000000000000000..27e721b7995d8d745ded766fd89896c7c17c2e34 --- /dev/null +++ b/kube.just @@ -0,0 +1,41 @@ +CHART_NAME := "mitm-superset" +CHART_FOLDER := "superset" + +helm-package: + cd helm/ && helm package {{CHART_NAME}} + +helm-push a: helm-package + # helm registry login registry-1.docker.io -u leahtgu + cd helm/ && helm push {{a}} oci://registry-1.docker.io/leahtgu + +helm *args: + helm --kube-context c4c -n mdata {{args}} + +helm-install: + helm --kube-context c4c -n mdata install {{CHART_NAME}} helm/{{CHART_FOLDER}} + +helm-install-dry: + helm --kube-context c4c -n mdata install {{CHART_NAME}} helm/{{CHART_FOLDER}} --dry-run > dryrun.yaml + +helm-uninstall: + helm --kube-context c4c -n mdata uninstall {{CHART_NAME}} + +kube-forward: + #! powershell + $POD_NAME = kubectl --context=c4c get pods --namespace mdata -l "app.kubernetes.io/name={{CHART_NAME}},app.kubernetes.io/instance={{CHART_NAME}}" -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}} + +kubeinto svc="{{CHART_NAME}}" inst="{{CHART_NAME}}": + #! powershell + $POD_NAME = kubectl --context=c4c get pods --namespace mdata -l "app.kubernetes.io/name={{svc}},app.kubernetes.io/instance={{inst}}" -o jsonpath="{.items[0].metadata.name}" + kubectl --context=c4c --namespace mdata exec --stdin --tty $POD_NAME -- /bin/bash + +kubelogs svc="{{CHART_NAME}}": + #! powershell + $POD_NAME = kubectl --context=c4c get pods --namespace mdata -l "app.kubernetes.io/name={{svc}},app.kubernetes.io/instance={{CHART_NAME}}" -o jsonpath="{.items[0].metadata.name}" + kubectl --context=c4c --namespace mdata logs $POD_NAME