-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
88 lines (71 loc) · 3.05 KB
/
Makefile
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
K8S_VERSION = 1.25
ISTIO_VERSION ?= "1.17.0"
ISTIO_SHORT_VERSION = "$(shell echo $(ISTIO_VERSION) | grep -oE '[0-9]\.[0-9]+')"
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
ISTIOCTL ?= $(LOCALBIN)/istioctl
KIND ?= $(LOCALBIN)/kind
TANKA ?= $(LOCALBIN)/tk
JB ?= $(LOCALBIN)/jb
# Install kind
.PHONY: kind
kind: $(KIND)
$(KIND): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install sigs.k8s.io/[email protected]
# Install istioctl
.PHONY: istioctl
istioctl: $(ISTIOCTL)
$(ISTIOCTL): $(LOCALBIN)
cd $(LOCALBIN) && curl -sL https://istio.io/downloadIstio | ISTIO_VERSION=$(ISTIO_VERSION) TARGET_ARCH=x86_64 sh -
mv $(LOCALBIN)/istio-$(ISTIO_VERSION)/bin/istioctl $(LOCALBIN)
rm -rf $(LOCALBIN)/istio-$(ISTIO_VERSION)
# Install tanka
.PHONY: tanka
tanka: $(TANKA)
$(TANKA): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/grafana/tanka/cmd/tk@latest
# Install jb
.PHONY: jb
jb: $(JB)
$(JB): $(LOCALBIN)
GOBIN=$(LOCALBIN) go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
# Start kind cluster
.PHONY: start-kind
start-kind: kind
echo "Starting KIND cluster..."
$(KIND) create cluster --config config/kind.yaml 2>&1 | grep -v "already exists" || true
kubectl wait --timeout=5m --for=condition=available deployment/coredns -n kube-system
# Ingress Controller
kubectl create -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.1/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
--for=condition=ready pod \
--selector=app.kubernetes.io/component=controller \
--timeout=90s
# Load balancer
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml
kubectl wait --namespace metallb-system --for=condition=ready pod --selector=app=metallb --timeout=90s
kubectl apply -f https://kind.sigs.k8s.io/examples/loadbalancer/metallb-config.yaml
.PHONY: install-istio
deploy-istio: istioctl
$(ISTIOCTL) install --set profile=demo -y --set meshConfig.defaultConfig.tracing.zipkin.address=distributor.tempo.svc.cluster.local:9411
.PHONY: deploy-kiali
deploy-kiali:
kubectl apply -f config/kiali.yaml
.PHONY: deploy-prometheus
deploy-prometheus:
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-$(ISTIO_SHORT_VERSION)/samples/addons/prometheus.yaml
.PHONY: deploy-tempo
deploy-tempo: tanka jb
kubectl create namespace tempo 2>&1 | grep -v "already exists" || true
kubectl apply -f ./config/minio.yaml -n tempo
PATH=$(PATH):$(LOCALBIN) ./hack/install-tempo.sh
cd tempo && echo yes | $(TANKA) apply environments/tempo/main.jsonnet
kubectl create -f config/ingress.yaml
.PHONY: deploy-bookinfo
deploy-bookinfo:
kubectl label namespace default istio-injection=enabled
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-${ISTIO_SHORT_VERSION}/samples/bookinfo/platform/kube/bookinfo.yaml
kubectl apply -f https://raw.githubusercontent.com/istio/istio/release-1.17/samples/bookinfo/networking/bookinfo-gateway.yaml
.PHONY: deploy-all
deploy-all: start-kind deploy-istio deploy-bookinfo deploy-prometheus deploy-tempo deploy-kiali