|
2 | 2 | include Makefile.version |
3 | 3 | include make/license.mk |
4 | 4 |
|
5 | | -# CHANNELS define the bundle channels used in the bundle. |
6 | | -# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") |
7 | | -# To re-generate a bundle for other specific channels without changing the standard setup, you can: |
8 | | -# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=candidate,fast,stable) |
9 | | -# - use environment variables to overwrite this value (e.g export CHANNELS="candidate,fast,stable") |
10 | | -ifneq ($(origin CHANNELS), undefined) |
11 | | -BUNDLE_CHANNELS := --channels=$(CHANNELS) |
12 | | -endif |
13 | | - |
14 | | -# DEFAULT_CHANNEL defines the default channel used in the bundle. |
15 | | -# Add a new line here if you would like to change its default config. (E.g DEFAULT_CHANNEL = "stable") |
16 | | -# To re-generate a bundle for any other default channel without changing the default setup, you can: |
17 | | -# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable) |
18 | | -# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable") |
19 | | -ifneq ($(origin DEFAULT_CHANNEL), undefined) |
20 | | -BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL) |
21 | | -endif |
22 | | -BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL) |
23 | | - |
24 | | -# IMAGE_TAG_BASE defines the docker.io namespace and part of the image name for remote images. |
25 | | -# This variable is used to construct full image tags for bundle and catalog images. |
26 | | -# |
27 | | -# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both |
28 | | -# nvidia.com/nic-configuration-operator-bundle:$VERSION and nvidia.com/nic-configuration-operator-catalog:$VERSION. |
29 | | -IMAGE_TAG_BASE ?= nvidia.com/nic-configuration-operator |
30 | | - |
31 | | -# BUNDLE_IMG defines the image:tag used for the bundle. |
32 | | -# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>) |
33 | | -BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION) |
34 | | - |
35 | | -# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command |
36 | | -BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) |
37 | | - |
38 | | -# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests |
39 | | -# You can enable this value if you would like to use SHA Based Digests |
40 | | -# To enable set flag to true |
41 | | -USE_IMAGE_DIGESTS ?= false |
42 | | -ifeq ($(USE_IMAGE_DIGESTS), true) |
43 | | - BUNDLE_GEN_FLAGS += --use-image-digests |
44 | | -endif |
45 | | - |
46 | | -BUNDLE_OCP_VERSIONS=v4.14-v4.17 |
47 | | - |
48 | 5 | # Set the Operator SDK version to use. By default, what is installed on the system is used. |
49 | 6 | # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit. |
50 | 7 | OPERATOR_SDK_VERSION ?= v1.36.0 |
@@ -334,64 +291,6 @@ OPERATOR_SDK = $(shell which operator-sdk) |
334 | 291 | endif |
335 | 292 | endif |
336 | 293 |
|
337 | | -.PHONY: bundle |
338 | | -bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metadata, then validate generated files. |
339 | | - $(OPERATOR_SDK) generate kustomize manifests -q |
340 | | - cd config/manager && $(KUSTOMIZE) edit set image controller=$(OPERATOR_IMAGE_TAG) |
341 | | - cd config/daemon && $(KUSTOMIZE) edit set configmap config --from-literal=configDaemonImage=$(CONFIG_DAEMON_IMAGE_TAG) --from-literal=releaseVersion=${VERSION} |
342 | | - $(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS) |
343 | | - BUNDLE_OCP_VERSIONS=$(BUNDLE_OCP_VERSIONS) OPERATOR_IMAGE_TAG=$(OPERATOR_IMAGE_TAG) CONFIG_DAEMON_IMAGE_TAG=$(CONFIG_DAEMON_IMAGE_TAG) hack/scripts/ocp-bundle-postprocess.sh |
344 | | - $(OPERATOR_SDK) bundle validate ./bundle |
345 | | - |
346 | | -.PHONY: bundle-build |
347 | | -bundle-build: ## Build the bundle image. |
348 | | - docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) . |
349 | | - |
350 | | -.PHONY: bundle-push |
351 | | -bundle-push: ## Push the bundle image. |
352 | | - $(CONTAINER_TOOL) push $(BUNDLE_IMG) |
353 | | - |
354 | | -.PHONY: opm |
355 | | -OPM = $(LOCALBIN)/opm |
356 | | -opm: ## Download opm locally if necessary. |
357 | | -ifeq (,$(wildcard $(OPM))) |
358 | | -ifeq (,$(shell which opm 2>/dev/null)) |
359 | | - @{ \ |
360 | | - set -e ;\ |
361 | | - mkdir -p $(dir $(OPM)) ;\ |
362 | | - OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ |
363 | | - curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$${OS}-$${ARCH}-opm ;\ |
364 | | - chmod +x $(OPM) ;\ |
365 | | - } |
366 | | -else |
367 | | -OPM = $(shell which opm) |
368 | | -endif |
369 | | -endif |
370 | | - |
371 | | -# 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). |
372 | | -# These images MUST exist in a registry and be pull-able. |
373 | | -BUNDLE_IMGS ?= $(BUNDLE_IMG) |
374 | | - |
375 | | -# The image tag given to the resulting catalog image (e.g. make catalog-build CATALOG_IMG=example.com/operator-catalog:v0.2.0). |
376 | | -CATALOG_IMG ?= $(IMAGE_TAG_BASE)-catalog:v$(VERSION) |
377 | | - |
378 | | -# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image. |
379 | | -ifneq ($(origin CATALOG_BASE_IMG), undefined) |
380 | | -FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG) |
381 | | -endif |
382 | | - |
383 | | -# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'. |
384 | | -# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see: |
385 | | -# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator |
386 | | -.PHONY: catalog-build |
387 | | -catalog-build: opm ## Build a catalog image. |
388 | | - $(OPM) index add --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT) |
389 | | - |
390 | | -# Push the catalog image. |
391 | | -.PHONY: catalog-push |
392 | | -catalog-push: ## Push a catalog image. |
393 | | - $(MAKE) docker-push IMG=$(CATALOG_IMG) |
394 | | - |
395 | 294 | .PHONY: chart-prepare-release |
396 | 295 | chart-prepare-release: | $(YQ) ## prepare helm chart for release |
397 | 296 | @GITHUB_TAG=$(GITHUB_TAG) GITHUB_REPO_OWNER=$(GITHUB_REPO_OWNER) hack/release/chart-update.sh |
|
0 commit comments