-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
104 lines (77 loc) · 2.78 KB
/
makefile
File metadata and controls
104 lines (77 loc) · 2.78 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
VERSION ?= latest
REGISTRY ?= europe-docker.pkg.dev/srlinux/eu.gcr.io
PROJECT ?= pkg-server
IMG ?= $(REGISTRY)/${PROJECT}:$(VERSION)
REPO = github.com/kform-dev/pkg-server
## Tool Binaries
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
CONTROLLER_TOOLS_VERSION ?= v0.12.1
.PHONY: codegen fix fmt vet lint test tidy
GOBIN := $(shell go env GOPATH)/bin
all: codegen fmt vet lint test tidy
.PHONY:
build:
mkdir -p bin
CGO_ENABLED=0 ${GOBIN} build -o bin/pkgctl cmd/pkgctl/main.go
.PHONY:
docker:
GOOS=linux GOARCH=arm64 go build -o install/bin/apiserver
docker build install --tag apiserver-caas:v0.0.0
.PHONY:
docker-build: ## Build docker image with the manager.
docker build -t ${IMG} .
.PHONY: docker-push
docker-push: docker-build ## Push docker image with the manager.
docker push ${IMG}
install: docker
kustomize build install | kubectl apply -f -
reinstall: docker
kustomize build install | kubectl apply -f -
kubectl delete pods -n config-system --all
apiserver-logs:
kubectl logs -l apiserver=true --container apiserver -n config-system -f --tail 1000
codegen:
(which apiserver-runtime-gen || go get sigs.k8s.io/apiserver-runtime/tools/apiserver-runtime-gen)
go generate
genclients:
go run ./tools/apiserver-runtime-gen \
-g client-gen \
-g deepcopy-gen \
-g informer-gen \
-g lister-gen \
-g openapi-gen \
-g go-to-protobuf \
--module $(REPO) \
--versions $(REPO)/apis/pkg/v1alpha1,$(REPO)/apis/config/v1alpha1,$(REPO)/apis/pkgid,$(REPO)/apis/condition
# -g go-to-protobuf \
.PHONY: generate
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/pkgid/..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/condition/..."
protoc -I . $(shell find ./pkg/ -name '*.proto') --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./apis/config/..." output:crd:artifacts:config=artifacts
fix:
go fix ./...
fmt:
test -z $(go fmt ./tools/...)
tidy:
go mod tidy
lint:
(which golangci-lint || go get github.com/golangci/golangci-lint/cmd/golangci-lint)
$(GOBIN)/golangci-lint run ./...
test:
go test -cover ./...
vet:
go vet ./...
local-run:
apiserver-boot run local --run=etcd,apiserver
## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)