From 989700440af9718b6e0deaaca1525c2e990166da Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 23 Jan 2023 12:51:43 +0100 Subject: [PATCH] bundle: add csi-addons dependency 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 --- Makefile | 3 +++ bundle/metadata/dependencies.yaml | 5 +++++ config/metadata/dependencies.yaml | 5 +++++ hack/make-bundle-vars.mk | 12 +++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 bundle/metadata/dependencies.yaml create mode 100644 config/metadata/dependencies.yaml diff --git a/Makefile b/Makefile index f946b1e4..c53afac4 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/bundle/metadata/dependencies.yaml b/bundle/metadata/dependencies.yaml new file mode 100644 index 00000000..dcfeb21f --- /dev/null +++ b/bundle/metadata/dependencies.yaml @@ -0,0 +1,5 @@ +dependencies: +- type: olm.package + value: + packageName: csi-addons + version: 0.5.0 diff --git a/config/metadata/dependencies.yaml b/config/metadata/dependencies.yaml new file mode 100644 index 00000000..dcfeb21f --- /dev/null +++ b/config/metadata/dependencies.yaml @@ -0,0 +1,5 @@ +dependencies: +- type: olm.package + value: + packageName: csi-addons + version: 0.5.0 diff --git a/hack/make-bundle-vars.mk b/hack/make-bundle-vars.mk index 5b22d128..66cd27b8 100644 --- a/hack/make-bundle-vars.mk +++ b/hack/make-bundle-vars.mk @@ -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"