Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
added make run-bundle and make cleanup-bundle
- updated related make targets for generating proper bundle CSV
- yq automatically added indentation to CSV

downgraded operator sdk version to v1.29.0
- because hitting same issue as cs-operator operator-framework/operator-sdk#6584

Signed-off-by: Henry H Li <[email protected]>
  • Loading branch information
bitscuit committed Oct 30, 2023
commit 3a63ee32d013075c7564b64ace74f679cf84c3a7
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
RELEASE_VERSION ?= $(shell cat ./version/version.go | grep "Version =" | awk '{ print $$3}' | tr -d '"')
LATEST_VERSION ?= latest
OPERATOR_SDK_VERSION=v1.24.0
YQ_VERSION=v4.3.1
YQ_VERSION=v4.17.2
DEFAULT_CHANNEL ?= v$(shell cat ./version/version.go | grep "Version =" | awk '{ print $$3}' | tr -d '"' | cut -d '.' -f1,2)
CHANNELS ?= $(DEFAULT_CHANNEL)

LOCAL_OS := $(shell uname)
ifeq ($(LOCAL_OS),Linux)
Expand Down Expand Up @@ -206,6 +208,10 @@ bundle-manifests:
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle \
-q --overwrite --version $(OPERATOR_VERSION) $(BUNDLE_METADATA_OPTS)
$(OPERATOR_SDK) bundle validate ./bundle
$(YQ) eval-all -i '.spec.relatedImages = load("config/manifests/bases/operand-deployment-lifecycle-manager.clusterserviceversion.yaml").spec.relatedImages' bundle/manifests/operand-deployment-lifecycle-manager.clusterserviceversion.yaml
# Need to replace fields this way to avoid changing PROJECT name and CSV file name, which may or may not impact CICD automation
$(YQ) e -i '.annotations["operators.operatorframework.io.bundle.package.v1"] = "ibm-odlm"' bundle/metadata/annotations.yaml
sed -i'' s/operand-deployment-lifecycle-manager/ibm-odlm/ bundle.Dockerfile

generate-all: manifests kustomize operator-sdk ## Generate bundle manifests, metadata and package manifests
$(OPERATOR_SDK) generate kustomize manifests -q
Expand Down Expand Up @@ -260,8 +266,8 @@ build-operator-image: $(CONFIG_DOCKER_TARGET) ## Build the operator image.
--build-arg GOARCH=$(LOCAL_ARCH) -f Dockerfile .

build-operator-dev-image: ## Build the operator dev image.
@echo "Building the $(OPERATOR_IMAGE_NAME) docker image..."
@docker build -t $(OPERATOR_IMAGE_NAME):$(VERSION) \
@echo "Building the $(DEV_REGISTRY)/$(OPERATOR_IMAGE_NAME) docker image..."
@docker build -t $(DEV_REGISTRY)/$(OPERATOR_IMAGE_NAME):$(VERSION) \
--build-arg VCS_REF=$(VCS_REF) --build-arg VCS_URL=$(VCS_URL) \
--build-arg GOARCH=$(LOCAL_ARCH) -f Dockerfile .

Expand All @@ -275,7 +281,6 @@ build-test-operator-image: $(CONFIG_DOCKER_TARGET) ## Build the operator test im

build-push-dev-image: build-operator-dev-image ## Build and push the operator dev images.
@echo "Pushing the $(DEV_REGISTRY)/$(OPERATOR_IMAGE_NAME):$(VERSION) docker image to $(DEV_REGISTRY)..."
@docker tag $(OPERATOR_IMAGE_NAME):$(VERSION) $(DEV_REGISTRY)/$(OPERATOR_IMAGE_NAME):$(VERSION)
@docker push $(DEV_REGISTRY)/$(OPERATOR_IMAGE_NAME):$(VERSION)

build-push-image: $(CONFIG_DOCKER_TARGET) build-operator-image ## Build and push the operator images.
Expand All @@ -284,12 +289,9 @@ build-push-image: $(CONFIG_DOCKER_TARGET) build-operator-image ## Build and pus
@docker push $(ARTIFACTORYA_REGISTRY)/$(OPERATOR_IMAGE_NAME)-$(LOCAL_ARCH):$(VERSION)

build-push-bundle-image: yq
@cp -f bundle/manifests/operand-deployment-lifecycle-manager.clusterserviceversion.yaml /tmp/operand-deployment-lifecycle-manager.clusterserviceversion.yaml
$(YQ) eval -i 'del(.spec.replaces)' bundle/manifests/operand-deployment-lifecycle-manager.clusterserviceversion.yaml
@docker build -f bundle.Dockerfile -t $(QUAY_REGISTRY)/$(BUNDLE_IMAGE_NAME)-$(LOCAL_ARCH):$(VERSION) .
@echo "Pushing the $(BUNDLE_IMAGE_NAME) docker image for $(LOCAL_ARCH)..."
@docker push $(QUAY_REGISTRY)/$(BUNDLE_IMAGE_NAME)-$(LOCAL_ARCH):$(VERSION)
@mv /tmp/operand-deployment-lifecycle-manager.clusterserviceversion.yaml bundle/manifests/operand-deployment-lifecycle-manager.clusterserviceversion.yaml

build-catalog-source:
@opm -u docker index add --bundles $(QUAY_REGISTRY)/$(BUNDLE_IMAGE_NAME)-$(LOCAL_ARCH):$(VERSION) --tag $(QUAY_REGISTRY)/$(OPERATOR_IMAGE_NAME)-catalog:$(VERSION)
Expand All @@ -300,6 +302,12 @@ build-catalog: build-push-bundle-image build-catalog-source
multiarch-image: $(CONFIG_DOCKER_TARGET) ## Generate multiarch images for operator image.
@MAX_PULLING_RETRY=20 RETRY_INTERVAL=30 common/scripts/multiarch_image.sh $(ARTIFACTORYA_REGISTRY) $(OPERATOR_IMAGE_NAME) $(VERSION) $(RELEASE_VERSION)

run-bundle:
$(OPERATOR_SDK) run bundle $(QUAY_REGISTRY)/$(BUNDLE_IMAGE_NAME)-$(LOCAL_ARCH):$(VERSION) --install-mode OwnNamespace

cleanup-bundle:
$(OPERATOR_SDK) cleanup ibm-odlm

##@ Help
help: ## Display this help
@echo "Usage:\n make \033[36m<target>\033[0m"
Expand Down
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=ibm-odlm
LABEL operators.operatorframework.io.bundle.channels.v1=v4.2
LABEL operators.operatorframework.io.bundle.channel.default.v1=v4.2
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.24.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.29.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Loading