Skip to content

Commit d690221

Browse files
authored
Merge pull request #5466 from trozet/default_IC
Default kind and kind-helm scripts to be interconnect
2 parents 492421e + cf9c8a4 commit d690221

File tree

3 files changed

+78
-42
lines changed

3 files changed

+78
-42
lines changed

contrib/kind-common

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
5889
command_exists() {
5990
cmd="$1"
6091
command -v ${cmd} >/dev/null 2>&1
@@ -845,3 +876,9 @@ EOF
845876
done
846877
fi
847878
}
879+
880+
interconnect_arg_check() {
881+
if [ "${IC_ARG_PROVIDED:-}" = "true" ]; then
882+
echo "INFO: Interconnect mode is now the default mode, you do not need to use pass -ic or --enable-interconnect anymore"
883+
fi
884+
}

contrib/kind-helm.sh

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ set_default_params() {
6262
KIND_NUM_MASTER=3
6363
fi
6464

65-
OVN_ENABLE_INTERCONNECT=${OVN_ENABLE_INTERCONNECT:-false}
65+
OVN_ENABLE_INTERCONNECT=${OVN_ENABLE_INTERCONNECT:-true}
6666
if [ "$OVN_COMPACT_MODE" == true ] && [ "$OVN_ENABLE_INTERCONNECT" != false ]; then
6767
echo "Compact mode cannot be used together with Interconnect"
6868
exit 1
@@ -129,7 +129,7 @@ usage() {
129129
echo "-wk | --num-workers Number of worker nodes. DEFAULT: 2 workers"
130130
echo "-cn | --cluster-name Configure the kind cluster's name"
131131
echo "-dns | --enable-dnsnameresolver Enable DNSNameResolver for resolving the DNS names used in the DNS rules of EgressFirewall."
132-
echo "-ic | --enable-interconnect Enable interconnect with each node as a zone (only valid if OVN_HA is false)"
132+
echo "-ce | --enable-central Deploy with OVN Central (Legacy Architecture)"
133133
echo "-npz | --nodes-per-zone Specify number of nodes per zone (Default 0, which means global zone; >0 means interconnect zone, where 1 for single-node zone, >1 for multi-node zone). If this value > 1, then (total k8s nodes (workers + 1) / num of nodes per zone) should be zero."
134134
echo ""
135135

@@ -193,7 +193,11 @@ parse_args() {
193193
;;
194194
-dns | --enable-dnsnameresolver ) OVN_ENABLE_DNSNAMERESOLVER=true
195195
;;
196+
-ce | --enable-central ) OVN_ENABLE_INTERCONNECT=false
197+
CENTRAL_ARG_PROVIDED=true
198+
;;
196199
-ic | --enable-interconnect ) OVN_ENABLE_INTERCONNECT=true
200+
IC_ARG_PROVIDED=true
197201
;;
198202
-npz | --nodes-per-zone ) shift
199203
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
@@ -208,6 +212,11 @@ parse_args() {
208212
esac
209213
shift
210214
done
215+
216+
if [[ -n "${CENTRAL_ARG_PROVIDED:-}" && -n "${IC_ARG_PROVIDED:-}" ]]; then
217+
echo "Cannot specify both --enable-central and --enable-interconnect" >&2
218+
exit 1
219+
fi
211220
}
212221

213222
print_params() {
@@ -246,15 +255,23 @@ print_params() {
246255
}
247256

248257
check_dependencies() {
249-
for cmd in $OCI_BIN kubectl kind helm go ; do \
250-
if ! command_exists $cmd ; then
251-
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"
252266
exit 1
253267
fi
254268
done
255269

256270
# check for currently unsupported features
257-
[ "${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
258275
}
259276

260277
helm_prereqs() {
@@ -405,7 +422,7 @@ create_ovn_kubernetes() {
405422
label_ovn_single_node_zones
406423
value_file="values-single-node-zone.yaml"
407424
ovnkube_db_options=""
408-
elif [[ $KIND_NUM_NODES_PER_ZONE > 1 ]]; then
425+
elif [[ $KIND_NUM_NODES_PER_ZONE -gt 1 ]]; then
409426
label_ovn_multiple_nodes_zones
410427
value_file="values-multi-node-zone.yaml"
411428
ovnkube_db_options=""
@@ -506,3 +523,5 @@ fi
506523
if [ "$KIND_INSTALL_KUBEVIRT" == true ]; then
507524
install_kubevirt
508525
fi
526+
527+
interconnect_arg_check

contrib/kind.sh

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff 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
77
source "${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
@@ -144,7 +113,7 @@ echo "-ehp | --egress-ip-healthcheck-port TCP port used for gRPC sessi
144113
echo "-is | --ipsec Enable IPsec encryption (spawns ovn-ipsec pods)"
145114
echo "-sm | --scale-metrics Enable scale metrics"
146115
echo "-cm | --compact-mode Enable compact mode, ovnkube master and node run in the same process."
147-
echo "-ic | --enable-interconnect Enable interconnect with each node as a zone (only valid if OVN_HA is false)"
116+
echo "-ce | --enable-central Deploy with OVN Central (Legacy Architecture)"
148117
echo "-nqe | --network-qos-enable Enable network QoS. DEFAULT: Disabled."
149118
echo "--disable-ovnkube-identity Disable per-node cert and ovnkube-identity webhook"
150119
echo "-npz | --nodes-per-zone If interconnect is enabled, number of nodes per zone (Default 1). If this value > 1, then (total k8s nodes (workers + 1) / num of nodes per zone) should be zero."
@@ -347,8 +316,12 @@ parse_args() {
347316
;;
348317
-adv | --advertise-default-network) ADVERTISE_DEFAULT_NETWORK=true
349318
;;
350-
-ic | --enable-interconnect ) OVN_ENABLE_INTERCONNECT=true
351-
;;
319+
-ce | --enable-central ) OVN_ENABLE_INTERCONNECT=false
320+
CENTRAL_ARG_PROVIDED=true
321+
;;
322+
-ic | --enable-interconnect ) OVN_ENABLE_INTERCONNECT=true
323+
IC_ARG_PROVIDED=true
324+
;;
352325
--disable-ovnkube-identity) OVN_ENABLE_OVNKUBE_IDENTITY=false
353326
;;
354327
-mtu ) shift
@@ -375,6 +348,11 @@ parse_args() {
375348
esac
376349
shift
377350
done
351+
352+
if [[ -n "${CENTRAL_ARG_PROVIDED:-}" && -n "${IC_ARG_PROVIDED:-}" ]]; then
353+
echo "Cannot specify both --enable-central and --enable-interconnect" >&2
354+
exit 1
355+
fi
378356
}
379357

380358
print_params() {
@@ -618,7 +596,7 @@ set_default_params() {
618596
BGP_SERVER_NET_SUBNET_IPV6=${BGP_SERVER_NET_SUBNET_IPV6:-fc00:f853:ccd:e796::/64}
619597

620598
KIND_NUM_MASTER=1
621-
OVN_ENABLE_INTERCONNECT=${OVN_ENABLE_INTERCONNECT:-false}
599+
OVN_ENABLE_INTERCONNECT=${OVN_ENABLE_INTERCONNECT:-true}
622600
OVN_ENABLE_OVNKUBE_IDENTITY=${OVN_ENABLE_OVNKUBE_IDENTITY:-true}
623601
OVN_NETWORK_QOS_ENABLE=${OVN_NETWORK_QOS_ENABLE:-false}
624602

@@ -1282,3 +1260,5 @@ fi
12821260
if [ "$ENABLE_ROUTE_ADVERTISEMENTS" == true ]; then
12831261
install_ffr_k8s
12841262
fi
1263+
1264+
interconnect_arg_check

0 commit comments

Comments
 (0)