@@ -62,13 +62,14 @@ source "${OS_ROOT}/images/dind/node/openshift-dind-lib.sh"
62
62
63
63
function start() {
64
64
local origin_root=$1
65
- local config_root=$2
66
- local deployed_config_root=$3
67
- local cluster_id=$4
68
- local network_plugin=$5
69
- local wait_for_cluster=$6
70
- local node_count=$7
71
- local additional_args=$8
65
+ local ovn_root=$2
66
+ local config_root=$3
67
+ local deployed_config_root=$4
68
+ local cluster_id=$5
69
+ local network_plugin=$6
70
+ local wait_for_cluster=$7
71
+ local node_count=$8
72
+ local additional_args=$9
72
73
73
74
# docker-in-docker's use of volumes is not compatible with SELinux
74
75
check-selinux
@@ -94,6 +95,15 @@ function start() {
94
95
echo " OPENSHIFT_ADDITIONAL_ARGS='${additional_args} '" > " ${config_root} /additional-args"
95
96
copy-runtime " ${origin_root} " " ${config_root} /"
96
97
98
+ ovn_kubernetes=
99
+ if [ -d " ${ovn_root} " ]; then
100
+ copy-ovn-runtime " ${ovn_root} " " ${config_root} /"
101
+ ovn_kubernetes=1
102
+ else
103
+ ovn_kubernetes=
104
+ fi
105
+ echo " OPENSHIFT_OVN_KUBERNETES=${ovn_kubernetes} " > " ${config_root} /ovn-kubernetes"
106
+
97
107
# Create containers
98
108
start-container " ${config_root} " " ${deployed_config_root} " " ${MASTER_IMAGE} " " ${MASTER_NAME} "
99
109
for name in " ${NODE_NAMES[@]} " ; do
@@ -460,6 +470,25 @@ function copy-runtime() {
460
470
cp " $( os::util::find::built_binary sdn-cni-plugin) " " ${target} /openshift-sdn"
461
471
}
462
472
473
+ function copy-ovn-runtime() {
474
+ local ovn_root=$1
475
+ local target=$2
476
+
477
+ local ovn_go_controller_built_binaries_path=" ${ovn_root} /go-controller/_output/go/bin"
478
+ cp " ${ovn_go_controller_built_binaries_path} /ovnkube" " ${target} "
479
+ cp " ${ovn_go_controller_built_binaries_path} /ovn-kube-util" " ${target} "
480
+
481
+ local ovn_k8s_binaries_path=" ${ovn_root} /bin"
482
+ cp " ${ovn_k8s_binaries_path} /ovn-k8s-cni-overlay" " ${target} "
483
+ cp " ${ovn_k8s_binaries_path} /ovn-k8s-gateway-helper" " ${target} "
484
+ cp " ${ovn_k8s_binaries_path} /ovn-k8s-overlay" " ${target} "
485
+ cp " ${ovn_k8s_binaries_path} /ovn-k8s-util" " ${target} "
486
+ cp " ${ovn_k8s_binaries_path} /ovn-k8s-watcher" " ${target} "
487
+
488
+ local ovn_k8s_python_module_path=" ${ovn_root} /ovn_k8s"
489
+ cp -R " ${ovn_k8s_python_module_path} " " ${target} /"
490
+ }
491
+
463
492
function wait-for-cluster() {
464
493
local config_root=$1
465
494
local expected_node_count=$2
@@ -568,19 +597,25 @@ NODE_IMAGE="openshift/dind-node"
568
597
MASTER_IMAGE=" openshift/dind-master"
569
598
ADDITIONAL_ARGS=" "
570
599
600
+ OVN_ROOT=" ${OVN_ROOT:- } "
601
+
571
602
case " ${1:- " " } " in
572
603
start)
573
604
BUILD=
574
605
BUILD_IMAGES=
606
+ USE_OVN=
575
607
WAIT_FOR_CLUSTER=1
576
608
NETWORK_PLUGIN=
577
609
REMOVE_EXISTING_CLUSTER=
578
610
OPTIND=2
579
- while getopts " :bin :rsN:" opt; do
611
+ while getopts " :boin :rsN:" opt; do
580
612
case $opt in
581
613
b)
582
614
BUILD=1
583
615
;;
616
+ o)
617
+ USE_OVN=1
618
+ ;;
584
619
i)
585
620
BUILD_IMAGES=1
586
621
;;
@@ -607,6 +642,17 @@ case "${1:-""}" in
607
642
esac
608
643
done
609
644
645
+ # OVN requires CNI network plugin and OVN_ROOT to be set
646
+ if [[ -n " ${USE_OVN} " ]]; then
647
+ NETWORK_PLUGIN=" cni"
648
+ if [[ -z " ${OVN_ROOT} " ]]; then
649
+ echo " -o (use OVN network plugin) requires OVN_ROOT set to ovn-kubernetes checkout"
650
+ exit 1
651
+ fi
652
+ elif [[ -n " ${OVN_ROOT} " ]]; then
653
+ OVN_ROOT=
654
+ fi
655
+
610
656
if [[ ${@: OPTIND-1: 1} = " --" ]]; then
611
657
ADDITIONAL_ARGS=${@: OPTIND}
612
658
fi
@@ -631,7 +677,7 @@ case "${1:-""}" in
631
677
fi
632
678
633
679
NETWORK_PLUGIN=" $( get-network-plugin " ${NETWORK_PLUGIN} " ) "
634
- start " ${OS_ROOT} " " ${CONFIG_ROOT} " " ${DEPLOYED_CONFIG_ROOT} " \
680
+ start " ${OS_ROOT} " " ${OVN_ROOT} " " ${ CONFIG_ROOT}" " ${DEPLOYED_CONFIG_ROOT} " \
635
681
" ${CLUSTER_ID} " " ${NETWORK_PLUGIN} " " ${WAIT_FOR_CLUSTER} " \
636
682
" ${NODE_COUNT} " " ${ADDITIONAL_ARGS} "
637
683
;;
@@ -765,6 +811,7 @@ start accepts the following options:
765
811
-i build container images before starting the cluster
766
812
-r remove an existing cluster
767
813
-s skip waiting for nodes to become ready
814
+ -o enable the OVN network plugin; implies " -n cni" and valid OVN_ROOT
768
815
769
816
Any of the arguments that would be used in creating openshift master can be passed
770
817
as is to the script after '--' ex: setting host subnet to 3
0 commit comments