-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (45 loc) · 1.67 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
SHELL := /bin/bash
GOOS ?= linux
GOARCH ?= amd64
API_ROOT_DIR := pkg/apis
API_GO_PKG := github.com/ihcsim/k8s-dra/pkg/apis
OPENAPI_GO_PKG := github.com/ihcsim/k8s-dra/pkg/openapi
BOILERPLATE_FILE := hack/boilerplate.go.txt
all: tidy lint test controller plugin
controller: tidy
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/controller ./cmd/controller
plugin: tidy
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o bin/plugin ./cmd/plugin
test:
GOOS=$(GOOS) GOARCH=$(GOARCH) go test ./...
tidy:
go mod tidy
lint:
golangci-lint run ./...
codegen:
rm -rf pkg/apis/applyconfiguration pkg/apis/clientset pkg/apis/informers pkg/apis/listers && \
source ./hack/kube-codegen.sh && \
kube::codegen::gen_helpers --boilerplate $(BOILERPLATE_FILE) $(API_ROOT_DIR) && \
kube::codegen::gen_openapi --boilerplate $(BOILERPLATE_FILE) \
--output-dir $(API_ROOT_DIR)/openapi \
--output-pkg $(OPENAPI_GO_PKG) \
--report-filename $(API_ROOT_DIR)/openapi-report.txt \
--update-report \
$(API_ROOT_DIR) && \
kube::codegen::gen_client --boilerplate $(BOILERPLATE_FILE) \
--output-dir $(API_ROOT_DIR) \
--output-pkg $(API_GO_PKG) \
--with-applyconfig \
--with-watch \
--plural-exceptions "GPUClassParameters:GPUClassParameters,GPURequirements:GPURequirements,NodeGPUSlices:NodeGPUSlices" \
$(API_ROOT_DIR)
codegen-verify:
@srcdir=$$(pwd) && \
tmpdir=$$(mktemp -d -t k8s-dra.XXXXXX ) && \
cp -a . $${tmpdir} && \
pushd $${tmpdir} && \
$(MAKE) -s codegen && \
diff -Naupr "$${srcdir}" "$${tmpdir}" || ret="$$?" && \
rm -rf $${tmpdir} && \
echo "Removed temporary diff folder at $${tmpdir}." && \
[[ $${ret} -eq 0 ]] || { echo "CRD APIs is outdated. Please run 'make codegen'."; exit 1; }