-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (53 loc) · 1.72 KB
/
Makefile
File metadata and controls
71 lines (53 loc) · 1.72 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
65
66
67
68
69
70
71
PKG = $(shell cat go.mod | grep "^module " | sed -e "s/module //g")
VERSION = $(shell cat internal/version/version)
COMMIT_SHA ?= $(shell git describe --always)
TAG ?= $(VERSION)
GOBIN ?= ./bin
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
PUSH ?= true
REPO = octohelm/kube-agent
NAMESPACES ?= docker.io/octohelm
TARGETS ?= kube-agent kube-agent-gateway
KUBECONFIG = ~/.kube/config
DOCKER_BUILDX_BUILD = docker buildx build \
--label=org.opencontainers.image.source=https://github.com/$(REPO) \
--label=org.opencontainers.image.revision=$(COMMIT_SHA) \
--platform=linux/arm64,linux/amd64
ifeq ($(PUSH),true)
DOCKER_BUILDX_BUILD := $(DOCKER_BUILDX_BUILD) --push
endif
info:
echo ${PKG}
TESTPATH = ./pkg/...
test:
KUBECONFIG=$(KUBECONFIG) go test -race -v $(TESTPATH)
cover:
KUBECONFIG=$(KUBECONFIG) go test -race -v -coverprofile=coverage.txt -covermode=atomic $(TESTPATH)
fmt:
goimports -l -w .
gofmt -l -w .
dep:
go get -u ./...
build:
goreleaser build --snapshot --rm-dist
dockerx: build
$(foreach target,$(TARGETS),\
$(DOCKER_BUILDX_BUILD) \
--build-arg=VERSION=$(VERSION) \
$(foreach namespace,$(NAMESPACES),--tag=$(namespace)/$(target):$(TAG)) \
--file=cmd/$(target)/Dockerfile . ;\
)
eval:
cd ./deploy && cuem eval -w --output=./output/kube-agent.cue ./clusters/kube-agent.cue
apply:
#cd ./deploy && cuem k apply ./clusters/kube-agent.cue
cd ./deploy && cuem k apply ./clusters/kube-agent-gateway.cue
debug:
KUBECONFIG=${PWD}/deploy/clusters/kubeconfig.yaml kubectl version
KUBECONFIG=${PWD}/deploy/clusters/kubeconfig.yaml kubectl get ns default
debug.gateway:
go run ./cmd/kube-agent-gateway \
--port=8080
debug.agent:
go run ./cmd/kube-agent --gateway-address=127.0.0.1:8080 --host=hw-dev