File tree Expand file tree Collapse file tree 3 files changed +44
-36
lines changed Expand file tree Collapse file tree 3 files changed +44
-36
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,37 @@ run_kubectl() {
5555 done
5656}
5757
58+ setup_kubectl_bin() {
59+ ###########################################################################
60+ # Description: #
61+ # setup kubectl for querying the cluster #
62+ # #
63+ # Arguments: #
64+ # $1 - error message if not provided, it will just exit #
65+ ###########################################################################
66+ if [ ! -d "./bin" ]
67+ then
68+ mkdir -p ./bin
69+ if_error_exit "Failed to create bin dir!"
70+ fi
71+
72+ if [[ "$OSTYPE" == "linux-gnu" ]]; then
73+ OS_TYPE="linux"
74+ elif [[ "$OSTYPE" == "darwin"* ]]; then
75+ OS_TYPE="darwin"
76+ fi
77+
78+ pushd ./bin
79+ if [ ! -f ./kubectl ]; then
80+ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/${OS_TYPE}/${ARCH}/kubectl"
81+ if_error_exit "Failed to download kubectl failed!"
82+ fi
83+ popd
84+
85+ chmod +x ./bin/kubectl
86+ export PATH=${PATH}:$(pwd)/bin
87+ }
88+
5889command_exists() {
5990 cmd="$1"
6091 command -v ${cmd} >/dev/null 2>&1
Original file line number Diff line number Diff line change @@ -255,15 +255,23 @@ print_params() {
255255}
256256
257257check_dependencies () {
258- for cmd in $OCI_BIN kubectl kind helm go ; do \
259- if ! command_exists $cmd ; then
260- 2& > 1 echo " Dependency not met: $cmd "
258+ if ! command_exists kubectl ; then
259+ echo " 'kubectl' not found, installing"
260+ setup_kubectl_bin
261+ fi
262+
263+ for cmd in " $OCI_BIN " kind helm go ; do \
264+ if ! command_exists " $cmd " ; then
265+ echo " Dependency not met: $cmd "
261266 exit 1
262267 fi
263268 done
264269
265270 # check for currently unsupported features
266- [ " ${PLATFORM_IPV6_SUPPORT} " == " true" ] && { & > 1 echo " Fatal: PLATFORM_IPV6_SUPPORT support not implemented yet" ; exit 1; } || :
271+ if [ " ${PLATFORM_IPV6_SUPPORT:- } " = " true" ]; then
272+ echo " Fatal: PLATFORM_IPV6_SUPPORT support not implemented yet"
273+ exit 1
274+ fi
267275}
268276
269277helm_prereqs () {
@@ -414,7 +422,7 @@ create_ovn_kubernetes() {
414422 label_ovn_single_node_zones
415423 value_file=" values-single-node-zone.yaml"
416424 ovnkube_db_options=" "
417- elif [[ $KIND_NUM_NODES_PER_ZONE > 1 ]]; then
425+ elif [[ $KIND_NUM_NODES_PER_ZONE -gt 1 ]]; then
418426 label_ovn_multiple_nodes_zones
419427 value_file=" values-multi-node-zone.yaml"
420428 ovnkube_db_options=" "
Original file line number Diff line number Diff line change @@ -6,37 +6,6 @@ DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
66# Source the kind-common file from the same directory where this script is located
77source " ${DIR} /kind-common"
88
9- function setup_kubectl_bin() {
10- # ##########################################################################
11- # Description: #
12- # setup kubectl for querying the cluster #
13- # #
14- # Arguments: #
15- # $1 - error message if not provided, it will just exit #
16- # ##########################################################################
17- if [ ! -d " ./bin" ]
18- then
19- mkdir -p ./bin
20- if_error_exit " Failed to create bin dir!"
21- fi
22-
23- if [[ " $OSTYPE " == " linux-gnu" ]]; then
24- OS_TYPE=" linux"
25- elif [[ " $OSTYPE " == " darwin" * ]]; then
26- OS_TYPE=" darwin"
27- fi
28-
29- pushd ./bin
30- if [ ! -f ./kubectl ]; then
31- curl -LO " https://dl.k8s.io/release/$( curl -L -s https://dl.k8s.io/release/stable.txt) /bin/${OS_TYPE} /${ARCH} /kubectl"
32- if_error_exit " Failed to download kubectl failed!"
33- fi
34- popd
35-
36- chmod +x ./bin/kubectl
37- export PATH=${PATH} :$( pwd) /bin
38- }
39-
409# Some environments (Fedora32,31 on desktop), have problems when the cluster
4110# is deleted directly with kind `kind delete cluster --name ovn`, it restarts the host.
4211# The root cause is unknown, this also can not be reproduced in Ubuntu 20.04 or
You can’t perform that action at this time.
0 commit comments