Skip to content

Commit

Permalink
chore: add comments on the generate-manifests script
Browse files Browse the repository at this point in the history
Signed-off-by: Abhinandan Purkait <[email protected]>
  • Loading branch information
Abhinandan-Purkait committed Jul 29, 2024
1 parent 3a22b81 commit 31b0758
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions buildscripts/generate-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <name>-crd.yaml
mv "$FILE" "$NEW_FILE"

# Copy the files to the crd subchart templates, in format <name>.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

0 comments on commit 31b0758

Please sign in to comment.