Merge pull request #7523 from leseb/strip-description
ceph: strip crd description for csv generation
This commit is contained in:
4 files changed
+15
-7
No files matched your search
@@ -1,8 +1,6 @@
|
||||
name: CRDs gen
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- '**.go'
|
||||
|
||||
jobs:
|
||||
crds-gen:
|
||||
|
||||
@@ -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