skonto commented on a change in pull request #23520: [SPARK-26603][K8s] Update
minikube backend
URL: https://github.com/apache/spark/pull/23520#discussion_r251604577
##########
File path:
resource-managers/kubernetes/integration-tests/src/test/scala/org/apache/spark/deploy/k8s/integrationtest/backend/minikube/Minikube.scala
##########
@@ -38,12 +38,50 @@ private[spark] object Minikube extends Logging {
def getMinikubeStatus: MinikubeStatus.Value = {
val statusString = executeMinikube("status")
+ logInfo(s"Minikube status command output:\n$statusString")
+ // up to minikube version 0.30 use this to check for minikube status
+ val oldMinikube = statusString
.filter(line => line.contains("minikubeVM: ") ||
line.contains("minikube:"))
- .head
- .replaceFirst("minikubeVM: ", "")
- .replaceFirst("minikube: ", "")
- MinikubeStatus.unapply(statusString)
+
+ if (oldMinikube.isEmpty) {
+ if (statusString.length != 4) {
+ return MinikubeStatus.NONE
+ }
+
+ val hostString = statusString.find(_.contains("host: "))
+ val kubeletString = statusString.find(_.contains("kubelet: "))
+ val apiserverString = statusString.find(_.contains("apiserver: "))
+ val kubectlString = statusString.find(_.contains("kubectl: "))
+
+ if (hostString.isEmpty || kubeletString.isEmpty
+ || apiserverString.isEmpty || kubectlString.isEmpty) {
+ MinikubeStatus.NONE
+ } else {
+ val status1 = hostString.get.replaceFirst("host: ", "")
+ val status2 = kubeletString.get.replaceFirst("kubelet: ", "")
+ val status3 = apiserverString.get.replaceFirst("apiserver: ", "")
+ val status4 = kubectlString.get.replaceFirst("kubectl: ", "")
+ if (!status4.contains("Correctly Configured:")) {
+ MinikubeStatus.NONE
+ } else {
+ val stats = List(status1, status2, status3)
+ .map(MinikubeStatus.unapply)
Review comment:
Here we are mapping the status string to an enum Value and then parse all
values and fail if any of them is not `running`. Scala has a `withName` method
to do the mapping to an enum value but in MinikubeStatus there is a custom one
named `unapply` that does that. Reason is to better format the exception if
mapping cannot be done. Don't see how MinikubeStatus will help here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]