wangyang0918 commented on a change in pull request #10665: [FLINK-15354] Start
and stop minikube only in kubernetes related e2e tests
URL: https://github.com/apache/flink/pull/10665#discussion_r365635600
##########
File path: flink-end-to-end-tests/test-scripts/common_kubernetes.sh
##########
@@ -26,26 +26,56 @@ MINIKUBE_START_RETRIES=3
MINIKUBE_START_BACKOFF=5
RESULT_HASH="e682ec6622b5e83f2eb614617d5ab2cf"
+# If running tests on non-linux os, the kubectl and minikube should be
installed manually
+function setup_kubernetes_for_linux {
+ # Download kubectl, which is a requirement for using minikube.
+ if ! [ -x "$(command -v kubectl)" ]; then
+ local version=$(curl -s
https://storage.googleapis.com/kubernetes-release/release/stable.txt)
+ curl -Lo kubectl
https://storage.googleapis.com/kubernetes-release/release/$version/bin/linux/amd64/kubectl
&& \
+ chmod +x kubectl && sudo mv kubectl /usr/local/bin/
+ fi
+ # Download minikube.
+ if ! [ -x "$(command -v minikube)" ]; then
+ curl -Lo minikube
https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 &&
\
+ chmod +x minikube && sudo mv minikube /usr/local/bin/
+ fi
+}
+
function check_kubernetes_status {
minikube status
return $?
}
function start_kubernetes_if_not_running {
if ! check_kubernetes_status; then
- minikube start
+ start_command="minikube start"
+ # We need sudo permission to set vm-driver to none in linux os.
+ [[ "${OS_TYPE}" = "linux" ]] && start_command="sudo ${start_command}
--vm-driver=none"
Review comment:
When running this test in non-linux environment(e.g. Mac Os), we could not
start the minikube under `--vm-driver=none` mode. So we will not need sudo
permission. Of course we could use `sudo minikube start` on MacOS, then we need
to provide the password interactively. I suggest to run on `non-sudo` mode in
non-linux environment.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services