diff --git a/buildscripts/generate-manifests.sh b/buildscripts/generate-manifests.sh index 168cbc958..3067952eb 100755 --- a/buildscripts/generate-manifests.sh +++ b/buildscripts/generate-manifests.sh @@ -23,13 +23,18 @@ $CONTROLLER_GEN crd:trivialVersions=false,preserveUnknownFields=false paths=./pk for FILE in "$DEPLOY_YAML_DIR"/zfs.openebs.io_*; do BASE_NAME=$(basename "$FILE" | sed -e 's/^zfs.openebs.io_//' -e 's/s\.yaml$/.yaml/') NEW_FILE="$DEPLOY_YAML_DIR/${BASE_NAME%.yaml}-crd.yaml" + # Rename the files generated in the format -crd.yaml mv "$FILE" "$NEW_FILE" + # Copy the files to the crd subchart templates, in format .yaml TARGET_FILE="$CRD_CHART_TEMPLATE_DIR/${BASE_NAME%.yaml}.yaml" cp "$NEW_FILE" "$TARGET_FILE" + # Append the helm configuration to enable disable the keep the crds on uninstall. awk '/controller-gen.kubebuilder.io\/version:/ { print; print " {{- include \"crds.extraAnnotations\" .Values.zfsLocalPv | nindent 4 }}"; next }1' "$TARGET_FILE" > "$TARGET_FILE.tmp" && mv "$TARGET_FILE.tmp" "$TARGET_FILE" + # Append the helm configuration to enable disable the installation of the crds. awk 'BEGIN { print "{{- if .Values.zfsLocalPv.enabled -}}" } { print } END { if (NR > 0) print "{{- end -}}" }' "$TARGET_FILE" > "$TARGET_FILE.tmp" && mv "$TARGET_FILE.tmp" "$TARGET_FILE" done +# Generate the zfs-operator.yaml using the helm chart. helm template "$RELEASE_NAME" "$HELM_CHART_DIR" -n "$RELEASE_NAMESPACE" --set analytics.installerType="zfs-operator" > "$DEPLOY_YAML_DIR"/../zfs-operator.yaml