Skip to content

Commit

Permalink
installed status
Browse files Browse the repository at this point in the history
  • Loading branch information
kuritka committed Feb 20, 2025
1 parent 88afc5c commit f22504b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/terratest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ jobs:
kubectl get no -owide --context=k3d-test-gslb1
echo "Cluster 2 (us):"
kubectl get no -owide --context=k3d-test-gslb2
sleep 10
kubectl -n k8gb get pods --context=k3d-test-gslb1
kubectl -n k8gb get pods --context=k3d-test-gslb2
kubectl -n k8gb get deployment k8gb -oyaml --context=k3d-test-gslb1
kubectl -n k8gb get deployment k8gb -oyaml --context=k3d-test-gslb2
- name: Run Terratest
run: |
Expand Down
56 changes: 56 additions & 0 deletions taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# https://taskfile.dev/usage/
version: '3'
env:
VERSION: test010

tasks:

start-*:
vars:
CLUSTER: '{{index .MATCH 0}}'
cmds:
- echo "starting $CLUSTER"
- kubectl -n k8gb scale deployment k8gb --replicas=1 --context=$CLUSTER
description: "k3d-test-gslb2 = us, k3d-test-gslb1 = eu"

stop-*:
vars:
CLUSTER: '{{index .MATCH 0}}'
cmds:
- echo "stopping $CLUSTER"
- kubectl -n k8gb scale deployment k8gb --replicas=0 --context=$CLUSTER
description: "k3d-test-gslb2 = us, k3d-test-gslb1 = eu"

install:
cmds:
- defer: { task: us}
- echo "Installing current k8gb $VERSION"
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w -X main.version=$VERSION -X main.commit=123" -o ./k8gb main.go
- docker build . -t docker.io/kuritka/k8gb:$VERSION
- k3d image import docker.io/kuritka/k8gb:$VERSION -c test-gslb1
- k3d image import docker.io/kuritka/k8gb:$VERSION -c test-gslb2
- task: stop
- kubectl -n k8gb set image deployment/k8gb k8gb=kuritka/k8gb:$VERSION --context=k3d-test-gslb2
- kubectl -n k8gb set image deployment/k8gb k8gb=kuritka/k8gb:$VERSION --context=k3d-test-gslb1
- task: start-eu
silent: true

stop:
cmds:
- task: stop-k3d-test-gslb1
- task: stop-k3d-test-gslb2

start-us:
cmds:
- task: start-k3d-test-gslb2

start-eu:
cmds:
- task: start-k3d-test-gslb2

us:
cmds:
- kubectl config use-context k3d-test-gslb2
eu:
cmds:
- kubectl config use-context k3d-test-gslb1

0 comments on commit f22504b

Please sign in to comment.