@@ -67,14 +67,26 @@ function start() {
67
67
local deployed_config_root=$4
68
68
local cluster_id=$5
69
69
local network_plugin=$6
70
- local wait_for_cluster=$7
71
- local node_count=$8
72
- local additional_args=$9
70
+ local container_runtime=$7
71
+ local wait_for_cluster=$8
72
+ local node_count=$9
73
+ local additional_args=${10}
73
74
74
75
# docker-in-docker's use of volumes is not compatible with SELinux
75
76
check-selinux
76
77
77
- echo " Starting dind cluster '${cluster_id} ' with plugin '${network_plugin} '"
78
+ runtime_endpoint=
79
+ if [[ " ${container_runtime} " = " dockershim" ]]; then
80
+ # dockershim is default and doesn't need an endpoint path
81
+ runtime_endpoint=
82
+ elif [[ " ${container_runtime} " = " crio" ]]; then
83
+ runtime_endpoint=" /var/run/crio.sock"
84
+ else
85
+ >&2 echo " Invalid container runtime: ${container_runtime} "
86
+ exit 1
87
+ fi
88
+
89
+ echo " Starting dind cluster '${cluster_id} ' with plugin '${network_plugin} ' and runtime '${container_runtime} '"
78
90
79
91
# Error if a cluster is already configured
80
92
check-no-containers " start"
@@ -91,16 +103,19 @@ function start() {
91
103
92
104
# Initialize the cluster config path
93
105
mkdir -p " ${config_root} "
94
- echo " OPENSHIFT_NETWORK_PLUGIN=${network_plugin} " > " ${config_root} /network-plugin "
95
- echo " OPENSHIFT_ADDITIONAL_ARGS='${additional_args} '" > " ${config_root} /additional-args "
106
+ echo " OPENSHIFT_NETWORK_PLUGIN=${network_plugin} " > " ${config_root} /dind-env "
107
+ echo " OPENSHIFT_ADDITIONAL_ARGS='${additional_args} '" >> " ${config_root} /dind-env "
96
108
copy-runtime " ${origin_root} " " ${config_root} /"
97
109
110
+ echo " OPENSHIFT_CONTAINER_RUNTIME=${container_runtime} " >> " ${config_root} /dind-env"
111
+ echo " OPENSHIFT_REMOTE_RUNTIME_ENDPOINT=${runtime_endpoint} " >> " ${config_root} /dind-env"
112
+
98
113
ovn_kubernetes=
99
114
if [[ -d " ${ovn_root} " ]]; then
100
115
copy-ovn-runtime " ${ovn_root} " " ${config_root} /"
101
116
ovn_kubernetes=1
102
117
fi
103
- echo " OPENSHIFT_OVN_KUBERNETES=${ovn_kubernetes} " > " ${config_root} /ovn-kubernetes "
118
+ echo " OPENSHIFT_OVN_KUBERNETES=${ovn_kubernetes} " >> " ${config_root} /dind-env "
104
119
105
120
# Create containers
106
121
start-container " ${config_root} " " ${deployed_config_root} " " ${MASTER_IMAGE} " " ${MASTER_NAME} "
@@ -603,6 +618,7 @@ MASTER_IMAGE="openshift/dind-master"
603
618
ADDITIONAL_ARGS=" "
604
619
605
620
OVN_ROOT=" ${OVN_ROOT:- } "
621
+ CONTAINER_RUNTIME=" ${CONTAINER_RUNTIME:- dockershim} "
606
622
607
623
case " ${1:- " " } " in
608
624
start)
@@ -612,7 +628,7 @@ case "${1:-""}" in
612
628
NETWORK_PLUGIN=
613
629
REMOVE_EXISTING_CLUSTER=
614
630
OPTIND=2
615
- while getopts " :bin :rsN:" opt; do
631
+ while getopts " :bc:in :rsN:" opt; do
616
632
case $opt in
617
633
b)
618
634
BUILD=1
@@ -632,6 +648,9 @@ case "${1:-""}" in
632
648
s)
633
649
WAIT_FOR_CLUSTER=
634
650
;;
651
+ c)
652
+ CONTAINER_RUNTIME=" ${OPTARG} "
653
+ ;;
635
654
\? )
636
655
echo " Invalid option: -${OPTARG} " >&2
637
656
exit 1
@@ -680,8 +699,8 @@ case "${1:-""}" in
680
699
fi
681
700
682
701
start " ${OS_ROOT} " " ${OVN_ROOT} " " ${CONFIG_ROOT} " " ${DEPLOYED_CONFIG_ROOT} " \
683
- " ${CLUSTER_ID} " " ${NETWORK_PLUGIN} " " ${WAIT_FOR_CLUSTER } " \
684
- " ${NODE_COUNT} " " ${ADDITIONAL_ARGS} "
702
+ " ${CLUSTER_ID} " " ${NETWORK_PLUGIN} " " ${CONTAINER_RUNTIME } " \
703
+ " ${WAIT_FOR_CLUSTER} " " ${ NODE_COUNT}" " ${ADDITIONAL_ARGS} "
685
704
;;
686
705
add-node)
687
706
WAIT_FOR_CLUSTER=1
@@ -810,6 +829,7 @@ start accepts the following options:
810
829
-n [net plugin] the name of the network plugin to deploy
811
830
-N number of nodes in the cluster
812
831
-b build origin before starting the cluster
832
+ -c [runtime name] use the specified container runtime instead of dockershim (eg, " crio" )
813
833
-i build container images before starting the cluster
814
834
-r remove an existing cluster
815
835
-s skip waiting for nodes to become ready
0 commit comments