2020-06-16 16:39:11 -05:00
all :
@echo "Usage:"
@echo " make create-cluster"
@echo " make deploy"
2020-06-12 13:12:59 -05:00
# create kind cluster with nginx-ingress as the most popular ingress controller for K8S
.PHONY : deploy
create-cluster :
kind create cluster --name oauth2-proxy --config kind-cluster.yaml
make setup-dns
make setup-ingress
.PHONY : setup -ingress
setup-ingress :
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
2020-06-16 16:39:11 -05:00
kubectl --namespace ingress-nginx rollout status --timeout 5m deployment/ingress-nginx-controller
2020-06-12 13:12:59 -05:00
2020-06-16 16:39:11 -05:00
# default Pod CIDR is 10.244.0.0/16 https://github.com/kubernetes-sigs/kind/blob/a6e8108025bc7a9440beedb8ef7714aec84fe87e/pkg/apis/config/v1alpha4/default.go#L52
2020-06-12 13:12:59 -05:00
# what makes cluster host IP equal to 10.244.0.1
# thus we add dex.localtest.me and oauth2-proxy.localtest.me stub hosts pointing to this IP
# NOT NEEDED IN REAL LIFE!
.PHONY : setup -dns
setup-dns :
kubectl apply -f custom-dns.yaml
kubectl -n kube-system rollout restart deployment/coredns
2020-06-16 16:39:11 -05:00
kubectl -n kube-system rollout status --timeout 5m deployment/coredns
2020-06-12 13:12:59 -05:00
2020-06-16 16:39:11 -05:00
.PHONY : delete -cluster
2020-06-12 13:12:59 -05:00
delete-cluster :
kind delete cluster --name oauth2-proxy
2020-06-16 16:39:11 -05:00
.PHONY : deploy
deploy :
kubectl apply -f oauth2-proxy-example-full.yaml
kubectl rollout status --timeout 5m deployment/oauth2-proxy-example-oauth2-proxy-sample
kubectl rollout status --timeout 1m deployment/oauth2-proxy-example-httpbin
kubectl rollout status --timeout 1m deployment/oauth2-proxy-example-hello-world
2020-06-12 13:12:59 -05:00
.PHONY : undeploy
undeploy :
2020-06-16 16:39:11 -05:00
kubectl delete -f oauth2-proxy-example-full.yaml
######################
###### HELM CMDs #####
######################
.PHONY : helm -init
helm-init :
helm dep update
2020-06-12 13:12:59 -05:00
# unpacking is useful to be able to explore underlying helm charts
.PHONY : helm -unpack
helm-unpack :
cd charts; for f in *.tgz; do tar -zxf " $$ f " ; done
2020-06-16 16:39:11 -05:00
.PHONY : helm -deploy
helm-deploy : helm -init
helm upgrade --wait --debug --install --render-subchart-notes oauth2-proxy-example .
.PHONY : helm -undeploy
helm-undeploy :
helm del oauth2-proxy-example
# creates K8S manifest from helm chart
.PHONY : helm -create -manifest
2020-06-16 16:59:56 -05:00
helm-create-manifest : helm -init
2020-06-19 22:33:40 -05:00
echo "# WARNING: This file is auto-generated by 'make helm-create-manifest'! DO NOT EDIT MANUALLY!" > oauth2-proxy-example-full.yaml
2020-06-19 22:27:36 -05:00
helm template --namespace default oauth2-proxy-example . >> oauth2-proxy-example-full.yaml