-
-
Notifications
You must be signed in to change notification settings - Fork 366
94 lines (91 loc) · 3.65 KB
/
minikube-k8s-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This is a basic workflow to help you get started with Actions
name: Test minikube script (k8s)
# Controls when the workflow will run
on:
push:
branches:
- master
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test-minikube:
name: Test with minikube
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
- name: Start minikube
uses: medyagh/setup-minikube@master
with:
minikube-version: 1.33.1
driver: docker
kubernetes-version: v1.30.0
- name: test script
run: |
kubectl apply -f k8s/workspace-psa.yml
echo "Setting up the bitnami sealed secret controler"
kubectl apply -f https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.27.0/controller.yaml
kubectl apply -f k8s/sealed-secret-controller.yaml
kubectl apply -f k8s/main.key
kubectl delete pod -n kube-system -l name=sealed-secrets-controller
kubectl create -f k8s/sealed-challenge48.json
echo "finishing up the sealed secret controler part"
kubectl apply -f k8s/secrets-config.yml
kubectl apply -f k8s/secrets-secret.yml
kubectl apply -f k8s/challenge33.yml
kubectl apply -f k8s/secret-challenge-deployment.yml
golivecounter=0
while [[ $(kubectl get pods -l app=secret-challenge -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]];
do
echo "waiting for secret-challenge" && sleep 2
((golivecounter+=1))
if [ $((golivecounter % 10)) -eq 0 ]; then
kubectl describe deployment secret-challenge
else
echo "waiting for secret-challenge, step $golivecounter"s
fi
if [ $((golivecounter % 15)) -eq 0 ]; then
kubectl describe pod -l app=secret-challenge
else
echo "waiting for secret-challenge, step $golivecounter"
fi
done
kubectl logs -l app=secret-challenge -f >> pod.log &
kubectl expose deployment secret-challenge --type=LoadBalancer --port=8080
kubectl port-forward \
$(kubectl get pod -l app=secret-challenge -o jsonpath="{.items[0].metadata.name}") \
8080:8080 \
&
echo "Do minikube delete to stop minikube from running and cleanup to start fresh again"
echo "wait 20 seconds so we can check if vault-k8s-container works"
sleep 20
if curl http://localhost:8080/spoil/challenge-5 -s | grep -q spoiler-answer
then
echo "spoil-challenge-5 works"
else
echo "error in spoil-challenge-5"
fi
if curl http://localhost:8080/spoil/challenge-6 -s | grep -q spoiler-answer
then
echo "spoil-challenge-6 works"
else
echo "error in spoil-challenge-6"
fi
if curl http://localhost:8080/spoil/challenge-7 -s | grep -q spoiler-answer
then
echo "spoil-challenge-7 works"
else
echo "error in spoil-challenge-7"
fi
if curl http://localhost:8080/spoil/challenge-33 -s | grep -q spoiler-answer
then
echo "spoil-challenge-33 works"
else
echo "error in spoil-challenge-33"
fi
echo "logs from pod to make sure:"
cat pod.log