This is an automated email from the ASF dual-hosted git repository.

benjobs pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/dev by this push:
     new 704a08fe5 [FIX]fix parse k8s version (#2741)
704a08fe5 is described below

commit 704a08fe52064d0c34eabe87cf72fc4ea7b65126
Author: yunli <[email protected]>
AuthorDate: Sat May 13 08:26:56 2023 +0800

    [FIX]fix parse k8s version (#2741)
    
    * use gitversion to obtain the version in order to support later versions
    
    * spotless apply
    
    * Modify the method of obtaining version information
---
 .../streampark/flink/kubernetes/ingress/IngressController.scala      | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressController.scala
 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressController.scala
index c636010b6..d443a22bd 100644
--- 
a/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressController.scala
+++ 
b/streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/ingress/IngressController.scala
@@ -27,11 +27,12 @@ import scala.language.postfixOps
 
 object IngressController extends Logger {
 
+  private[this] val VERSION_REGEXP = "(\\d+\\.\\d+)".r
+
   private lazy val ingressStrategy: IngressStrategy = {
     using(new DefaultKubernetesClient()) {
       client =>
-        val versionInfo = client.getVersion
-        val version = 
s"${versionInfo.getMajor}.${versionInfo.getMinor}".toDouble
+        val version = 
VERSION_REGEXP.findFirstIn(client.getVersion.getGitVersion).get.toDouble
         if (version >= 1.19) {
           new IngressStrategyV1()
         } else {

Reply via email to