@@ -60,6 +60,8 @@ SHELL = /usr/bin/env bash -o pipefail
60
60
KIND_CLUSTER_NAME = kuadrant-local
61
61
GOLANGCI-LINT = $(PROJECT_PATH ) /bin/golangci-lint
62
62
63
+ KUADRANT_NAMESPACE =kuadrant-system
64
+
63
65
all : build
64
66
65
67
# #@ General
@@ -82,15 +84,6 @@ help: ## Display this help.
82
84
83
85
manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
84
86
$(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./..." output:crd:artifacts:config=config/crd/bases
85
- $(MAKE ) deploy-manifest
86
-
87
- .PHONY : deploy-manifest
88
- deploy-manifest : kustomize # # Generate deployment manifests.
89
- mkdir -p $(PROJECT_DIR ) /config/deploy
90
- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
91
- $(KUSTOMIZE ) build config/default > $(PROJECT_DIR ) /config/deploy/manifests.yaml
92
- # clean up
93
- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(DEFAULT_IMG )
94
87
95
88
generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
96
89
$(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
@@ -113,73 +106,40 @@ clean-cov:
113
106
rm -rf $(PROJECT_PATH ) /cover.out
114
107
115
108
.PHONY : local-setup
116
- local-setup : local-cleanup local-setup-kind manifests kustomize generate # # Deploy locally kuadrant controller from the current code
117
- export PATH=$(PROJECT_PATH ) /bin:$$ PATH; ./utils/local-deployment/local-setup.sh
109
+ local-setup : export IMG := $(IMAGE_TAG_BASE ) :dev
110
+ local-setup : # # Deploy locally kuadrant controller from the current code
111
+ $(MAKE ) local-env-setup
112
+ $(MAKE ) docker-build
113
+ $(KIND ) load docker-image $(IMG ) --name $(KIND_CLUSTER_NAME )
114
+ $(MAKE ) deploy
115
+ kubectl -n kuadrant-system wait --timeout=300s --for=condition=Available deployments --all
116
+ @echo
117
+ @echo " Now you can export the kuadrant gateway by doing:"
118
+ @echo " kubectl port-forward --namespace ${KUADRANT_NAMESPACE} deployment/kuadrant-gateway 8080:8080 8443:8443"
119
+ @echo " after that, you can curl -H \" Host: myhost.com\" localhost:8080"
120
+ @echo " -- Linux only -- Ingress gateway is exported using nodePort service in port 9080"
121
+ @echo " curl -H \" Host: myhost.com\" localhost:9080"
122
+ @echo
118
123
124
+ .PHONY : local-cleanup
125
+ local-cleanup : # # Delete local cluster
126
+ $(MAKE ) kind-delete-cluster
119
127
120
128
# kuadrant is not deployed
121
129
.PHONY : local-env-setup
122
- local-env-setup : local-cleanup local-setup-kind deploy-kuadrant-deps generate install # # Deploys all services and manifests required by kuadrant to run. Used to run kuadrant with "make run"
123
-
124
- .PHONY : deploy-kuadrant-deps
125
- deploy-kuadrant-deps :
126
- ./utils/local-deployment/deploy-kuadrant-deps.sh
127
-
128
- .PHONY : local-setup-kind
129
- local-setup-kind : kind
130
- $(KIND ) create cluster --name $(KIND_CLUSTER_NAME ) --config utils/local-deployment/kind-cluster.yaml
131
-
132
- .PHONY : local-cleanup
133
- local-cleanup : kind
134
- $(KIND ) delete cluster --name $(KIND_CLUSTER_NAME )
130
+ local-env-setup : # # Deploys all services and manifests required by kuadrant to run. Used to run kuadrant with "make run"
131
+ $(MAKE ) kind-delete-cluster
132
+ $(MAKE ) kind-create-cluster
133
+ $(MAKE ) gateway-api-install
134
+ $(MAKE ) istio-install
135
+ $(MAKE ) deploy-gateway
136
+ $(MAKE ) deploy-dependencies
137
+ $(MAKE ) install
135
138
136
139
.PHONY : run-lint
137
140
run-lint : $(GOLANGCI-LINT ) # # Run lint tests
138
141
$(GOLANGCI-LINT ) run
139
142
140
- ISTIO_MANIFEST_PATH = $(PROJECT_DIR ) /utils/local-deployment/istio-manifests/autogenerated
141
- .PHONY : generate-istio-manifests
142
- generate-istio-manifests : istioctl # # Generates istio manifests with patches.
143
- -rm -rf $(ISTIO_MANIFEST_PATH )
144
- mkdir -p $(ISTIO_MANIFEST_PATH )
145
- $(ISTIOCTL ) manifest generate --set profile=minimal --set values.gateways.istio-ingressgateway.autoscaleEnabled=false --set values.pilot.autoscaleEnabled=false --set values.global.istioNamespace=$(KUADRANT_NAMESPACE ) -f utils/local-deployment/patches/istio-externalProvider.yaml -o $(ISTIO_MANIFEST_PATH )
146
-
147
- .PHONY : istio-manifest-update-test
148
- istio-manifest-update-test : generate-istio-manifests # # Test istio manifest
149
- git diff --exit-code $(ISTIO_MANIFEST_PATH )
150
- [ -z " $$ (git ls-files --other --exclude-standard --directory --no-empty-directory $( ISTIO_MANIFEST_PATH) )" ]
151
-
152
- GATEWAYAPI_MANIFEST_PATH = $(PROJECT_DIR ) /utils/local-deployment/gatewayapi-manifests/autogenerated
153
- .PHONY : generate-gwapi-manifests
154
- generate-gwapi-manifests : # # Generates Gateway API manifests
155
- -rm -rf $(GATEWAYAPI_MANIFEST_PATH )
156
- mkdir -p $(GATEWAYAPI_MANIFEST_PATH )
157
- kubectl kustomize " github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.4.0" > $(GATEWAYAPI_MANIFEST_PATH ) /Base.yaml
158
-
159
- .PHONY : gwapi-manifests-update-test
160
- gwapi-manifests-update-test : generate-gwapi-manifests # # Test Gateway API manifests
161
- git diff --exit-code $(GATEWAYAPI_MANIFEST_PATH )
162
- [ -z " $$ (git ls-files --other --exclude-standard --directory --no-empty-directory $( GATEWAYAPI_MANIFEST_PATH) )" ]
163
-
164
-
165
- .PHONY : manifests-update-test
166
- manifests-update-test : manifests # # Test autogenerated controller manifests
167
- git diff --exit-code ./config
168
- [ -z " $$ (git ls-files --other --exclude-standard --directory --no-empty-directory ./config)" ]
169
-
170
- LIMITADOR_OPERATOR_SCM_VERSION =main
171
- LIMITADOR_OPERATOR_IMAGE_TAG =latest
172
- LIMITADOR_OPERATOR_IMAGE =quay.io/kuadrant/limitador-operator:$(LIMITADOR_OPERATOR_IMAGE_TAG )
173
- .PHONY : generate-limitador-manifests
174
- generate-limitador-manifests : # # Generates limitador manifests.
175
- $(eval TMP := $(shell mktemp -d) )
176
- cd $(TMP ) ; git clone --depth 1 --branch $(LIMITADOR_OPERATOR_SCM_VERSION ) https://github.com/kuadrant/limitador-operator.git
177
- cd $(TMP ) /limitador-operator; make kustomize
178
- cd $(TMP ) /limitador-operator/config/manager; $(TMP ) /limitador-operator/bin/kustomize edit set image controller=$(LIMITADOR_OPERATOR_IMAGE )
179
- cd $(TMP ) /limitador-operator/config/default; $(TMP ) /limitador-operator/bin/kustomize edit set namespace $(KUADRANT_NAMESPACE )
180
- cd $(TMP ) /limitador-operator; bin/kustomize build config/default -o $(PROJECT_PATH ) /utils/local-deployment/limitador-operator.yaml
181
- -rm -rf $(TMP )
182
-
183
143
# #@ Build
184
144
185
145
build : generate fmt vet # # Build manager binary.
@@ -196,9 +156,6 @@ docker-build: ## Build docker image with the manager.
196
156
docker-push : # # Push docker image with the manager.
197
157
docker push ${IMG}
198
158
199
- # old
200
- manager : build
201
-
202
159
# #@ Deployment
203
160
204
161
install : manifests kustomize # # Install CRDs into the K8s cluster specified in ~/.kube/config.
@@ -209,10 +166,21 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
209
166
210
167
deploy : manifests kustomize # # Deploy controller to the K8s cluster specified in ~/.kube/config.
211
168
cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
212
- $(KUSTOMIZE ) build config/default | kubectl apply -f -
169
+ $(KUSTOMIZE ) build config/deploy | kubectl apply -f -
170
+ cd config/manager && $(KUSTOMIZE ) edit set image controller=${DEFAULT_IMG}
213
171
214
172
undeploy : # # Undeploy controller from the K8s cluster specified in ~/.kube/config.
215
- $(KUSTOMIZE ) build config/default | kubectl delete -f -
173
+ $(KUSTOMIZE ) build config/deploy | kubectl delete -f -
174
+
175
+ deploy-dependencies : kustomize # # Deploy dependencies to the K8s cluster specified in ~/.kube/config.
176
+ $(KUSTOMIZE ) build config/dependencies | kubectl apply -f -
177
+ kubectl -n " $( KUADRANT_NAMESPACE) " wait --timeout=300s --for=condition=Available deployments --all
178
+ kubectl apply -n " $( KUADRANT_NAMESPACE) " -f utils/local-deployment/authorino.yaml
179
+ kubectl apply -n " $( KUADRANT_NAMESPACE) " -f utils/local-deployment/limitador.yaml
180
+
181
+ # #@ Misc
182
+
183
+ # # Miscellaneous Custom targets
216
184
217
185
CONTROLLER_GEN = $(shell pwd) /bin/controller-gen
218
186
controller-gen : # # Download controller-gen locally if necessary.
@@ -226,6 +194,12 @@ ENVTEST = $(shell pwd)/bin/setup-envtest
226
194
envtest : # # Download envtest-setup locally if necessary.
227
195
$(call go-get-tool,$(ENVTEST ) ,sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
228
196
197
+ $(GOLANGCI-LINT ) :
198
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH ) /bin v1.46.1
199
+
200
+ .PHONY : golangci-lint
201
+ golangci-lint : $(GOLANGCI-LINT ) # # Download golangci-lint locally if necessary.
202
+
229
203
OPERATOR_SDK = $(shell pwd) /bin/operator-sdk
230
204
OPERATOR_SDK_VERSION = v1.22.0
231
205
operator-sdk : # # Download operator-sdk locally if necessary.
@@ -245,87 +219,5 @@ rm -rf $$TMP_DIR ;\
245
219
}
246
220
endef
247
221
248
- .PHONY : bundle
249
- bundle : manifests kustomize # # Generate bundle manifests and metadata, then validate generated files.
250
- operator-sdk generate kustomize manifests -q
251
- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
252
- $(KUSTOMIZE ) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
253
- operator-sdk bundle validate ./bundle
254
-
255
- .PHONY : bundle-build
256
- bundle-build : # # Build the bundle image.
257
- docker build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
258
-
259
- .PHONY : bundle-push
260
- bundle-push : # # Push the bundle image.
261
- $(MAKE ) docker-push IMG=$(BUNDLE_IMG )
262
-
263
- .PHONY : opm
264
- OPM = ./bin/opm
265
- opm : # # Download opm locally if necessary.
266
- ifeq (,$(wildcard $(OPM ) ) )
267
- ifeq (,$(shell which opm 2>/dev/null) )
268
- @{ \
269
- set -e ;\
270
- mkdir -p $(dir $(OPM)) ;\
271
- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
272
- curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\
273
- chmod +x $(OPM) ;\
274
- }
275
- else
276
- OPM = $(shell which opm)
277
- endif
278
- endif
279
-
280
- # A comma-separated list of bundle images (e.g. make catalog-build BUNDLE_IMGS=example.com/operator-bundle:v0.1.0,example.com/operator-bundle:v0.2.0).
281
- # These images MUST exist in a registry and be pull-able.
282
- BUNDLE_IMGS ?= $(BUNDLE_IMG )
283
-
284
- # The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
285
- CATALOG_IMG ?= $(IMAGE_TAG_BASE ) -catalog:v$(VERSION )
286
-
287
- # Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
288
- ifneq ($(origin CATALOG_BASE_IMG ) , undefined)
289
- FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG )
290
- endif
291
-
292
- # Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
293
- # This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
294
- # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
295
- .PHONY : catalog-build
296
- catalog-build : opm # # Build a catalog image.
297
- $(OPM ) index add --container-tool docker --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
298
-
299
- # Push the catalog image.
300
- .PHONY : catalog-push
301
- catalog-push : # # Push a catalog image.
302
- $(MAKE ) docker-push IMG=$(CATALOG_IMG )
303
-
304
- # #@ Misc
305
-
306
- # # Miscellaneous Custom targets
307
-
308
- KUADRANT_NAMESPACE =kuadrant-system
309
-
310
- KIND = $(shell pwd) /bin/kind
311
- kind : # # Download kind locally if necessary.
312
- $(call go-get-tool,$(KIND ) ,sigs.k8s.io/[email protected] )
313
-
314
- $(GOLANGCI-LINT ) :
315
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH ) /bin v1.46.1
316
-
317
- .PHONY : golangci-lint
318
- golangci-lint : $(GOLANGCI-LINT ) # # Download golangci-lint locally if necessary.
319
-
320
- # istioctl tool
321
- ISTIOCTL =$(PROJECT_PATH ) /bin/istioctl
322
- ISTIOVERSION = 1.12.1
323
- $(ISTIOCTL ) :
324
- mkdir -p $(PROJECT_PATH ) /bin
325
- $(eval TMP := $(shell mktemp -d) )
326
- cd $(TMP ) ; curl -sSL https://istio.io/downloadIstio | ISTIO_VERSION=$(ISTIOVERSION ) sh -
327
- cp $(TMP ) /istio-$(ISTIOVERSION ) /bin/istioctl ${ISTIOCTL}
328
- -rm -rf $(TMP )
329
-
330
- .PHONY : istioctl
331
- istioctl : $(ISTIOCTL ) # # Download istioctl locally if necessary.
222
+ # Include last to avoid changing MAKEFILE_LIST used above
223
+ include ./make/*.mk
0 commit comments