forked from Kuadrant/kuadrantctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
139 lines (112 loc) · 5.56 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
SHELL := /bin/bash
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
GO ?= go
KUADRANT_NAMESPACE=kuadrant-system
include utils.mk
all: help
.PHONY : help
help: Makefile
@sed -n 's/^##//p' $<
# Kind tool
KIND = $(PROJECT_PATH)/bin/kind
KIND_CLUSTER_NAME = kuadrant-local
$(KIND):
$(call go-get-tool,$(KIND),sigs.k8s.io/[email protected])
.PHONY : kind
kind: $(KIND)
# istioctl tool
ISTIOCTL=$(PROJECT_PATH)/bin/istioctl
ISTIOVERSION = 1.12.1
$(ISTIOCTL):
mkdir -p $(PROJECT_PATH)/bin
$(eval TMP := $(shell mktemp -d))
cd $(TMP); curl -sSL https://istio.io/downloadIstio | ISTIO_VERSION=$(ISTIOVERSION) sh -
cp $(TMP)/istio-$(ISTIOVERSION)/bin/istioctl ${ISTIOCTL}
-rm -rf $(TMP)
.PHONY: istioctl
istioctl: $(ISTIOCTL)
# Ginkgo tool
GINKGO = $(PROJECT_PATH)/bin/ginkgo
$(GINKGO):
$(call go-get-tool,$(GINKGO),github.com/onsi/ginkgo/[email protected])
## test: Run unit tests
.PHONY : test
test: fmt vet $(GINKGO)
# huffle both the order in which specs within a suite run, and the order in which different suites run
# You can always rerun a given ordering later by passing the --seed flag a matching seed.
$(GINKGO) --randomizeAllSpecs --randomizeSuites -v -progress --trace --cover ./...
## install: Build and install kuadrantctl binary ($GOBIN or GOPATH/bin)
.PHONY : install
install: fmt vet
GOBIN=$(PROJECT_PATH)/bin $(GO) install
.PHONY : fmt
fmt:
$(GO) fmt ./...
.PHONY : vet
vet:
$(GO) vet ./...
# Generates istio manifests with patches.
.PHONY: generate-istio-manifests
generate-istio-manifests: istioctl
$(ISTIOCTL) manifest generate --set profile=minimal --set values.gateways.istio-ingressgateway.autoscaleEnabled=false --set values.pilot.autoscaleEnabled=false --set values.global.istioNamespace=kuadrant-system -f istiomanifests/patches/istio-externalProvider.yaml -o istiomanifests/autogenerated
.PHONY: istio-manifest-update-test
istio-manifest-update-test: generate-istio-manifests
git diff --exit-code ./istiomanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./istiomanifests/autogenerated)" ]
# Generates kuadrant manifests.
KUADRANTVERSION=main
KUADRANT_CONTROLLER_IMAGE=quay.io/kuadrant/kuadrant-controller:$(KUADRANTVERSION)
.PHONY: generate-kuadrant-manifests
generate-kuadrant-manifests:
$(eval TMP := $(shell mktemp -d))
cd $(TMP); git clone --depth 1 --branch $(KUADRANTVERSION) https://github.com/kuadrant/kuadrant-controller.git
cd $(TMP)/kuadrant-controller; make kustomize
cd $(TMP)/kuadrant-controller/config/manager; $(TMP)/kuadrant-controller/bin/kustomize edit set image controller=${KUADRANT_CONTROLLER_IMAGE}
cd $(TMP)/kuadrant-controller/config/default; $(TMP)/kuadrant-controller/bin/kustomize edit set namespace $(KUADRANT_NAMESPACE)
cd $(TMP)/kuadrant-controller; bin/kustomize build config/default -o $(PROJECT_PATH)/kuadrantmanifests/autogenerated/kuadrant.yaml
-rm -rf $(TMP)
.PHONY: kuadrant-manifest-update-test
kuadrant-manifest-update-test: generate-kuadrant-manifests
git diff --exit-code ./kuadrantmanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./kuadrantmanifests/autogenerated)" ]
# Generates limitador manifests.
LIMITADOR_OPERATOR_VERSION=main
LIMITADOR_OPERATOR_IMAGE=quay.io/kuadrant/limitador-operator:$(LIMITADOR_OPERATOR_VERSION)
.PHONY: generate-limitador-operator-manifests
generate-limitador-operator-manifests:
$(eval TMP := $(shell mktemp -d))
cd $(TMP); git clone --depth 1 --branch $(LIMITADOR_OPERATOR_VERSION) https://github.com/kuadrant/limitador-operator.git
cd $(TMP)/limitador-operator; make kustomize
cd $(TMP)/limitador-operator/config/manager; $(TMP)/limitador-operator/bin/kustomize edit set image controller=$(LIMITADOR_OPERATOR_IMAGE)
cd $(TMP)/limitador-operator/config/default; $(TMP)/limitador-operator/bin/kustomize edit set namespace $(KUADRANT_NAMESPACE)
cd $(TMP)/limitador-operator; bin/kustomize build config/default -o $(PROJECT_PATH)/limitadormanifests/autogenerated/limitador-operator.yaml
-rm -rf $(TMP)
.PHONY: limitador-operator-manifest-update-test
limitador-operator-manifest-update-test: generate-limitador-operator-manifests
git diff --exit-code ./limitadormanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./limitadormanifests/autogenerated)" ]
# Generates authorino operator manifests.
AUTHORINO_OPERATOR_VERSION=main
.PHONY: generate-authorino-operator-manifests
generate-authorino-operator-manifests:
curl -sSf https://raw.githubusercontent.com/Kuadrant/authorino-operator/$(AUTHORINO_OPERATOR_VERSION)/config/deploy/manifests.yaml > $(PROJECT_PATH)/authorinomanifests/autogenerated/authorino-operator.yaml
.PHONY: authorino-manifest-update-test
authorino-operator-manifest-update-test: generate-authorino-operator-manifests
git diff --exit-code ./authorinomanifests/autogenerated
[ -z "$$(git ls-files --other --exclude-standard --directory --no-empty-directory ./authorinomanifests/autogenerated)" ]
.PHONY : cluster-cleanup
cluster-cleanup: $(KIND)
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME)
.PHONY : cluster-setup
cluster-setup: $(KIND) cluster-cleanup
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --config utils/kind/cluster.yaml
GOLANGCI-LINT=$(PROJECT_PATH)/bin/golangci-lint
$(GOLANGCI-LINT):
mkdir -p $(PROJECT_PATH)/bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH)/bin v1.41.1
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI-LINT)
.PHONY: run-lint
run-lint: $(GOLANGCI-LINT)
$(GOLANGCI-LINT) run --timeout 2m