Skip to content

Commit a6a1bd3

Browse files
committed
clean generate.sh scripts
1 parent 4329531 commit a6a1bd3

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

cmd/clusterctl/example/ibmcloud/generate-yaml.sh

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ if [[ -n "$1" ]] && [[ $1 != -* ]] && [[ $1 != --* ]];then
3838
CLOUDS_PATH="$1"
3939
else
4040
echo "Error: No clouds.yaml provided"
41-
echo "You must provide a valid clouds.yaml script to genereate a cloud.conf"
41+
echo "You must provide a valid clouds.yaml"
4242
echo ""
4343
print_help
4444
exit 1
@@ -70,21 +70,6 @@ if test -z "$PROVIDER_OS"; then
7070
exit 1
7171
fi
7272

73-
if ! hash yq 2>/dev/null; then
74-
echo "'yq' is not available, please install it. (https://github.com/mikefarah/yq)"
75-
echo ""
76-
print_help
77-
exit 1
78-
fi
79-
80-
yq_type=$(file $(which yq))
81-
if [[ $yq_type == *"Python script"* ]]; then
82-
echo "Wrong version of 'yq' installed, please install the one from https://github.com/mikefarah/yq"
83-
echo ""
84-
print_help
85-
exit 1
86-
fi
87-
8873
if [ -e out/provider-components.yaml ] && [ "$OVERWRITE" != "1" ]; then
8974
echo "Can't overwrite provider-components.yaml without user permission. Either run the script again"
9075
echo "with -f or --force-overwrite, or delete the file in the out/ directory."
@@ -96,7 +81,6 @@ fi
9681

9782
# Define global variables
9883
PWD=$(cd `dirname $0`; pwd)
99-
TEMPLATES_PATH=${TEMPLATES_PATH:-$PWD/$SUPPORTED_PROVIDER_OS}
10084
CONFIG_DIR=$PWD/provider-component/clouds-secrets/configs
10185
OVERWRITE=${OVERWRITE:-0}
10286
CLOUDS_PATH=${CLOUDS_PATH:-""}
@@ -113,17 +97,18 @@ if [ ! -f ${CLOUD_SSH_HOME}${CLOUD_SSH_PRIVATE_FILE} ]; then
11397
ssh-keygen -t rsa -f ${CLOUD_SSH_HOME}${CLOUD_SSH_PRIVATE_FILE} -N ""
11498
fi
11599

116-
# Set up the output dir if it does not yet exist
117-
mkdir -p $PWD/out
118-
cp -n $PWD/cluster.yaml.template $PWD/out/cluster.yaml
119-
cp -n $PWD/machines.yaml.template $PWD/out/machines.yaml
120-
100+
# Prepare dependecies for kustomize
121101
mkdir -p $CONFIG_DIR
122102
cat $PWD/$CLOUDS_PATH > $CONFIG_DIR/clouds.yaml
123103

124104
cat "$MASTER_USER_DATA" > $USERDATA/$PROVIDER_OS/master-user-data.sh
125105
cat "$WORKER_USER_DATA" > $USERDATA/$PROVIDER_OS/worker-user-data.sh
126106

107+
# Set up the output dir if it does not yet exist
108+
mkdir -p $PWD/out
109+
cp -n $PWD/cluster.yaml.template $PWD/out/cluster.yaml
110+
cp -n $PWD/machines.yaml.template $PWD/out/machines.yaml
111+
127112
# Build provider-components.yaml with kustomize
128113
kustomize build ../../../../config -o out/provider-components.yaml
129114

0 commit comments

Comments
 (0)