-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (50 loc) · 2.54 KB
/
Makefile
File metadata and controls
64 lines (50 loc) · 2.54 KB
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
KIND_CLUSTER_NAME="cert-checker"
BINDIR ?= $(CURDIR)/bin
TMPDIR ?= $(CURDIR)/tmp
ARCH ?= amd64
help: ## display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
.PHONY: help build image all clean dev
test: ## test cert-checker
go test ./...
dev: ## live reload development
gin --build ./cmd --path . --appPort 8081 --all --immediate --bin tmp/cert-checker run
build: ## build cert-checker
mkdir -p $(BINDIR)
CGO_ENABLED=0 go build -o ./bin/cert-checker ./cmd/.
verify: test build ## tests and builds cert-checker
image: ## build docker image
docker build -t mogensen/cert-checker:v0.0.6 .
clean: ## clean up created files
rm -rf \
$(BINDIR) \
$(TMPDIR)
all: test build docker ## runs test, build and docker
test-coverage: ## Generate test coverage report
mkdir -p $(TMPDIR)
go test ./... --coverprofile $(TMPDIR)/outfile
go tool cover -html=$(TMPDIR)/outfile
report-card: ## Generate static analysis report
goreportcard-cli -v
dev-kind-delete: ## Delete local kubernetes cluster
kind delete clusters $(KIND_CLUSTER_NAME)
dev-kind-create: ## Create local cluster
kind create cluster --name $(KIND_CLUSTER_NAME) --config deploy/kind/kind-cluster-config.yaml || true
kubectl apply --wait -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
sleep 120
helm upgrade --wait --install prometheus prometheus-community/kube-prometheus-stack \
--values deploy/kind/prometheus-stack-values.yaml
dev-kind-install: image ## Install cert-checker on kind cluster
kind --name $(KIND_CLUSTER_NAME) load docker-image mogensen/cert-checker:v0.0.6
kubectl create namespace cert-checker || true
kubectl apply -n cert-checker -f deploy/yaml/deploy.yaml
kubectl apply -n cert-checker -f deploy/yaml/grafana-dashboard-cm.yaml
kubectl apply -n cert-checker -f deploy/yaml/servicemonitor.yaml
kubectl delete pod -l app.kubernetes.io/name=cert-checker -n cert-checker
@echo "---------------------------------------------------------------"
@echo "Prometheus: http://prometheus.localtest.me/graph?g0.expr=cert_checker_is_valid&g0.tab=1&g0.stacked=0&g0.range_input=1h"
@echo "Grafana: http://grafana.localtest.me/d/cert-checker/certificate-checker"
@echo "Dashboard: http://cert-checker.localtest.me/"
@echo "---------------------------------------------------------------"