5555# Set the Operator SDK version to use. By default, what is installed on the system is used.
5656# This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
5757OPERATOR_SDK_VERSION ?= v1.42.0
58+ OPERATOR_MANAGER_VERSION ?= v1.62.0
5859# Image URL to use all building/pushing image targets
5960IMG ?= ${IMAGE_TAG_BASE}:${FULL_VERSION}
6061# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
@@ -397,18 +398,14 @@ ifeq (,$(shell which opm 2>/dev/null))
397398 set -e ;\
398399 mkdir -p $(dir $(OPM)) ;\
399400 OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
400- curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0 /$${OS}-$${ARCH}-opm ;\
401+ curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/${OPERATOR_MANAGER_VERSION} /$${OS}-$${ARCH}-opm ;\
401402 chmod +x $(OPM) ;\
402403 }
403404else
404405OPM = $(shell which opm)
405406endif
406407endif
407408
408- # 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).
409- # These images MUST exist in a registry and be pull-able.
410- BUNDLE_IMGS ?= $(BUNDLE_IMG )
411-
412409# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
413410CATALOG_IMG ?= $(IMAGE_TAG_BASE ) -catalog:$(FULL_VERSION )
414411
@@ -417,12 +414,34 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
417414FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG )
418415endif
419416
420- # Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
421- # This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
422- # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
417+ .PHONY : catalog-dockerfile
418+ catalog-dockerfile : opm # # Generate catalog Dockerfile
419+ rm -f catalog.Dockerfile && $(OPM ) generate dockerfile catalog
420+
421+ .PHONY : catalog-template
422+ catalog-template : # Generate catalog template with all bundles from registry
423+ ./ci/generate-catalog-template.sh $(IMAGE_TAG_BASE ) -bundle
424+
425+ catalog-render : opm catalog-template # # Genermrate FBC catalog from template
426+ $(OPM ) alpha render-template catalog/clickhouse-operator-template.yaml > catalog/catalog.yaml
427+ $(OPM ) validate catalog
428+
423429.PHONY : catalog-build
424- catalog-build : opm # # Build a catalog image.
425- $(OPM ) index add --container-tool docker --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
430+ catalog-build : catalog-render catalog-dockerfile # # Build a catalog image using FBC
431+ $(CONTAINER_TOOL ) build -f catalog.Dockerfile -t $(CATALOG_IMG ) .
432+
433+ .PHONY : catalog-buildx
434+ catalog-buildx : catalog-render catalog-dockerfile # # Build and push catalog image for cross-platform support
435+ sed -e ' 1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' catalog.Dockerfile > catalog.Dockerfile.cross
436+ - $(CONTAINER_TOOL ) buildx create --name clickhouse-operator-catalog-builder
437+ $(CONTAINER_TOOL ) buildx use clickhouse-operator-catalog-builder
438+ - $(CONTAINER_TOOL ) buildx build --push --platform=$(PLATFORMS ) --tag $(CATALOG_IMG ) -f catalog.Dockerfile.cross .
439+ - $(CONTAINER_TOOL ) buildx rm clickhouse-operator-catalog-builder
440+ rm -f catalog.Dockerfile.cross
441+
442+ .PHONY : catalog-push-latest
443+ catalog-push-latest :
444+ $(CONTAINER_TOOL ) buildx imagetools create -t $(IMAGE_TAG_BASE ) -catalog:latest $(CATALOG_IMG )
426445
427446# Push the catalog image.
428447.PHONY : catalog-push
0 commit comments