Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: image list for offline installation #8596

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions cluster/examples/kubernetes/ceph/images.txt
Original file line number Diff line number Diff line change
@@ -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
23 changes: 19 additions & 4 deletions images/ceph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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\
Expand Down Expand Up @@ -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- |\
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to add this cut -d: -f2- because when running older command(cut -d: -f2-) from running from cli has no issue but when running from make build it generates in this format

          image: rook/ceph:master
    image: quay.io/ceph/ceph:v16.2.5
  # ROOK_CSI_CEPH_IMAGE: quay.io/cephcsi/cephcsi:v3.4.0
  # ROOK_CSI_REGISTRAR_IMAGE: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.2.0
  # ROOK_CSI_RESIZER_IMAGE: k8s.gcr.io/sig-storage/csi-resizer:v1.2.0
  # ROOK_CSI_PROVISIONER_IMAGE: k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2
  # ROOK_CSI_SNAPSHOTTER_IMAGE: k8s.gcr.io/sig-storage/csi-snapshotter:v4.1.1
  # ROOK_CSI_ATTACHER_IMAGE: k8s.gcr.io/sig-storage/csi-attacher:v3.2.1
  # CSI_VOLUME_REPLICATION_IMAGE: quay.io/csiaddons/volumereplication-operator:v0.1.0

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
Comment on lines +135 to +138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future reference, this should be replaced with lines that get the CSI-related images from pkg/operator/ceph/csi/spec.go