Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bundle: add csi-addons dependency
Browse files Browse the repository at this point in the history
Deploymemnt is done using a dependencies.yaml file,
to instruct OLM to bring and deploy csiaddons bundle
as part of ocs-client-operator bundle installation

The pakcage name and version is configurable when
running the make bundle command.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
Madhu-1 committed Jan 26, 2023
1 parent c194ad7 commit 4c856b2
Showing 4 changed files with 24 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -109,6 +109,9 @@ bundle: manifests kustomize operator-sdk ## Generate bundle manifests and metada
$(KUSTOMIZE) edit add patch --name ocs-client-operator.v0.0.0 --kind ClusterServiceVersion\
--patch '[{"op": "replace", "path": "/spec/replaces", "value": "$(REPLACES)"}]'
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
sed -i "s|packageName:.*|packageName: ${CSI_ADDONS_PACKAGE_NAME}|g" "config/metadata/dependencies.yaml"
sed -i "s|version:.*|version: "${CSI_ADDONS_PACKAGE_VERSION}"|g" "config/metadata/dependencies.yaml"
cp config/metadata/* bundle/metadata/
$(OPERATOR_SDK) bundle validate ./bundle

.PHONY: bundle-build
5 changes: 5 additions & 0 deletions bundle/metadata/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies:
- type: olm.package
value:
packageName: csi-addons
version: 0.5.0
5 changes: 5 additions & 0 deletions config/metadata/dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies:
- type: olm.package
value:
packageName: csi-addons
version: 0.5.0
12 changes: 11 additions & 1 deletion hack/make-bundle-vars.mk
Original file line number Diff line number Diff line change
@@ -36,9 +36,12 @@ SKIP_RANGE ?=
# Image URL to use all building/pushing image targets
IMAGE_REGISTRY ?= quay.io
REGISTRY_NAMESPACE ?= ocs-dev
CSI_ADDONS_REGISTRY_NAMESPACE ?= csiaddons
IMAGE_TAG ?= latest
IMAGE_NAME ?= ocs-client-operator
BUNDLE_IMAGE_NAME ?= $(IMAGE_NAME)-bundle
CSI_ADDONS_BUNDLE_IMAGE_NAME ?= k8s-bundle
CSI_ADDONS_BUNDLE_IMAGE_TAG ?= v0.5.0
CATALOG_IMAGE_NAME ?= $(IMAGE_NAME)-catalog

# IMG defines the image used for the operator.
@@ -47,6 +50,9 @@ IMG ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(IMAGE_NAME):$(IMAGE_TAG)
# BUNDLE_IMG defines the image used for the bundle.
BUNDLE_IMG ?= $(IMAGE_REGISTRY)/$(REGISTRY_NAMESPACE)/$(BUNDLE_IMAGE_NAME):$(IMAGE_TAG)

CSI_ADDONS_BUNDLE_IMG ?= $(IMAGE_REGISTRY)/$(CSI_ADDONS_REGISTRY_NAMESPACE)/$(CSI_ADDONS_BUNDLE_IMAGE_NAME):$(CSI_ADDONS_BUNDLE_IMAGE_TAG)


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

@@ -55,7 +61,7 @@ CRD_OPTIONS ?= "crd:trivialVersions=true,preserveUnknownFields=false"

# 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 ?= $(shell echo $(BUNDLE_IMG) | sed "s/ /,/g")
BUNDLE_IMGS ?= $(shell echo $(BUNDLE_IMG) $(CSI_ADDONS_BUNDLE_IMG) | sed "s/ /,/g")

# Set CATALOG_BASE_IMG to an existing catalog image tag to add $BUNDLE_IMGS to that image.
ifneq ($(origin CATALOG_BASE_IMG), undefined)
@@ -76,3 +82,7 @@ ifeq ($(CLUSTER_ENV), openshift)
else ifeq ($(CLUSTER_ENV), kubernetes)
RBAC_PROXY_IMG ?= $(KUBE_RBAC_PROXY_IMG)
endif

# csi-addons dependencies
CSI_ADDONS_PACKAGE_NAME ?= csi-addons
CSI_ADDONS_PACKAGE_VERSION ?= "0.5.0"

0 comments on commit 4c856b2

Please sign in to comment.