2018-12-12 18:18:00 +01:00
|
|
|
JSONNET_FMT := jsonnet fmt -n 2 --max-blank-lines 2 --string-style s --comment-style s
|
|
|
|
|
2019-09-11 23:50:37 +02:00
|
|
|
GOPATH ?= `$(pwd)`
|
|
|
|
|
2019-03-13 23:27:20 +01:00
|
|
|
JSONNET_BIN := $(GOPATH)/bin/jsonnet
|
|
|
|
JB_BINARY := $(GOPATH)/bin/jb
|
2018-12-12 18:18:00 +01:00
|
|
|
|
|
|
|
.PHONY: generate vendor fmt manifests
|
|
|
|
|
2019-03-13 22:04:19 +01:00
|
|
|
all: manifests
|
2018-12-12 18:18:00 +01:00
|
|
|
|
2019-03-25 14:08:16 +01:00
|
|
|
manifests: jsonnet
|
2018-12-12 18:18:00 +01:00
|
|
|
rm -rf manifests
|
2019-03-13 23:27:20 +01:00
|
|
|
./scripts/build.sh main.jsonnet $(JSONNET_BIN)
|
2018-12-12 18:18:00 +01:00
|
|
|
|
2019-03-26 00:08:54 +01:00
|
|
|
update: jsonnet_bundler
|
2018-12-12 18:18:00 +01:00
|
|
|
jb update
|
|
|
|
|
2019-03-13 22:04:19 +01:00
|
|
|
vendor: jsonnet_bundler jsonnetfile.json jsonnetfile.lock.json
|
2018-12-12 18:18:00 +01:00
|
|
|
rm -rf vendor
|
|
|
|
$(JB_BINARY) install
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
find . -name 'vendor' -prune -o -name '*.libsonnet' -o -name '*.jsonnet' -print | xargs -n 1 -- $(JSONNET_FMT) -i
|
|
|
|
|
2019-03-13 22:04:19 +01:00
|
|
|
deploy: manifests
|
2018-12-12 18:18:00 +01:00
|
|
|
kubectl apply -f ./manifests/
|
|
|
|
echo "Will wait 40 seconds to reapply manifests"
|
|
|
|
sleep 40
|
|
|
|
kubectl apply -f ./manifests/
|
|
|
|
|
|
|
|
teardown:
|
|
|
|
kubectl delete -f ./manifests/
|
|
|
|
|
|
|
|
tar: manifests
|
|
|
|
rm -rf manifests.tar
|
|
|
|
tar -cf manifests.tar manifests
|
|
|
|
|
2019-03-13 22:04:19 +01:00
|
|
|
jsonnet_bundler:
|
|
|
|
ifeq (, $(shell which jb))
|
|
|
|
@echo "Installing jsonnet-bundler"
|
|
|
|
@go get -u github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
|
|
|
|
endif
|
|
|
|
|
|
|
|
jsonnet:
|
|
|
|
ifeq (, $(shell which jsonnet))
|
|
|
|
@echo "Installing jsonnet"
|
2019-05-25 03:57:48 +02:00
|
|
|
@go get github.com/google/go-jsonnet/cmd/jsonnet
|
2019-03-13 22:04:19 +01:00
|
|
|
@go get github.com/brancz/gojsontoyaml
|
2019-05-25 03:57:48 +02:00
|
|
|
endif
|
2019-08-22 00:13:13 +02:00
|
|
|
|
|
|
|
change_suffix:
|
2020-03-18 15:13:47 +01:00
|
|
|
@perl -p -i -e 's/^(\s*)\-\ host:.*/\1- host: alertmanager.${IP}.nip.io/g' manifests/ingress-alertmanager.yaml manifests/ingress-prometheus.yaml manifests/ingress-grafana.yaml
|
2019-08-22 00:13:13 +02:00
|
|
|
@echo "Ingress IPs changed to [service].${IP}.nip.io"
|
2020-03-18 15:13:47 +01:00
|
|
|
${K3S} kubectl apply -f manifests/ingress-alertmanager.yaml
|
2019-08-22 00:13:13 +02:00
|
|
|
${K3S} kubectl apply -f manifests/ingress-grafana.yaml
|
|
|
|
${K3S} kubectl apply -f manifests/ingress-prometheus-k8s.yaml
|