diff --git a/.github/workflows/crds-gen.yml b/.github/workflows/crds-gen.yml index f38345101..2fb7e60d6 100644 --- a/.github/workflows/crds-gen.yml +++ b/.github/workflows/crds-gen.yml @@ -1,8 +1,6 @@ name: CRDs gen on: pull_request: - paths: - - '**.go' jobs: crds-gen: diff --git a/Makefile b/Makefile index 16bc3cea4..f6ad3c8c8 100644 --- a/Makefile +++ b/Makefile @@ -167,6 +167,7 @@ distclean: clean ## Remove all files that are created by building or configuring prune: ## Prune cached artifacts. @$(MAKE) -C images prune +csv-ceph: export MAX_DESC_LEN=0 # sets the description length to 0 since CSV cannot be bigger than 1MB csv-ceph: crds ## Generate a CSV file for OLM. @echo Generating CSV manifests @cluster/olm/ceph/generate-rook-csv.sh $(CSV_VERSION) $(CSV_PLATFORM) $(ROOK_OP_VERSION) diff --git a/build/crds/build-crds.sh b/build/crds/build-crds.sh index d61538c54..4d41cbbb6 100755 --- a/build/crds/build-crds.sh +++ b/build/crds/build-crds.sh @@ -21,8 +21,9 @@ set -o pipefail SCRIPT_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd -P) CONTROLLER_GEN_BIN_PATH=$1 YQ_BIN_PATH=$2 +: "${MAX_DESC_LEN:=-1}" # allowDangerousTypes is used to accept float64 -CRD_OPTIONS="crd:trivialVersions=true,allowDangerousTypes=true" +CRD_OPTIONS="crd:maxDescLen=$MAX_DESC_LEN,trivialVersions=true,allowDangerousTypes=true" OLM_CATALOG_DIR="${SCRIPT_ROOT}/cluster/olm/ceph/deploy/crds" CRDS_FILE_PATH="${SCRIPT_ROOT}/cluster/examples/kubernetes/ceph/crds.yaml" HELM_CRDS_FILE_PATH="${SCRIPT_ROOT}/cluster/charts/rook-ceph/templates/resources.yaml" @@ -72,13 +73,13 @@ build_helm_resources() { # add header echo "{{- if .Values.crds.enabled }}" echo "{{- if semverCompare \">=1.16.0\" .Capabilities.KubeVersion.GitVersion }}" - + # Add helm annotations to all CRDS and skip the first 4 lines of crds.yaml "$YQ_BIN_PATH" w -d'*' "$CRDS_FILE_PATH" "metadata.annotations[helm.sh/resource-policy]" keep | tail -n +5 - + # add else echo "{{- else }}" - + # add footer cat "$CRDS_BEFORE_1_16_FILE_PATH" # DO NOT REMOVE the empty line, it is necessary diff --git a/images/ceph/Makefile b/images/ceph/Makefile index e851412a8..b1689e568 100755 --- a/images/ceph/Makefile +++ b/images/ceph/Makefile @@ -67,7 +67,15 @@ do.build: generate-csv-ceph-templates generate-csv-ceph-templates: $(OPERATOR_SDK) $(YQ) @if [ ! "$(INCLUDE_CSV_TEMPLATES)" = "" ]; then\ - $(MAKE) -C ../.. crds;\ + BEFORE_GEN_CRD_SIZE=$$(wc -l < ../../cluster/examples/kubernetes/ceph/crds.yaml);\ + $(MAKE) -C ../.. MAX_DESC_LEN=0 crds;\ + AFTER_GEN_CRD_SIZE=$$(wc -l < ../../cluster/examples/kubernetes/ceph/crds.yaml);\ + if [ "$$BEFORE_GEN_CRD_SIZE" -le "$$AFTER_GEN_CRD_SIZE" ]; then\ + echo "the new crd file must be smaller since the description fields were stripped!";\ + echo "length before $$BEFORE_GEN_CRD_SIZE";\ + echo "length after $$AFTER_GEN_CRD_SIZE";\ + exit 1;\ + fi;\ OPERATOR_SDK=$(OPERATOR_SDK) YQ_TOOL=$(YQ) ../../cluster/olm/ceph/generate-rook-csv-templates.sh;\ fi