Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.15] OCPBUGS-32269: chore: remove image based FBC and replace with dynamic generation #610

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 38 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,32 @@ REPLACES ?=
# but can skip several. This can be accomplished using the skipRange annotation:
SKIP_RANGE ?=

## Variables for the catalog

# CATALOG_IMG defines the image used for the catalog.
CATALOG_IMAGE_NAME ?= $(IMAGE_NAME)-catalog
CATALOG_REPO ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(CATALOG_IMAGE_NAME)
CATALOG_IMG ?= $(CATALOG_REPO):$(IMAGE_TAG)
CATALOG_DIR ?= ./catalog

define CATALOG_CHANNEL
---
schema: olm.channel
package: $(IMAGE_NAME)
name: alpha
entries:
- name: lvms-operator.v$(OPERATOR_VERSION)
endef
export CATALOG_CHANNEL

define CATALOG_PACKAGE
---
schema: olm.package
name: $(IMAGE_NAME)
defaultChannel: alpha
endef
export CATALOG_PACKAGE

##@ Development

manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
Expand Down Expand Up @@ -271,31 +297,20 @@ bundle-push: ## Push the bundle image.
$(MAKE) docker-push IMG=$(BUNDLE_IMG)

##@ Catalog image

# 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).
# These images MUST exist in a registry and be pull-able.
BUNDLE_IMGS ?= $(BUNDLE_IMG)

# CATALOG_IMG defines the image used for the catalog.
CATALOG_IMAGE_NAME ?= $(IMAGE_NAME)-catalog
CATALOG_REPO ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(CATALOG_IMAGE_NAME)
CATALOG_IMG ?= $(CATALOG_REPO):$(IMAGE_TAG)

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif

.PHONY: catalog-render
catalog-render: opm ## Render the catalog based on the given bundle
$(OPM) render $(BUNDLE_IMG) -oyaml > ./catalog/lvms-operator/operator.yaml
$(OPM) validate ./catalog
.PHONY: catalog
catalog: ## Render a catalog from the bundle by wrapping it in a alpha channel.
@echo "Rendering the catalog at $(CATALOG_DIR)"
@rm -rf $(CATALOG_DIR)
@mkdir -p $(CATALOG_DIR)/$(IMAGE_NAME)
@echo "$$CATALOG_CHANNEL" > $(CATALOG_DIR)/channel.yaml
@echo "$$CATALOG_PACKAGE" > $(CATALOG_DIR)/package.yaml
$(OPM) render ./bundle -oyaml > $(CATALOG_DIR)/$(IMAGE_NAME)/v$(OPERATOR_VERSION).yaml
$(OPM) validate $(CATALOG_DIR)

.PHONY: catalog-build
catalog-build: opm catalog-render ## Build a catalog image.
catalog-build: opm catalog ## Build a catalog image from the rendered catalog.
$(IMAGE_BUILD_CMD) build -f catalog.Dockerfile -t $(CATALOG_IMG) .

# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
$(MAKE) docker-push IMG=$(CATALOG_IMG)
Expand Down Expand Up @@ -337,7 +352,7 @@ kustomize: ## Download kustomize locally if necessary.

ENVTEST = $(shell pwd)/bin/setup-envtest
envtest: ## Download envtest-setup locally if necessary.
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@bf15e44028f908c790721fc8fe67c7bf2d06a611)

JSONNET = $(shell pwd)/bin/jsonnet
jsonnet: ## Download jsonnet locally if necessary.
Expand Down Expand Up @@ -366,7 +381,7 @@ ifeq (,$(shell which opm 2>/dev/null))
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.30.0/$${OS}-$${ARCH}-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.39.0/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
Expand Down
160 changes: 0 additions & 160 deletions catalog/lvms-operator/operator.yaml

This file was deleted.

Loading