Skip to content

Commit

Permalink
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 <[email protected]>
  • Loading branch information
Madhu-1 committed Feb 1, 2023
1 parent 2c1e6a9 commit 9897004
Show file tree
Hide file tree
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
Expand Up @@ -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) --extra-service-accounts=ocs-client-operator-csi-cephfs-provisioner-sa,ocs-client-operator-csi-cephfs-plugin-sa,ocs-client-operator-csi-rbd-provisioner-sa,ocs-client-operator-csi-rbd-plugin-sa,ocs-client-operator-status-reporter
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
Expand Down
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
Expand Up @@ -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.
Expand All @@ -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)

Expand All @@ -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)
Expand All @@ -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 9897004

Please sign in to comment.