forked from minio/operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (84 loc) · 3.43 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
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
105
106
107
PWD := $(shell pwd)
ifeq '${CI}' 'true'
VERSION ?= dev
else
VERSION ?= $(shell git describe --tags)
VERSIONV ?= $(shell git describe --tags | sed 's,v,,g')
endif
TAG ?= "minio/operator:$(VERSION)"
LDFLAGS ?= "-s -w -X main.Version=$(VERSION)"
TMPFILE := $(shell mktemp)
GOPATH := $(shell go env GOPATH)
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)
HELM_HOME=helm/operator
HELM_CRDS=$(HELM_HOME)/crds
KUSTOMIZE_HOME=resources
KUSTOMIZE_CRDS=$(KUSTOMIZE_HOME)/base/crds/
PLUGIN_HOME=kubectl-minio
LOGSEARCHAPI=logsearchapi
all: build
getdeps:
@echo "Checking dependencies"
@mkdir -p ${GOPATH}/bin
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0)
@echo "Go Mod Download"
@go mod download
verify: getdeps govet gotest lint
operator: verify
@CGO_ENABLED=0 GOOS=linux go build -trimpath --ldflags $(LDFLAGS) -o minio-operator
docker: operator logsearchapi
@docker build --no-cache -t $(TAG) .
build: regen-crd verify plugin logsearchapi operator docker
install: all
lint:
@echo "Running $@ check"
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
govet:
@go vet ./...
gotest:
@go test -race ./...
clean:
@echo "Cleaning up all the generated files"
@find . -name '*.test' | xargs rm -fv
@find . -name '*~' | xargs rm -fv
@find . -name '*.zip' | xargs rm -fv
@rm -rf dist/
regen-crd:
@go install -v github.com/minio/controller-tools/cmd/[email protected]
@echo "WARNING: installing our fork github.com/minio/controller-tools/cmd/[email protected]"
@echo "Any other controller-gen will cause the generated CRD to lose the volumeClaimTemplate metadata to be lost"
@${GOPATH}/bin/controller-gen crd:maxDescLen=0,generateEmbeddedObjectMeta=true paths="./..." output:crd:artifacts:config=$(KUSTOMIZE_CRDS)
@kustomize build resources/patch-crd > $(TMPFILE)
@mv -f $(TMPFILE) resources/base/crds/minio.min.io_tenants.yaml
@cp -f resources/base/crds/minio.min.io_tenants.yaml $(HELM_CRDS)/minio.min.io_tenants.yaml
regen-crd-docs:
@which crd-ref-docs 1>/dev/null || (echo "Installing crd-ref-docs" && GO111MODULE=on go install -v github.com/elastic/crd-ref-docs@latest)
@${GOPATH}/bin/crd-ref-docs --source-path=./pkg/apis/minio.min.io/v2 --config=docs/templates/config.yaml --renderer=asciidoctor --output-path=docs/crd.adoc --templates-dir=docs/templates/asciidoctor/
plugin: regen-crd
@echo "Building 'kubectl-minio' binary"
@(cd $(PLUGIN_HOME); \
go vet ./... && \
go test -race ./... && \
GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean && \
GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ../.golangci.yml)
.PHONY: logsearchapi
logsearchapi:
@echo "Building 'logsearchapi' binary"
@(cd $(LOGSEARCHAPI); \
go vet ./... && \
go test -race ./... && \
GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean && \
GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ../.golangci.yml && \
CGO_ENABLED=0 GOOS=linux go build --ldflags "-s -w" -trimpath -o ../logsearchapi-bin )
getconsoleuiyaml:
@echo "Getting the latest Console UI"
@kustomize build github.com/minio/console/k8s/operator-console/base > resources/base/console-ui.yaml
@echo "Done"
generate-code:
@./k8s/update-codegen.sh
generate-openshift-manifests:
@./olm.sh
release: generate-openshift-manifests
@./release.sh
@./helm-reindex.sh