-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
34 lines (25 loc) · 1.02 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
.PHONY: docker
BINARY=istio-discovery
DOCKER_REPO=tufin
IMAGE=$(DOCKER_REPO)/istio-discovery
clean:
rm $(BINARY)
build:
GOOS=linux GOARCH=amd64 go build -o .dist/$(BINARY)
test:
go test `go list ./...`
docker:
docker build --build-arg=binary=$(BINARY) -t $(IMAGE) -f docker/Dockerfile .dist
deploy:
echo "$(DOCKER_PASS)" | docker login -u $(DOCKER_USER) --password-stdin
docker push $(IMAGE)
install:
$(eval DNS_DEPLOYMENT=$(shell kubectl get deploy -n kube-system -l k8s-app=kube-dns -o=custom-columns=NAME:.metadata.name | tail -n1 2>/dev/null))
@if [ -z $(DNS_DEPLOYMENT) ]; then\
echo "could not detect DNS deployment for K8s cluster. Can not install istio-discovery";\
exit 1;\
fi
@echo patching "$(DNS_DEPLOYMENT)"
@kubectl patch deploy -n kube-system $(DNS_DEPLOYMENT) -p "`<kubernetes/deploy_patch.yaml`"
@kubectl patch svc -n kube-system kube-dns -p "`<kubernetes/service_patch.yaml`"
@kubectl patch clusterrole system:$(DNS_DEPLOYMENT) -p "`sed "s/#DEPLOYMENT#/$(DNS_DEPLOYMENT)/g" kubernetes/clusterrole.yaml`"