1- # VERSION defines the project version for the bundle.
2- # Update this value when you upgrade the version of your project.
3- # To re-generate a bundle for another specific version without changing the standard setup, you can:
4- # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
5- # - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6- VERSION ?= 0.0.1
7-
8- # CHANNELS define the bundle channels used in the bundle.
9- # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
10- # To re-generate a bundle for other specific channels without changing the standard setup, you can:
11- # - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable)
12- # - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable")
13- ifneq ($(origin CHANNELS ) , undefined)
14- BUNDLE_CHANNELS := --channels=$(CHANNELS )
15- endif
16-
17- # DEFAULT_CHANNEL defines the default channel used in the bundle.
18- # Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable")
19- # To re-generate a bundle for any other default channel without changing the default setup, you can:
20- # - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
21- # - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
22- ifneq ($(origin DEFAULT_CHANNEL ) , undefined)
23- BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL )
24- endif
25- BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS ) $(BUNDLE_DEFAULT_CHANNEL )
26-
27- # IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images.
28- # This variable is used to construct full image tags for bundle and catalog images.
29- #
30- # For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
31- # workspaces.io/workspaces-bundle:$VERSION and workspaces.io/workspaces-catalog:$VERSION.
32- IMAGE_TAG_BASE ?= workspaces.io/workspaces
33-
34- # BUNDLE_IMG defines the image:tag used for the bundle.
35- # You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
36- BUNDLE_IMG ?= $(IMAGE_TAG_BASE ) -bundle:v$(VERSION )
37-
38- # BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
39- BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION ) $(BUNDLE_METADATA_OPTS )
40-
41- # USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
42- # You can enable this value if you would like to use SHA Based Digests
43- # To enable set flag to true
44- USE_IMAGE_DIGESTS ?= false
45- ifeq ($(USE_IMAGE_DIGESTS ) , true)
46- BUNDLE_GEN_FLAGS += --use-image-digests
47- endif
48-
49- # Set the Operator SDK version to use. By default, what is installed on the system is used.
50- # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit.
51- OPERATOR_SDK_VERSION ?= v1.31.0
52-
531# Image URL to use all building/pushing image targets
542IMG ?= controller:latest
553# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
@@ -197,7 +145,7 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
197145ENVTEST ?= $(LOCALBIN ) /setup-envtest
198146
199147# # Tool Versions
200- KUSTOMIZE_VERSION ?= v3.8.7
148+ KUSTOMIZE_VERSION ?= v5.4.2
201149CONTROLLER_TOOLS_VERSION ?= v0.14.0
202150
203151KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
@@ -221,79 +169,6 @@ envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
221169$(ENVTEST ) : $(LOCALBIN )
222170 test -s $(LOCALBIN ) /setup-envtest || GOBIN=$(LOCALBIN ) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
223171
224- .PHONY : operator-sdk
225- OPERATOR_SDK ?= $(LOCALBIN ) /operator-sdk
226- operator-sdk : # # Download operator-sdk locally if necessary.
227- ifeq (,$(wildcard $(OPERATOR_SDK ) ) )
228- ifeq (, $(shell which operator-sdk 2>/dev/null) )
229- @{ \
230- set -e ;\
231- mkdir -p $(dir $(OPERATOR_SDK)) ;\
232- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
233- curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH} ;\
234- chmod +x $(OPERATOR_SDK) ;\
235- }
236- else
237- OPERATOR_SDK = $(shell which operator-sdk)
238- endif
239- endif
240-
241- .PHONY : bundle
242- bundle : manifests kustomize operator-sdk # # Generate bundle manifests and metadata, then validate generated files.
243- $(OPERATOR_SDK ) generate kustomize manifests -q
244- cd config/manager && $(KUSTOMIZE ) edit set image controller=$(IMG )
245- $(KUSTOMIZE ) build config/manifests | $(OPERATOR_SDK ) generate bundle $(BUNDLE_GEN_FLAGS )
246- $(OPERATOR_SDK ) bundle validate ./bundle
247-
248- .PHONY : bundle-build
249- bundle-build : # # Build the bundle image.
250- $(CONTAINER_TOOL ) build -f bundle.Dockerfile -t $(BUNDLE_IMG ) .
251-
252- .PHONY : bundle-push
253- bundle-push : # # Push the bundle image.
254- $(MAKE ) docker-push IMG=$(BUNDLE_IMG )
255-
256- .PHONY : opm
257- OPM = ./bin/opm
258- opm : # # Download opm locally if necessary.
259- ifeq (,$(wildcard $(OPM ) ) )
260- ifeq (,$(shell which opm 2>/dev/null) )
261- @{ \
262- set -e ;\
263- mkdir -p $(dir $(OPM)) ;\
264- OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
265- curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\
266- chmod +x $(OPM) ;\
267- }
268- else
269- OPM = $(shell which opm)
270- endif
271- endif
272-
273- # 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).
274- # These images MUST exist in a registry and be pull-able.
275- BUNDLE_IMGS ?= $(BUNDLE_IMG )
276-
277- # The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0).
278- CATALOG_IMG ?= $(IMAGE_TAG_BASE ) -catalog:v$(VERSION )
279-
280- # Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
281- ifneq ($(origin CATALOG_BASE_IMG ) , undefined)
282- FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG )
283- endif
284-
285- # Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
286- # This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
287- # https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
288- .PHONY : catalog-build
289- catalog-build : opm # # Build a catalog image.
290- $(OPM ) index add --container-tool $(CONTAINER_TOOL ) --mode semver --tag $(CATALOG_IMG ) --bundles $(BUNDLE_IMGS ) $(FROM_INDEX_OPT )
291-
292- # Push the catalog image.
293- .PHONY : catalog-push
294- catalog-push : # # Push a catalog image.
295- $(MAKE ) docker-push IMG=$(CATALOG_IMG )
296-
297172MANIFEST_TARBALL := $(OUTDIR ) /operator.tar.gz
298173
299174# Clean generated files & artifacts
@@ -304,5 +179,7 @@ clean:
304179# Package the config/ directory into a tarball for deployment via infra-deployments.
305180.PHONY : package
306181package : kustomize $(OUTDIR )
307- cd config/manager && $(KUSTOMIZE ) edit set image controller=${IMG}
182+ cd config/manager && \
183+ $(KUSTOMIZE ) edit set image controller=${IMG} && \
184+ $(KUSTOMIZE ) edit add configmap operator-config --behavior=replace --from-literal=kubesaw.namespace=toolchain-host-operator
308185 tar -caf $(MANIFEST_TARBALL ) config/
0 commit comments