@@ -25,7 +25,6 @@ MINIKUBE_START_RETRIES=3
2525MINIKUBE_START_BACKOFF=5
2626RESULT_HASH=" e682ec6622b5e83f2eb614617d5ab2cf"
2727MINIKUBE_VERSION=" v1.8.2"
28- MINIKUBE_PATH=" /usr/local/bin/minikube-$MINIKUBE_VERSION "
2928
3029NON_LINUX_ENV_NOTE=" ****** Please start/stop minikube manually in non-linux environment. ******"
3130
@@ -43,16 +42,18 @@ function setup_kubernetes_for_linux {
4342 curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$version /bin/linux/$arch /kubectl && \
4443 chmod +x kubectl && sudo mv kubectl /usr/local/bin/
4544 fi
46- # Download minikube.
47- if ! [ -x " $( command -v minikube) " ] || ! [[ $( minikube version ) =~ " $MINIKUBE_VERSION " ]] ; then
48- echo " Installing minikube to $MINIKUBE_PATH ..."
45+ # Download minikube when it is not installed beforehand .
46+ if ! [ -x " $( command -v minikube) " ]; then
47+ echo " Installing minikube $MINIKUBE_VERSION ..."
4948 curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION /minikube-linux-$arch && \
50- chmod +x minikube && sudo mv minikube $MINIKUBE_PATH
49+ chmod +x minikube && sudo mv minikube /usr/bin/minikube
5150 fi
51+ # conntrack is required for minikube 1.9 and later
52+ sudo apt-get install conntrack
5253}
5354
5455function check_kubernetes_status {
55- $MINIKUBE_PATH status
56+ minikube status
5657 return $?
5758}
5859
@@ -75,15 +76,15 @@ function start_kubernetes_if_not_running {
7576 # here.
7677 # Similarly, the kubelets are marking themself as "low disk space",
7778 # causing Flink to avoid this node (again, failing the test)
78- sudo CHANGE_MINIKUBE_NONE_USER=true $MINIKUBE_PATH start --vm-driver=none \
79+ sudo CHANGE_MINIKUBE_NONE_USER=true minikube start --vm-driver=none \
7980 --extra-config=kubelet.image-gc-high-threshold=99 \
8081 --extra-config=kubelet.image-gc-low-threshold=98 \
8182 --extra-config=kubelet.minimum-container-ttl-duration=120m \
8283 --extra-config=kubelet.eviction-hard=" memory.available<5Mi,nodefs.available<1Mi,imagefs.available<1Mi" \
8384 --extra-config=kubelet.eviction-soft=" memory.available<5Mi,nodefs.available<2Mi,imagefs.available<2Mi" \
8485 --extra-config=kubelet.eviction-soft-grace-period=" memory.available=2h,nodefs.available=2h,imagefs.available=2h"
8586 # Fix the kubectl context, as it's often stale.
86- $MINIKUBE_PATH update-context
87+ minikube update-context
8788 fi
8889
8990 check_kubernetes_status
@@ -99,23 +100,25 @@ function start_kubernetes {
99100 # Mount Flink dist into minikube virtual machine because we need to mount hostPath as usrlib
100101 minikube mount $FLINK_DIR :$FLINK_DIR &
101102 export minikube_mount_pid=$!
103+ echo " The mounting process is running with pid $minikube_mount_pid "
102104 else
103105 setup_kubernetes_for_linux
104106 if ! retry_times ${MINIKUBE_START_RETRIES} ${MINIKUBE_START_BACKOFF} start_kubernetes_if_not_running; then
105107 echo " Could not start minikube. Aborting..."
106108 exit 1
107109 fi
108110 fi
109- eval $( $MINIKUBE_PATH docker-env)
111+ eval $( minikube docker-env)
110112}
111113
112114function stop_kubernetes {
113115 if [[ " ${OS_TYPE} " != " linux" ]]; then
114116 echo " $NON_LINUX_ENV_NOTE "
117+ echo " Killing mounting process $minikube_mount_pid "
115118 kill $minikube_mount_pid 2> /dev/null
116119 else
117120 echo " Stopping minikube ..."
118- stop_command=" sudo $MINIKUBE_PATH stop"
121+ stop_command=" sudo minikube stop"
119122 if ! retry_times ${MINIKUBE_START_RETRIES} ${MINIKUBE_START_BACKOFF} " ${stop_command} " ; then
120123 echo " Could not stop minikube. Aborting..."
121124 exit 1
@@ -178,18 +181,6 @@ function cleanup {
178181 stop_kubernetes
179182}
180183
181- function setConsoleLogging {
182- cat >> $FLINK_DIR /conf/log4j.properties << END
183- rootLogger.appenderRef.console.ref = ConsoleAppender
184-
185- # Log all infos to the console
186- appender.console.name = ConsoleAppender
187- appender.console.type = CONSOLE
188- appender.console.layout.type = PatternLayout
189- appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t] %-60c %x - %m%n
190- END
191- }
192-
193184function get_host_machine_address {
194185 if [[ " ${OS_TYPE} " != " linux" ]]; then
195186 echo $( minikube ssh " route -n | grep ^0.0.0.0 | awk '{ print \$ 2 }' | tr -d '[:space:]'" )
0 commit comments