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

OCPBUGS-32268: chore: remove image based FBC and replace with dynamic generation #609

Merged
merged 1 commit into from
Apr 16, 2024
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
59 changes: 37 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,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 @@ -231,31 +257,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 @@ -326,7 +341,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.36.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
170 changes: 0 additions & 170 deletions catalog/lvms-operator/operator.yaml

This file was deleted.

Loading