From 2785d782bac7ee5101a8dfbc5f97869281370b7a Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 21 May 2024 21:15:37 +0700 Subject: [PATCH] feat(ci): Get full cluster info and simplify docs pod deployment/teardown --- catalyst-gateway/event-db/Earthfile | 19 ++++++++++++++++++- docs/Earthfile | 1 + utilities/local-cluster/Earthfile | 24 +++++++++++++++--------- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/catalyst-gateway/event-db/Earthfile b/catalyst-gateway/event-db/Earthfile index 0295a24ca3..a01e6ae013 100644 --- a/catalyst-gateway/event-db/Earthfile +++ b/catalyst-gateway/event-db/Earthfile @@ -23,7 +23,24 @@ build: FROM +builder DO postgresql-ci+BUILD --image_name=event-db - DO postgresql-ci+DOCS --image_name=event-db + DO postgresql-ci+DOCS + +# local : Make a locally runable container that can serve the db. +# --push will cause this image to be pushed to the local development cluster +# --local_registry : Set this to the hostname of your local registry or "" to inhibit. +local: + # Change this to point to another local registry, OR set to "" to disable + # pushing to a local registry even if `--push` is passed. + # this should be "registry.cluster.test:5000" but Earthly can not reliably locate it in a hosts file. + ARG local_registry="192.168.58.10:5000" + + FROM +build + + # Publish to the local development cluster + IF [ "$local_registry" != "" ] + SAVE IMAGE --push --insecure $local_registry/event-db:latest + END + # test the event db database schema # CI target : true diff --git a/docs/Earthfile b/docs/Earthfile index 53892cf6df..6934f348da 100644 --- a/docs/Earthfile +++ b/docs/Earthfile @@ -34,6 +34,7 @@ docs: local: # Change this to point to another local registry, OR set to "" to disable # pushing to a local registry even if `--push` is passed. + # this should be "registry.cluster.test:5000" but Earthly can not reliably locate it in a hosts file. ARG local_registry="192.168.58.10:5000" # Build a self contained service to show built docs locally. DO docs-ci+PACKAGE diff --git a/utilities/local-cluster/Earthfile b/utilities/local-cluster/Earthfile index 6eeea8a8df..3122c88dde 100644 --- a/utilities/local-cluster/Earthfile +++ b/utilities/local-cluster/Earthfile @@ -42,21 +42,27 @@ kubernetes-base: deploy-docs: FROM +kubernetes-base - RUN kubectl apply -f manifests/docs.yml + RUN kubectl create namespace cat-voices || true + RUN kubectl apply -f manifests/cat-voices-docs.yml # test target to stop the local documentation stop-docs: FROM +kubernetes-base - RUN kubectl delete deployment cat-gateway-docs - RUN kubectl delete service cat-gateway-docs + RUN kubectl delete ingress cat-gateway-docs -n cat-voices || true + RUN kubectl delete deployment cat-gateway-docs -n cat-voices || true + RUN kubectl delete service cat-gateway-docs -n cat-voices || true # show-info : list important info about the running cluster show-info: FROM +kubernetes-base - - # RUN kubectl --kubeconfig shared/k3s.yaml -o wide get nodes - RUN --no-cache kubectl -n kube-system get all - RUN --no-cache kubectl -o wide get nodes - RUN --no-cache kubectl -o wide get pods - RUN --no-cache kubectl -o wide get service + ARG local_file="" + + # Get everything from all namespaces + RUN --no-cache kubectl -o wide get all --all-namespaces > cluster.info + + IF [ "$local_file" == "" ] + RUN cat cluster.info + ELSE + SAVE ARTIFACT cluster.info AS LOCAL "$local_file" + END