6
6
set -euo pipefail
7
7
IFS=$' \n\t '
8
8
9
- SCRIPT_NAME=" $( basename " $0 " ) "
9
+ SCRIPT_NAME=" $( basename " ${0} " ) "
10
10
readonly SCRIPT_NAME
11
11
12
12
function print_usage {
22
22
}
23
23
24
24
function assert_not_empty {
25
- local -r arg_name=" $1 "
26
- local -r arg_value=" $2 "
25
+ local -r arg_name=" ${1} "
26
+ local -r arg_value=" ${2} "
27
27
28
- if [[ -z $arg_value ]]; then
29
- echo " The value for '$arg_name ' cannot be empty"
28
+ if [[ -z ${ arg_value} ]]; then
29
+ echo " The value for '${ arg_name} ' cannot be empty"
30
30
print_usage
31
31
exit 1
32
32
fi
@@ -41,7 +41,7 @@ function run_cmd() {
41
41
# read options
42
42
while [[ $# -gt 0 ]]; do
43
43
local key=" $1 "
44
- case " $key " in
44
+ case " ${ key} " in
45
45
--cluster-name)
46
46
cluster_name=" $2 "
47
47
shift
@@ -67,21 +67,21 @@ function run_cmd() {
67
67
done
68
68
69
69
# validate parameters
70
- assert_not_empty " --cluster-name" " $cluster_name "
71
- assert_not_empty " --output-dir" " $output_dir "
72
- assert_not_empty " --base-config" " $base_config "
73
- assert_not_empty " --kindest-image" " $kindest_image "
70
+ assert_not_empty " --cluster-name" " ${ cluster_name} "
71
+ assert_not_empty " --output-dir" " ${ output_dir} "
72
+ assert_not_empty " --base-config" " ${ base_config} "
73
+ assert_not_empty " --kindest-image" " ${ kindest_image} "
74
74
75
- local cluster_config=" $output_dir /kind-config.yaml"
75
+ local cluster_config=" ${ output_dir} /kind-config.yaml"
76
76
77
77
# make sure output directory exist
78
- mkdir -p " $output_dir "
78
+ mkdir -p " ${ output_dir} "
79
79
80
80
# create/override base config
81
81
export KINDEST_IMAGE=" ${kindest_image} "
82
- envsubst -no-unset < " $ base_config" > " $ cluster_config"
82
+ envsubst -i " ${ base_config} " -o " ${ cluster_config} "
83
83
84
- kind create cluster --name " $cluster_name " --config " $cluster_config "
84
+ kind create cluster --name " ${ cluster_name} " --config " ${ cluster_config} "
85
85
}
86
86
87
87
run_cmd " $@ "
0 commit comments