-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (42 loc) · 1.25 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
# Set the shell to bash always
SHELL := /bin/bash
# Look for a .env file, and if present, set make variables from it.
ifneq (,$(wildcard ./.env))
include .env
export $(shell sed 's/=.*//' .env)
endif
KIND_CLUSTER_NAME ?= local-dev
KUBECONFIG ?= $(HOME)/.kube/config
VERSION := $(shell git describe --always --tags | sed 's/-/./2' | sed 's/-/./2')
ifndef VERSION
VERSION := 0.0.0
endif
# Tools
KIND=$(shell which kind)
LINT=$(shell which golangci-lint)
KUBECTL=$(shell which kubectl)
SED=$(shell which sed)
.DEFAULT_GOAL := help
.PHONY: tidy
tidy: ## go mod tidy
go mod tidy
.PHONY: generate
generate: tidy ## generate all CRDs
go generate ./...
.PHONY: test
test: ## go test
go test -v ./...
.PHONY: lint
lint: ## go lint
$(LINT) run
.PHONY: kind-up
kind-up: ## starts a KinD cluster for local development
@$(KIND) get kubeconfig --name $(KIND_CLUSTER_NAME) >/dev/null 2>&1 || $(KIND) create cluster --name=$(KIND_CLUSTER_NAME)
.PHONY: kind-down
kind-down: ## shuts down the KinD cluster
@$(KIND) delete cluster --name=$(KIND_CLUSTER_NAME)
dev:
go run main.go -debug -kubeconfig $(HOME)/.kube/config
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' ./Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'