Add a rich example of fn framework for abstraction

This commit is contained in:
Katrina Verey
2023-04-06 20:04:55 -04:00
parent d3184da4c6
commit 85d623bc86
27 changed files with 1450 additions and 3 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -eo pipefail
# This generates a useful starting point for a CRD that can be used for validation.
echo " - Generating CRD"
controller-gen crd paths=./... output:crd:dir=.
# controller-gen does not currently support "additionalProperties: false".
# This hack adds it manually to all properties sections of the schema.
echo " - Adding additionalProperties: false to all properties sections"
if [[ "$OSTYPE" == linux* ]]; then
# Linux (GNU sed) expression
sed -i "s/\(^[[:space:]]*\)properties:/\1additionalProperties: false\n\1properties:/g" ./platform.example.com_exampleapps.yaml
elif [[ "$OSTYPE" == darwin* ]]; then
# macOS (BSD sed) expression
sed -i "" "s/\(^[[:space:]]*\)properties:/\1additionalProperties: false\n\1properties:/g" ./platform.example.com_exampleapps.yaml
else
echo "Unsupported OS: $OSTYPE"
exit 1
fi