From 8d75a127c962e87bfcaee05b8b4d78b5ef7e9878 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Apr 2026 12:27:19 -0600 Subject: [PATCH 1/4] Make service names in k8s usable --- src/stack/deploy/k8s/cluster_info.py | 2 +- tests/database/run-test.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stack/deploy/k8s/cluster_info.py b/src/stack/deploy/k8s/cluster_info.py index 338403c..cdce2fb 100644 --- a/src/stack/deploy/k8s/cluster_info.py +++ b/src/stack/deploy/k8s/cluster_info.py @@ -187,7 +187,7 @@ def get_services(self): svc_ports = [client.V1ServicePort(port=p, target_port=p, name=f"{service_name}-{p}") for p in int_ports] service = client.V1Service( metadata=client.V1ObjectMeta( - name=f"{self.app_name}-svc-{service_name}", + name=service_name, labels={"app": self.app_name, "service": service_name}, ), spec=client.V1ServiceSpec( diff --git a/tests/database/run-test.sh b/tests/database/run-test.sh index ace0138..eba5e8b 100755 --- a/tests/database/run-test.sh +++ b/tests/database/run-test.sh @@ -93,8 +93,8 @@ echo "Fetching test stack repo into: $STACK_REPO_BASE_DIR" $TEST_TARGET_STACK fetch repo github.com/bozemanpass/stack-test-stacks $TEST_TARGET_STACK prepare --stack ${stack} # Test basic stack deploy to k8s -test_deployment_dir=$STACK_REPO_BASE_DIR/${deployment_dir} -test_deployment_spec=$STACK_REPO_BASE_DIR/${spec_file} +test_deployment_dir=$STACK_TEST_DIR/${deployment_dir} +test_deployment_spec=$STACK_TEST_DIR/${spec_file} $TEST_TARGET_STACK init --stack ${stack} --deploy-to k8s-kind --output $test_deployment_spec # Check the file now exists From f651f780bd0e11f85c7151716f5615e1b2b50dad Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Apr 2026 12:32:35 -0600 Subject: [PATCH 2/4] Update CI job description --- .github/workflows/test-database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-database.yml b/.github/workflows/test-database.yml index c437712..a034d48 100644 --- a/.github/workflows/test-database.yml +++ b/.github/workflows/test-database.yml @@ -14,7 +14,7 @@ on: jobs: test: - name: "Run k8s deploy test suite" + name: "Run database test on k8s" runs-on: ubuntu-24.04 steps: - name: "Clone project repository" From cecc38565b1953998a914cc85d870f14e22ee685 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Apr 2026 13:08:25 -0600 Subject: [PATCH 3/4] Update k8s test --- tests/k8s-deploy/run-deploy-test.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index 8bbecc2..a7f8b75 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -130,8 +130,6 @@ add_todo() { return $rc } -export STACK_USE_BUILTIN_STACK=true - # Test basic stack deploy echo "Running stack deploy test" # Bit of a hack, test the most recent package From 16d6648491600712c062fe1f10df97d2f08b773a Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 7 Apr 2026 14:14:04 -0600 Subject: [PATCH 4/4] Fix k8s test --- src/stack/deploy/k8s/cluster_info.py | 2 +- tests/k8s-deploy/run-deploy-test.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/stack/deploy/k8s/cluster_info.py b/src/stack/deploy/k8s/cluster_info.py index cdce2fb..2776d21 100644 --- a/src/stack/deploy/k8s/cluster_info.py +++ b/src/stack/deploy/k8s/cluster_info.py @@ -148,7 +148,7 @@ def get_ingress(self, use_tls=False, certificate=None, def_cluster_issuer="letse path=path, backend=client.V1IngressBackend( service=client.V1IngressServiceBackend( - name=f"{self.app_name}-svc-{proxy_to_svc}", + name=proxy_to_svc, port=client.V1ServiceBackendPort(number=int(proxy_to_port)), ) ), diff --git a/tests/k8s-deploy/run-deploy-test.sh b/tests/k8s-deploy/run-deploy-test.sh index a7f8b75..a7ef3ad 100755 --- a/tests/k8s-deploy/run-deploy-test.sh +++ b/tests/k8s-deploy/run-deploy-test.sh @@ -22,8 +22,6 @@ delete_cluster_exit () { fi } -trap delete_cluster_exit EXIT - wait_for_pods_started () { for i in {1..50} do @@ -134,14 +132,17 @@ add_todo() { echo "Running stack deploy test" # Bit of a hack, test the most recent package TEST_TARGET_SO=$( ls -t1 ./package/stack* | head -1 ) +# We make a directory within which our test will create files +STACK_TEST_DIR=~/stack-test/k8s-test-dir # Set a non-default repo dir -export STACK_REPO_BASE_DIR=~/stack-test/repo-base-dir +export STACK_REPO_BASE_DIR=${STACK_TEST_DIR}/repo-base-dir echo "Testing this package: $TEST_TARGET_SO" echo "Test version command" reported_version_string=$( $TEST_TARGET_SO version ) echo "Version reported is: ${reported_version_string}" echo "Cloning repositories into: $STACK_REPO_BASE_DIR" -rm -rf $STACK_REPO_BASE_DIR +rm -rf $STACK_TEST_DIR +mkdir -p $STACK_TEST_DIR mkdir -p $STACK_REPO_BASE_DIR # Test bringing the test container up and down # with and without volume removal @@ -152,8 +153,8 @@ $TEST_TARGET_SO fetch repo bozemanpass/example-todo-list $TEST_TARGET_SO prepare --stack $STACK_NAME # Basic test of creating a deployment -test_deployment_dir=$STACK_REPO_BASE_DIR/test-deployment-dir -test_deployment_spec=$STACK_REPO_BASE_DIR/test-deployment-spec.yml +test_deployment_dir=$STACK_TEST_DIR/test-deployment-dir +test_deployment_spec=$STACK_TEST_DIR/test-deployment-spec.yml $TEST_TARGET_SO init --deploy-to k8s-kind \ --stack $STACK_NAME \ --output $test_deployment_spec \