This is an automated email from the ASF dual-hosted git repository.
benjobs pushed a commit to branch dev-2.1.5
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git
The following commit(s) were added to refs/heads/dev-2.1.5 by this push:
new a5cad6ad4 Fix the "java.nio.file.NoSuchFileException:
/root/.kube/config" exception by not providing the Kube Conf File parameter
when starting the k8s session cluster. (#3998)
a5cad6ad4 is described below
commit a5cad6ad4230434233d1e6b2badd938eefe9dacf
Author: Darcy <[email protected]>
AuthorDate: Wed Aug 28 17:56:44 2024 +0800
Fix the "java.nio.file.NoSuchFileException: /root/.kube/config" exception
by not providing the Kube Conf File parameter when starting the k8s session
cluster. (#3998)
* fix: kube config not found error
* fix: Optimize the implementation of getDefaultKubernetesConf.
---
.../org/apache/streampark/flink/client/bean/DeployRequest.scala | 2 +-
.../flink/client/trait/KubernetesNativeClientTrait.scala | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git
a/streampark-flink/streampark-flink-client/streampark-flink-client-api/src/main/scala/org/apache/streampark/flink/client/bean/DeployRequest.scala
b/streampark-flink/streampark-flink-client/streampark-flink-client-api/src/main/scala/org/apache/streampark/flink/client/bean/DeployRequest.scala
index 49ad5c8ed..8f1bd4a9b 100644
---
a/streampark-flink/streampark-flink-client/streampark-flink-client-api/src/main/scala/org/apache/streampark/flink/client/bean/DeployRequest.scala
+++
b/streampark-flink/streampark-flink-client/streampark-flink-client-api/src/main/scala/org/apache/streampark/flink/client/bean/DeployRequest.scala
@@ -67,7 +67,7 @@ class KubernetesDeployRequest(
override val clusterId: String,
override val clusterName: String,
val kubernetesNamespace: String =
KubernetesConfigOptions.NAMESPACE.defaultValue(),
- val kubeConf: String = "~/.kube/config",
+ val kubeConf: String,
val serviceAccount: String =
KubernetesConfigOptions.KUBERNETES_SERVICE_ACCOUNT.defaultValue(),
val flinkImage: String =
KubernetesConfigOptions.CONTAINER_IMAGE.defaultValue(),
val flinkRestExposedType: FlinkK8sRestExposedType =
FlinkK8sRestExposedType.CLUSTER_IP)
diff --git
a/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/KubernetesNativeClientTrait.scala
b/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/KubernetesNativeClientTrait.scala
index ec3134502..9ce91cf62 100644
---
a/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/KubernetesNativeClientTrait.scala
+++
b/streampark-flink/streampark-flink-client/streampark-flink-client-core/src/main/scala/org/apache/streampark/flink/client/trait/KubernetesNativeClientTrait.scala
@@ -178,9 +178,11 @@ trait KubernetesNativeClientTrait extends FlinkClientTrait
{
}
def getDefaultKubernetesConf(k8sConf: String): String = {
- val homePath: String = System.getProperty("user.home")
- if (k8sConf != null) k8sConf.replace("~", homePath)
- else homePath.concat("/.kube/config")
+ if (k8sConf != null) {
+ val homePath: String = System.getProperty("user.home")
+ return k8sConf.replace("~", homePath)
+ }
+ null
}
}