@@ -12,6 +12,7 @@ DEBUG ?= false
1212LAST_RELEASED_IMAGE_NAME := hawtio-operator
1313LAST_RELEASED_VERSION ?= 1.4.0
1414BUNDLE_IMAGE_NAME ?= $(IMAGE ) -bundle
15+ FORCE_TOOL_UPDATE ?= false
1516
1617# Is this build part of an automated CI pipeline
1718CI_BUILD ?= false
@@ -29,17 +30,13 @@ endif
2930# Drop suffix for use with bundle and CSV
3031OPERATOR_VERSION := $(subst -SNAPSHOT,,$(VERSION ) )
3132
32- # Replace SNAPSHOT with the timestamp for the tag
33- DATETIMESTAMP =$(shell date -u '+% Y% m% d-% H% M% S')
34- VERSION := $(subst -SNAPSHOT,-$(DATETIMESTAMP ) ,$(VERSION ) )
35-
3633#
3734# Versions of tools and binaries
3835#
39- CONTROLLER_GEN_VERSION := v0.19.0
40- KUSTOMIZE_VERSION := v4.5.4
41- OPERATOR_SDK_VERSION := v1.28.0
42- OPM_VERSION := v1.60.0
36+ CONTROLLER_GEN_VERSION := v0.20.1
37+ KUSTOMIZE_VERSION := v5.8.1
38+ OPERATOR_SDK_VERSION := v1.42.2
39+ OPM_VERSION := v1.64.x
4340
4441CRD_OPTIONS ?= crd:crdVersions=v1
4542
@@ -101,10 +98,10 @@ endif
10198# * PARAMETERS:
10299# ** IMAGE: Set a custom image for the container image
103100# ** VERSION: Set a custom version for the container image tag
104- # ** HAWTIO_ONLINE_IMAGE_NAME Set the operator's target hawtio-online image name
105- # ** HAWTIO_ONLINE_GATEWAY_IMAGE_NAME Set the operator's target hawtio-online-gateway image name
106- # ** HAWTIO_ONLINE_VERSION Set the operator's target hawtio-online image version
107- # ** HAWTIO_ONLINE_GATEWAY_VERSION Set the operator's target hawtio-online-gateway image version
101+ # ** HAWTIO_ONLINE_IMAGE_NAME: Set the operator's target hawtio-online image name
102+ # ** HAWTIO_ONLINE_GATEWAY_IMAGE_NAME: Set the operator's target hawtio-online-gateway image name
103+ # ** HAWTIO_ONLINE_VERSION: Set the operator's target hawtio-online image version
104+ # ** HAWTIO_ONLINE_GATEWAY_VERSION: Set the operator's target hawtio-online-gateway image version
108105#
109106# ---
110107image : container-builder
@@ -125,10 +122,10 @@ image: container-builder
125122# * PARAMETERS:
126123# ** IMAGE: Set a custom image for the container image
127124# ** VERSION: Set a custom version for the container image tag
128- # ** HAWTIO_ONLINE_IMAGE_NAME Set the operator's target hawtio-online image name
129- # ** HAWTIO_ONLINE_GATEWAY_IMAGE_NAME Set the operator's target hawtio-online-gateway image name
130- # ** HAWTIO_ONLINE_VERSION Set the operator's target hawtio-online image version
131- # ** HAWTIO_ONLINE_GATEWAY_VERSION Set the operator's target hawtio-online-gateway image version
125+ # ** HAWTIO_ONLINE_IMAGE_NAME: Set the operator's target hawtio-online image name
126+ # ** HAWTIO_ONLINE_GATEWAY_IMAGE_NAME: Set the operator's target hawtio-online-gateway image name
127+ # ** HAWTIO_ONLINE_VERSION: Set the operator's target hawtio-online image version
128+ # ** HAWTIO_ONLINE_GATEWAY_VERSION: Set the operator's target hawtio-online-gateway image version
132129#
133130# ---
134131publish-image : image
@@ -140,7 +137,7 @@ publish-image: image
140137# == Build and test the operator binary
141138#
142139# * PARAMETERS:
143- # ** GOLDFLAGS: Add any go-lang ldflags, eg. -X main.ImageVersion=2.0.0-202312061128 will compile in the operand version
140+ # ** GOLDFLAGS: Add any go-lang ldflags, eg. -X main.ImageVersion=2.0.0-202312061128 will compile in the operand version
144141#
145142# ---
146143build : generate compile test
@@ -155,7 +152,10 @@ go-generate:
155152# Only use gotestfmt if building / testing locally
156153test :
157154ifeq ($(CI_BUILD ) , false)
158- ifeq (, $(shell command -v gotestfmt 2> /dev/null) )
155+ # If FORCE_TOOL_UPDATE is true, it intentionally
156+ # returns an empty string to force the install.
157+ # Otherwise, it returns the tool's existing path.
158+ ifeq (, $(if $(filter true,$(FORCE_TOOL_UPDATE ) ) ,,$(shell command -v gotestfmt 2> /dev/null) ) )
159159 go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
160160endif
161161 CGO_ENABLED=0 $(TEST_ENV_VARS) go test $(TEST_FLAGS) -count=1 -json ./... 2>&1 | gotestfmt
@@ -192,7 +192,7 @@ get-version:
192192# === Can only be executed as a cluster-admin
193193#
194194# * PARAMETERS:
195- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
195+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
196196#
197197# ---
198198deploy-crd : kubectl
@@ -211,10 +211,10 @@ endif
211211# === Can only be executed as a cluster-admin
212212#
213213# * PARAMETERS:
214- # ** IMAGE: Set a custom image for the deployment
215- # ** VERSION: Set a custom version for the deployment
216- # ** NAMESPACE: Set the namespace for the resources
217- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
214+ # ** IMAGE: Set a custom image for the deployment
215+ # ** VERSION: Set a custom version for the deployment
216+ # ** NAMESPACE: Set the namespace for the resources
217+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
218218#
219219# ---
220220deploy : kubectl kustomize install
@@ -290,10 +290,10 @@ endif
290290# == Create the manifest bundle artifacts
291291#
292292# * PARAMETERS:
293- # ** IMAGE: Set a custom image for the deployment
294- # ** VERSION: Set a custom version for the deployment
295- # ** NAMESPACE: Set the namespace for the resources
296- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
293+ # ** IMAGE: Set a custom image for the deployment
294+ # ** VERSION: Set a custom version for the deployment
295+ # ** NAMESPACE: Set the namespace for the resources
296+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
297297#
298298# ---
299299bundle : kustomize operator-sdk pre-bundle
@@ -324,8 +324,8 @@ validate-bundle: operator-sdk
324324# == Build the bundle image.
325325#
326326# * PARAMETERS:
327- # ** IMAGE: Set the custom image name (suffixed with '-bundle')
328- # ** VERSION: Set the custom version for the bundle image
327+ # ** IMAGE: Set the custom image name (suffixed with '-bundle')
328+ # ** VERSION: Set the custom version for the bundle image
329329#
330330# ---
331331bundle-build : bundle container-builder
@@ -338,9 +338,9 @@ bundle-build: bundle container-builder
338338# == Builds a test catalog index for installing the operator via an OLM
339339#
340340# * PARAMETERS:
341- # ** IMAGE: Set the custom image name (will be suffixed with '-bundle')
342- # ** VERSION: Set the custom version for the bundle image
343- # ** CSV_VERSION: Set the CSV version if different from the OPERATOR_VERSION / TAG
341+ # ** IMAGE: Set the custom image name (will be suffixed with '-bundle')
342+ # ** VERSION: Set the custom version for the bundle image
343+ # ** CSV_VERSION: Set the CSV version if different from the OPERATOR_VERSION / TAG
344344#
345345# ---
346346bundle-index : opm yq container-builder
@@ -363,7 +363,10 @@ check-admin: kubectl
363363#
364364controller-gen :
365365ifeq ($(CI_BUILD ) , false)
366- ifeq (, $(shell command -v controller-gen 2> /dev/null) )
366+ # If FORCE_TOOL_UPDATE is true, it intentionally
367+ # returns an empty string to force the install.
368+ # Otherwise, it returns the tool's existing path.
369+ ifeq (, $(if $(filter true,$(FORCE_TOOL_UPDATE ) ) ,,$(shell command -v controller-gen 2> /dev/null) ) )
367370 go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)
368371CONTROLLER_GEN =$(GOBIN ) /controller-gen
369372else
@@ -379,7 +382,9 @@ ifeq (, $(shell command -v kubectl 2> /dev/null))
379382endif
380383
381384kustomize :
382- ifeq (, $(shell command -v kustomize 2> /dev/null) )
385+ # If FORCE_TOOL_UPDATE is true, it intentionally returns an empty string to force the install.
386+ # Otherwise, it returns the tool's existing path.
387+ ifeq (, $(if $(filter true,$(FORCE_TOOL_UPDATE ) ) ,,$(shell command -v kustomize 2> /dev/null) ) )
383388 go install sigs.k8s.io/kustomize/kustomize/v4@$(KUSTOMIZE_VERSION)
384389KUSTOMIZE =$(GOBIN ) /kustomize
385390else
@@ -409,7 +414,9 @@ operator-sdk: detect-os
409414OPERATOR_SDK =$(GOBIN ) /operator-sdk
410415
411416opm : detect-os
412- ifeq (, $(shell command -v opm 2> /dev/null) )
417+ # If FORCE_TOOL_UPDATE is true, it intentionally returns an empty string to force the install.
418+ # Otherwise, it returns the tool's existing path.
419+ ifeq (, $(if $(filter true,$(FORCE_TOOL_UPDATE ) ) ,,$(shell command -v opm 2> /dev/null) ) )
413420 @{ \
414421 set -e ;\
415422 curl \
@@ -430,7 +437,9 @@ OPM=$(shell command -v opm 2> /dev/null)
430437endif
431438
432439yq :
433- ifeq (, $(shell command -v yq 2> /dev/null) )
440+ # If FORCE_TOOL_UPDATE is true, it intentionally returns an empty string to force the install.
441+ # Otherwise, it returns the tool's existing path.
442+ ifeq (, $(if $(filter true,$(FORCE_TOOL_UPDATE ) ) ,,$(shell command -v yq 2> /dev/null) ) )
434443 @GO111MODULE=on go install github.com/mikefarah/yq/v3
435444YQ =$(GOBIN ) /yq
436445else
@@ -446,10 +455,10 @@ endif
446455# === Calls check-admin
447456#
448457# * PARAMETERS:
449- # ** IMAGE: Set a custom image for the deployment
450- # ** VERSION: Set a custom version for the deployment
451- # ** NAMESPACE: Set the namespace for the resources
452- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
458+ # ** IMAGE: Set a custom image for the deployment
459+ # ** VERSION: Set a custom version for the deployment
460+ # ** NAMESPACE: Set the namespace for the resources
461+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
453462setup : kubectl kustomize check-admin
454463 # @ Must be invoked by a user with cluster-admin privileges
455464 $(call set-kvars,$(INSTALL_ROOT ) /setup)
@@ -468,10 +477,10 @@ endif
468477# === (must be granted the privileges by the Cluster-Admin executed `setup` procedure)
469478#
470479# * PARAMETERS:
471- # ** IMAGE: Set a custom image for the deployment
472- # ** VERSION: Set a custom version for the deployment
473- # ** NAMESPACE: Set the namespace for the resources
474- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
480+ # ** IMAGE: Set a custom image for the deployment
481+ # ** VERSION: Set a custom version for the deployment
482+ # ** NAMESPACE: Set the namespace for the resources
483+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
475484#
476485# ---
477486operator : kubectl kustomize
@@ -490,8 +499,8 @@ endif
490499# == Install the app CR only
491500#
492501# * PARAMETERS:
493- # ** NAMESPACE: Set the namespace for the resources
494- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
502+ # ** NAMESPACE: Set the namespace for the resources
503+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
495504#
496505# ---
497506cr : kubectl kustomize
@@ -512,10 +521,10 @@ endif
512521# === (must be granted the privileges by the Cluster-Admin executed `setup` procedure)
513522#
514523# * PARAMETERS:
515- # ** IMAGE: Set a custom image for the deployment
516- # ** VERSION: Set a custom version for the deployment
517- # ** NAMESPACE: Set the namespace for the resources
518- # ** DEBUG: Print the resources to be applied instead of applying them [ true | false ]
524+ # ** IMAGE: Set a custom image for the deployment
525+ # ** VERSION: Set a custom version for the deployment
526+ # ** NAMESPACE: Set the namespace for the resources
527+ # ** DEBUG: Print the resources to be applied instead of applying them [true| false]
519528#
520529# ---
521530app : kubectl kustomize operator
@@ -548,13 +557,13 @@ endif
548557# === Calls check-admin
549558#
550559# * PARAMETERS:
551- # ** NAMESPACE: Set the namespace for the resources
552- # ** DEBUG: Print the resources to be deleted instead of deleting them [ true | false ]
560+ # ** NAMESPACE: Set the namespace for the resources
561+ # ** DEBUG: Print the resources to be deleted instead of deleting them [true| false]
553562#
554563# ---
555564uninstall : kubectl kustomize check-admin $(UNINSTALLS )
556565
557566.DEFAULT_GOAL := help
558567.PHONY : help
559568help : # # Show this help screen.
560- @awk ' BEGIN { printf "\nUsage: make \033[31m<PARAM1=val1 PARAM2=val2>\033[0m \033[36m<target>\033[0m\n"; printf "\nAvailable targets are:\n" } /^#@/ { printf "\033[36m%-15s\033[0m", $$2; subdesc=0; next } /^#===/ { printf "%-14s \033[32m%s\033[0m\n", " ", substr($$0, 5); subdesc=1; next } /^#==/ { printf "\033[0m%s\033[0m\n\n", substr($$0, 4); next } /^#\*\*/ { printf "%-14s \033[31m%s\033[0m\n", " ", substr($$0, 4); next } /^#\*/ && (subdesc == 1) { printf "\n"; next } /^#\-\-\-/ { printf "\n"; next } ' $( MAKEFILE_LIST )
569+ @./script/help.sh
0 commit comments