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 <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2022-03-09 15:53:43 -07:00
1 parent a181988f6d
commit d86bb78f11
2 files changed
+20 -15

No files matched your search

+19
View File
@@ -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
+1 -15
View File
@@ -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)