mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 10:15:22 +00:00
22 lines
863 B
Bash
Executable File
22 lines
863 B
Bash
Executable File
#!/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
|