ceph: strip crd description for csv generation
The CSV file size cannot be bigger than 1MB so let's remove all the description fields make it lighter. With that change the CRDs size went from 692K to 372K so the size was reduced by almost 50%. Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
350379d43e
commit
5a194af3b1
3 files changed
+15
-5
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user