1+ # Copyright (c) HashiCorp, Inc.
2+ # SPDX-License-Identifier: MPL-2.0
3+
14set shell := [" bash" , " -c" ]
25set positional-arguments
6+ alias test-docker := test
37
48default : all
59all : version build deploy-k8s status test clean
10+ test-tutorial-path : version build deploy-image-from-github status clean
611clean -all: clean
712
813[group (' k8s' )]
@@ -29,6 +34,18 @@ deploy-k8s:
2934
3035 echo " kubectl port-forward pod/vault-client 8080:8080"
3136
37+ [group (' k8s' )]
38+ deploy-image-from-github : clean
39+ @ echo " >> running $0"
40+ ./ vault-setup.sh
41+ docker pull ghcr.io/ hashicorp-education/ learn-vault-golang-sdk/ vault-sdk-go-app:latest
42+ kubectl get secret vault-auth-secret -o json | jq -r " .data.token" | base64 --decode > token
43+ minikube image load ghcr.io/ hashicorp-education/ learn-vault-golang-sdk/ vault-sdk-go-app:latest
44+ sleep 5
45+ kubectl apply -f manifests/ go-app.yaml
46+
47+ echo " kubectl port-forward pod/vault-client 8080:8080"
48+
3249[group (' k8s' )]
3350status :
3451 @ echo " >> running $0"
@@ -37,26 +54,19 @@ status:
3754[group (' exe' )]
3855test :
3956 @ echo " >> running $0"
40- go run main.go
41-
42- [group (' docker' )]
43- test-docker :
44- @ echo " >> running $0"
45- docker run -d --name vault-sdk-go-app --publish 8080 :8080 ghcr.io/ hashicorp-education/ learn-vault-golang-sdk/ vault-sdk-go-app:latest
46-
57+ curl http:// localhost:8080
4758
4859[group (' k8s' )]
4960test-k8s :
5061 @ echo " >> running $0"
51- kubectl apply -f k8s-auth/ go-app.yaml
52- echo " kubectl port-forward pod/vault-client 8080:8080"
62+ kubectl exec -it vault-client -- curl http:// localhost:8080
5363
5464[group (' k8s' )]
5565clean :
5666 @ echo " >> running $0"
57- kubectl delete -f go-app.yaml || true
58- kubectl delete -f vault-auth-service-account.yaml || true
59- kubectl delete -f vault-auth-secret.yaml || true
67+ kubectl delete -f manifests / go-app.yaml || true
68+ kubectl delete -f manifests / vault-auth-service-account.yaml || true
69+ kubectl delete -f manifests / vault-auth-secret.yaml || true
6070 minikube image rm ghcr.io/ hashicorp-education/ learn-vault-golang-sdk/ vault-sdk-go-app:latest || true
6171 docker stop $(docker ps -aq --filter name=reference=ghcr.io/ hashicorp-education/ learn-vault-golang-sdk/ vault-sdk-go-app) || true
6272 docker image rm $(docker image ls --filter " reference=ghcr.io/hashicorp-education/learn-vault-golang-sdk/vault-sdk-go-app" --format {{" {{ .ID}} /" }}) || true
0 commit comments