From 7bc9a138f2aa2d536054dbce366b272729bcf9f2 Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Thu, 26 Aug 2021 16:51:14 +0530 Subject: [PATCH] ci: image list for offline installation create file tests/scripts/rook-ceph-image.txt which will have list of images required for offline installation. Closes: https://github.com/rook/rook/issues/6406 Signed-off-by: subhamkrai --- cluster/examples/kubernetes/ceph/images.txt | 9 ++++++++ images/ceph/Makefile | 23 +++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 cluster/examples/kubernetes/ceph/images.txt diff --git a/cluster/examples/kubernetes/ceph/images.txt b/cluster/examples/kubernetes/ceph/images.txt new file mode 100644 index 000000000000..bf7a39899619 --- /dev/null +++ b/cluster/examples/kubernetes/ceph/images.txt @@ -0,0 +1,9 @@ + rook/ceph:master + quay.io/ceph/ceph:v16.2.5 + quay.io/cephcsi/cephcsi:v3.4.0 + k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.2.0 + k8s.gcr.io/sig-storage/csi-resizer:v1.2.0 + k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2 + k8s.gcr.io/sig-storage/csi-snapshotter:v4.1.1 + k8s.gcr.io/sig-storage/csi-attacher:v3.2.1 + quay.io/csiaddons/volumereplication-operator:v0.1.0 diff --git a/images/ceph/Makefile b/images/ceph/Makefile index eea0bb3f06c7..a053b0865a66 100755 --- a/images/ceph/Makefile +++ b/images/ceph/Makefile @@ -29,6 +29,7 @@ OPERATOR_SDK_VERSION = v0.17.1 # TODO: update to yq v4 - v3 end of life in Aug 2021 ; v4 removes the 'yq delete' cmd and changes syntax YQ_VERSION = 3.3.0 GOHOST := GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go +MANIFESTS_DIR=../../cluster/examples/kubernetes/ceph TEMP := $(shell mktemp -d) @@ -60,10 +61,12 @@ do.build: @cp set-ceph-debug-level $(TEMP) @cp $(OUTPUT_DIR)/bin/linux_$(GOARCH)/rook $(TEMP) @cp $(OUTPUT_DIR)/bin/linux_$(GOARCH)/rookflex $(TEMP) - @cp -r ../../cluster/examples/kubernetes/ceph/monitoring $(TEMP)/ceph-monitoring + @cp -r $(MANIFESTS_DIR)/monitoring $(TEMP)/ceph-monitoring @mkdir -p $(TEMP)/rook-external/test-data - @cp ../../cluster/examples/kubernetes/ceph/create-external-cluster-resources.* $(TEMP)/rook-external/ - @cp ../../cluster/examples/kubernetes/ceph/test-data/ceph-status-out $(TEMP)/rook-external/test-data/ + @cp $(MANIFESTS_DIR)/create-external-cluster-resources.* $(TEMP)/rook-external/ + @cp $(MANIFESTS_DIR)/test-data/ceph-status-out $(TEMP)/rook-external/test-data/ + @$(MAKE) list-image + ifeq ($(INCLUDE_CSV_TEMPLATES),true) @$(MAKE) CSV_TEMPLATE_DIR=$(TEMP) generate-csv-templates @cp -r $(TEMP)/cluster/olm/ceph/templates $(TEMP)/ceph-csv-templates @@ -90,7 +93,7 @@ generate-csv-templates: $(OPERATOR_SDK) $(YQ) ## Generate CSV templates for OLM @mkdir -p $(CSV_TEMPLATE_DIR) @cp -a ../../cluster $(CSV_TEMPLATE_DIR)/cluster @set -eE;\ - BEFORE_GEN_CRD_SIZE=$$(wc -l < ../../cluster/examples/kubernetes/ceph/crds.yaml);\ + BEFORE_GEN_CRD_SIZE=$$(wc -l < $(MANIFESTS_DIR)/crds.yaml);\ $(MAKE) -C ../.. NO_OB_OBC_VOL_GEN=true MAX_DESC_LEN=0 BUILD_CRDS_INTO_DIR=$(CSV_TEMPLATE_DIR) crds;\ AFTER_GEN_CRD_SIZE=$$(wc -l < $(CSV_TEMPLATE_DIR)/cluster/examples/kubernetes/ceph/crds.yaml);\ if [ "$$BEFORE_GEN_CRD_SIZE" -le "$$AFTER_GEN_CRD_SIZE" ]; then\ @@ -121,3 +124,15 @@ csv: $(OPERATOR_SDK) $(YQ) ## Generate a CSV file for OLM. csv-clean: $(OPERATOR_SDK) $(YQ) ## Remove existing OLM files. @rm -fr ../../cluster/olm/ceph/deploy/* ../../cluster/olm/ceph/templates/* + +# list-image creates list of images for offline installation +list-image: + @echo "producing list of images for offline installation";\ + # remove the file if already exists + rm -f $(MANIFESTS_DIR)/images.txt;\ + awk '/image:/ {print $2}' $(MANIFESTS_DIR)/operator.yaml $(MANIFESTS_DIR)/cluster.yaml | \ + cut -d: -f2- |\ + tee -a $(MANIFESTS_DIR)/images.txt && \ + awk '/quay.io/ || /k8s.gcr.io/ {print $3}' $(MANIFESTS_DIR)/operator.yaml | \ + cut -d: -f2- |\ + tr -d '"' | tee -a $(MANIFESTS_DIR)/images.txt