From d86bb78f11f7eed26da56fedb2ca4ce11b55682e Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Mon, 7 Mar 2022 16:44:43 -0700 Subject: [PATCH 1/3] build: add volume replication crds to csv ownership The volume replication crds are not owned by rook, but if installing with the csv, ownership must be specified for the CRDs. Thus, we limit ownership to the csv for the volume replication crds. Signed-off-by: Travis Nielsen --- build/crds/build-crds.sh | 19 +++++++++++++++++++ images/ceph/Makefile | 16 +--------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/build/crds/build-crds.sh b/build/crds/build-crds.sh index 06c652a8c..03de72f90 100755 --- a/build/crds/build-crds.sh +++ b/build/crds/build-crds.sh @@ -51,6 +51,21 @@ copy_ob_obc_crds() { cp -f "${SCRIPT_ROOT}/deploy/olm/assemble/objectbucket.io_objectbuckets.yaml" "$OLM_CATALOG_DIR" } +copy_volume_replication_crds() { + volume_replication_dir=${SCRIPT_ROOT}/.cache/crds/volumereplication + volume_replication_crd=replication.storage.openshift.io_volumereplications.yaml + volume_replication_class_crd=replication.storage.openshift.io_volumereplicationclasses.yaml + if [[ ! -d "${volume_replication_dir}" ]]; then + mkdir -p "${volume_replication_dir}" + volume_replication_url=https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases + curl -L ${volume_replication_url}/${volume_replication_crd} -o ${volume_replication_dir}/${volume_replication_crd} + curl -L ${volume_replication_url}/${volume_replication_class_crd} -o ${volume_replication_dir}/${volume_replication_class_crd} + fi + + cp -f "${volume_replication_dir}/${volume_replication_crd}" "$OLM_CATALOG_DIR" + cp -f "${volume_replication_dir}/${volume_replication_class_crd}" "$OLM_CATALOG_DIR" +} + generating_crds_v1() { echo "Generating ceph crds" "$CONTROLLER_GEN_BIN_PATH" "$CRD_OPTIONS" paths="./pkg/apis/ceph.rook.io/v1" output:crd:artifacts:config="$OLM_CATALOG_DIR" @@ -106,3 +121,7 @@ echo "---" >> "$CEPH_CRDS_FILE_PATH" # yq doesn't output the first doc separator $YQ_BIN_PATH eval-all '.' "${CRD_FILES[@]}" >> "$CEPH_CRDS_FILE_PATH" build_helm_resources + +# copy the volume replication crds last so they won't be included in the helm chart or crds.yaml, +# we just want them to end up owned by the csv +copy_volume_replication_crds diff --git a/images/ceph/Makefile b/images/ceph/Makefile index 3355b470d..6e3738c4d 100755 --- a/images/ceph/Makefile +++ b/images/ceph/Makefile @@ -59,11 +59,6 @@ endif # s5cmd's version S5CMD_VERSION = 1.4.0 -VOL_REPL_VERSION = v0.1.0 -VOL_REPL_URL = https://raw.githubusercontent.com/csi-addons/volume-replication-operator/$(VOL_REPL_VERSION)/config/crd/bases -VOLUME_REPLICATION_CRD = replication.storage.openshift.io_volumereplications.yaml -VOLUME_REPLICATION_CLASS_CRD = replication.storage.openshift.io_volumereplicationclasses.yaml - OPERATOR_SDK := $(TOOLS_HOST_DIR)/operator-sdk-$(OPERATOR_SDK_VERSION) YQv3 := $(TOOLS_HOST_DIR)/yq-$(YQv3_VERSION) export OPERATOR_SDK YQv3 @@ -84,8 +79,6 @@ do.build: ifeq ($(INCLUDE_CSV_TEMPLATES),true) @$(MAKE) CSV_TEMPLATE_DIR=$(TEMP) generate-csv-templates - @$(MAKE) get-volume-replication-crds - cp $(CACHE_DIR)/crds/* $(TEMP)/deploy/olm/templates/crds/. @cp -r $(TEMP)/deploy/olm/templates $(TEMP)/ceph-csv-templates else mkdir $(TEMP)/ceph-csv-templates @@ -102,7 +95,7 @@ endif # call this before building multiple arches in parallel to prevent parallel build processes from # conflicting -prerequisites: $(OPERATOR_SDK) $(YQv3) get-volume-replication-crds +prerequisites: $(OPERATOR_SDK) $(YQv3) # generate CSV template files into the directory defined by the env var CSV_TEMPLATE_DIR # CSV_TEMPLATE_DIR will be created if it doesn't already exist @@ -126,13 +119,6 @@ generate-csv-templates: $(OPERATOR_SDK) $(YQv3) ## Generate CSV templates for OL @OLM_CATALOG_DIR=$(CSV_TEMPLATE_DIR)/deploy/olm ../../deploy/olm/generate-rook-csv-templates.sh @echo " === Generated CSV templates can be found at $(CSV_TEMPLATE_DIR)/deploy/olm/templates" -get-volume-replication-crds: - if [[ ! -d "$(CACHE_DIR)/crds" ]]; then\ - mkdir -p $(CACHE_DIR)/crds;\ - curl -L $(VOL_REPL_URL)/$(VOLUME_REPLICATION_CRD) -o $(CACHE_DIR)/crds/$(VOLUME_REPLICATION_CRD);\ - curl -L $(VOL_REPL_URL)/$(VOLUME_REPLICATION_CLASS_CRD) -o $(CACHE_DIR)/crds/$(VOLUME_REPLICATION_CLASS_CRD);\ - fi - $(YQv3): @echo === installing yq $(YQv3_VERSION) $(REAL_HOST_PLATFORM) @mkdir -p $(TOOLS_HOST_DIR) From 75a385e1871b3ee89a98d309baaa56facd4a0ace Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 9 Mar 2022 08:18:27 -0700 Subject: [PATCH 2/3] csi: update volume replication to v0.3.0 Update to the latest volume replication crd version of v0.3.0 Signed-off-by: Travis Nielsen --- Documentation/ceph-csi-drivers.md | 4 ++-- Documentation/rbd-mirroring.md | 4 ++-- build/crds/build-crds.sh | 2 +- tests/framework/installer/ceph_installer.go | 2 +- tests/scripts/github-action-helper.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/ceph-csi-drivers.md b/Documentation/ceph-csi-drivers.md index 75c733864..91b2a6f2a 100644 --- a/Documentation/ceph-csi-drivers.md +++ b/Documentation/ceph-csi-drivers.md @@ -89,8 +89,8 @@ Kubernetes version 1.21 or greater is required. 1. Install the volume replication CRDs: ```console -kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases/replication.storage.openshift.io_volumereplications.yaml -kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases/replication.storage.openshift.io_volumereplicationclasses.yaml +kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases/replication.storage.openshift.io_volumereplications.yaml +kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases/replication.storage.openshift.io_volumereplicationclasses.yaml ``` 2. Enable the volume replication controller: diff --git a/Documentation/rbd-mirroring.md b/Documentation/rbd-mirroring.md index 1e1c3ba3b..b43da2d6d 100644 --- a/Documentation/rbd-mirroring.md +++ b/Documentation/rbd-mirroring.md @@ -188,9 +188,9 @@ APIs for storage disaster recovery. The extended APIs are provided via Custom Resource Definition(CRD). Create the VolumeReplication CRDs on all the peer clusters. ```bash -$ kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases/replication.storage.openshift.io_volumereplications.yaml +$ kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases/replication.storage.openshift.io_volumereplications.yaml -$ kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases/replication.storage.openshift.io_volumereplicationclasses.yaml +$ kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases/replication.storage.openshift.io_volumereplicationclasses.yaml ``` ## Enable CSI Replication Sidecars diff --git a/build/crds/build-crds.sh b/build/crds/build-crds.sh index 03de72f90..900959de6 100755 --- a/build/crds/build-crds.sh +++ b/build/crds/build-crds.sh @@ -57,7 +57,7 @@ copy_volume_replication_crds() { volume_replication_class_crd=replication.storage.openshift.io_volumereplicationclasses.yaml if [[ ! -d "${volume_replication_dir}" ]]; then mkdir -p "${volume_replication_dir}" - volume_replication_url=https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.1.0/config/crd/bases + volume_replication_url=https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases curl -L ${volume_replication_url}/${volume_replication_crd} -o ${volume_replication_dir}/${volume_replication_crd} curl -L ${volume_replication_url}/${volume_replication_class_crd} -o ${volume_replication_dir}/${volume_replication_class_crd} fi diff --git a/tests/framework/installer/ceph_installer.go b/tests/framework/installer/ceph_installer.go index 6de61970e..5105d54a3 100644 --- a/tests/framework/installer/ceph_installer.go +++ b/tests/framework/installer/ceph_installer.go @@ -59,7 +59,7 @@ const ( osd_pool_default_size = 1 bdev_flock_retry = 20 ` - volumeReplicationVersion = "v0.1.0" + volumeReplicationVersion = "v0.3.0" ) var ( diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index 972ef3371..0b8c0bffe 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -166,7 +166,7 @@ function validate_yaml() { kubectl create -f crds.yaml -f common.yaml # create the volume replication CRDs - replication_version=v0.1.0 + replication_version=v0.3.0 replication_url="https://raw.githubusercontent.com/csi-addons/volume-replication-operator/${replication_version}/config/crd/bases" kubectl create -f "${replication_url}/replication.storage.openshift.io_volumereplications.yaml" kubectl create -f "${replication_url}/replication.storage.openshift.io_volumereplicationclasses.yaml" From 2453a5a71bbfec517ea0a40c62284e412768caa9 Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Wed, 9 Mar 2022 16:17:09 -0700 Subject: [PATCH 3/3] build: allow overriding the volume replication crd url Custom builds such as downstream may need to use an alternate version, fork, or branch for the volume replication CRDs. If the build sets the env var VOLUME_REPLICATION_URL, this value will be used. The default url is https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases Signed-off-by: Travis Nielsen --- build/crds/build-crds.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/crds/build-crds.sh b/build/crds/build-crds.sh index 900959de6..bc4281813 100755 --- a/build/crds/build-crds.sh +++ b/build/crds/build-crds.sh @@ -57,9 +57,9 @@ copy_volume_replication_crds() { volume_replication_class_crd=replication.storage.openshift.io_volumereplicationclasses.yaml if [[ ! -d "${volume_replication_dir}" ]]; then mkdir -p "${volume_replication_dir}" - volume_replication_url=https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases - curl -L ${volume_replication_url}/${volume_replication_crd} -o ${volume_replication_dir}/${volume_replication_crd} - curl -L ${volume_replication_url}/${volume_replication_class_crd} -o ${volume_replication_dir}/${volume_replication_class_crd} + VOLUME_REPLICATION_URL=${VOLUME_REPLICATION_URL:-https://raw.githubusercontent.com/csi-addons/volume-replication-operator/v0.3.0/config/crd/bases} + curl -L ${VOLUME_REPLICATION_URL}/${volume_replication_crd} -o ${volume_replication_dir}/${volume_replication_crd} + curl -L ${VOLUME_REPLICATION_URL}/${volume_replication_class_crd} -o ${volume_replication_dir}/${volume_replication_class_crd} fi cp -f "${volume_replication_dir}/${volume_replication_crd}" "$OLM_CATALOG_DIR"