Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
f3f4d225
Unverified
Commit
f3f4d225
authored
Dec 16, 2023
by
gaoyan
Committed by
GitHub
Dec 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix k8s template bug (#2660)
* fix k8s template bug * fix k8s template bug
parent
824a3e80
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
165 additions
and
65 deletions
+165
-65
K8sConfig.java
...way/src/main/java/org/dinky/gateway/config/K8sConfig.java
+3
-0
KubernetesApplicationGateway.java
...inky/gateway/kubernetes/KubernetesApplicationGateway.java
+1
-2
KubernetesGateway.java
.../java/org/dinky/gateway/kubernetes/KubernetesGateway.java
+35
-19
KubernetsOperatorGateway.java
...gateway/kubernetes/operator/KubernetsOperatorGateway.java
+15
-8
YarnGateway.java
...way/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
+2
-0
pages.ts
dinky-web/src/locales/en-US/pages.ts
+5
-1
pages.ts
dinky-web/src/locales/zh-CN/pages.ts
+8
-3
contants.tsx
...onfigurationModal/ConfigurationForm/FlinkK8s/contants.tsx
+0
-1
index.tsx
...s/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx
+87
-16
index.tsx
...ationModal/ConfigurationForm/HighPriorityConfig/index.tsx
+0
-5
index.tsx
...components/ConfigurationModal/ConfigurationForm/index.tsx
+1
-1
contants.tsx
...s/RegCenter/Cluster/Configuration/components/contants.tsx
+6
-9
data.d.ts
...ages/RegCenter/Cluster/Configuration/components/data.d.ts
+1
-0
data.d.ts
dinky-web/src/types/Studio/data.d.ts
+1
-0
No files found.
dinky-gateway/src/main/java/org/dinky/gateway/config/K8sConfig.java
View file @
f3f4d225
...
@@ -64,4 +64,7 @@ public class K8sConfig {
...
@@ -64,4 +64,7 @@ public class K8sConfig {
example
=
"tm-pod-template.yaml"
,
example
=
"tm-pod-template.yaml"
,
notes
=
"YAML file containing the pod template for TaskManagers in Flink jobs"
)
notes
=
"YAML file containing the pod template for TaskManagers in Flink jobs"
)
private
String
tmPodTemplate
;
private
String
tmPodTemplate
;
@ApiModelProperty
(
value
=
"KubeConfig"
,
dataType
=
"String"
,
example
=
"kubeconfig.yaml"
,
notes
=
"KubeConfig file"
)
private
String
kubeConfig
;
}
}
dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesApplicationGateway.java
View file @
f3f4d225
...
@@ -91,8 +91,7 @@ public class KubernetesApplicationGateway extends KubernetesGateway {
...
@@ -91,8 +91,7 @@ public class KubernetesApplicationGateway extends KubernetesGateway {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
finally
{
}
finally
{
client
.
close
();
close
();
kubernetesClient
.
close
();
}
}
}
}
...
...
dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/KubernetesGateway.java
View file @
f3f4d225
...
@@ -30,6 +30,7 @@ import org.dinky.gateway.result.TestResult;
...
@@ -30,6 +30,7 @@ import org.dinky.gateway.result.TestResult;
import
org.dinky.utils.TextUtil
;
import
org.dinky.utils.TextUtil
;
import
org.apache.flink.configuration.ConfigOption
;
import
org.apache.flink.configuration.ConfigOption
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.GlobalConfiguration
;
import
org.apache.flink.configuration.GlobalConfiguration
;
import
org.apache.flink.configuration.PipelineOptions
;
import
org.apache.flink.configuration.PipelineOptions
;
...
@@ -42,8 +43,8 @@ import org.apache.flink.kubernetes.kubeclient.FlinkKubeClientFactory;
...
@@ -42,8 +43,8 @@ import org.apache.flink.kubernetes.kubeclient.FlinkKubeClientFactory;
import
org.apache.http.util.TextUtils
;
import
org.apache.http.util.TextUtils
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.UUID
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.lang.Assert
;
import
cn.hutool.core.lang.Assert
;
...
@@ -54,12 +55,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
...
@@ -54,12 +55,15 @@ import io.fabric8.kubernetes.client.KubernetesClient;
/**
/**
* KubernetesGateway
* KubernetesGateway
*
*/
*/
public
abstract
class
KubernetesGateway
extends
AbstractGateway
{
public
abstract
class
KubernetesGateway
extends
AbstractGateway
{
protected
FlinkKubeClient
client
;
protected
FlinkKubeClient
client
;
protected
KubernetesClient
kubernetesClient
;
protected
KubernetesClient
kubernetesClient
;
protected
String
flinkConfigPath
;
protected
FlinkConfig
flinkConfig
;
protected
K8sConfig
k8sConfig
;
protected
String
tmpConfDir
;
public
KubernetesGateway
()
{}
public
KubernetesGateway
()
{}
...
@@ -69,10 +73,12 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -69,10 +73,12 @@ public abstract class KubernetesGateway extends AbstractGateway {
}
}
private
void
initConfig
()
{
private
void
initConfig
()
{
String
flinkConfigPath
=
config
.
getClusterConfig
().
getFlinkConfigPath
();
tmpConfDir
=
String
.
format
(
"%s/tmp/kubernets/%s"
,
System
.
getProperty
(
"user.dir"
),
UUID
.
randomUUID
());
FlinkConfig
flinkConfig
=
config
.
getFlinkConfig
();
flinkConfigPath
=
config
.
getClusterConfig
().
getFlinkConfigPath
();
K8sConfig
k8sConfig
=
config
.
getKubernetesConfig
();
flinkConfig
=
config
.
getFlinkConfig
();
k8sConfig
=
config
.
getKubernetesConfig
();
configuration
.
set
(
CoreOptions
.
CLASSLOADER_RESOLVE_ORDER
,
"parent-first"
);
try
{
try
{
addConfigParas
(
addConfigParas
(
GlobalConfiguration
.
loadConfiguration
(
flinkConfigPath
).
toMap
());
GlobalConfiguration
.
loadConfiguration
(
flinkConfigPath
).
toMap
());
...
@@ -91,6 +97,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -91,6 +97,7 @@ public abstract class KubernetesGateway extends AbstractGateway {
preparPodTemplate
(
k8sConfig
.
getPodTemplate
(),
KubernetesConfigOptions
.
KUBERNETES_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getPodTemplate
(),
KubernetesConfigOptions
.
KUBERNETES_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getJmPodTemplate
(),
KubernetesConfigOptions
.
JOB_MANAGER_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getJmPodTemplate
(),
KubernetesConfigOptions
.
JOB_MANAGER_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getTmPodTemplate
(),
KubernetesConfigOptions
.
TASK_MANAGER_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getTmPodTemplate
(),
KubernetesConfigOptions
.
TASK_MANAGER_POD_TEMPLATE
);
preparPodTemplate
(
k8sConfig
.
getKubeConfig
(),
KubernetesConfigOptions
.
KUBE_CONFIG_FILE
);
if
(
getType
().
isApplicationMode
())
{
if
(
getType
().
isApplicationMode
())
{
resetCheckpointInApplicationMode
(
flinkConfig
.
getJobName
());
resetCheckpointInApplicationMode
(
flinkConfig
.
getJobName
());
...
@@ -98,27 +105,22 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -98,27 +105,22 @@ public abstract class KubernetesGateway extends AbstractGateway {
}
}
private
void
preparPodTemplate
(
String
podTemplate
,
ConfigOption
<
String
>
option
)
{
private
void
preparPodTemplate
(
String
podTemplate
,
ConfigOption
<
String
>
option
)
{
if
(
TextUtil
.
isEmpty
(
podTemplate
))
{
if
(!
TextUtil
.
isEmpty
(
podTemplate
))
{
return
;
String
filePath
=
String
.
format
(
"%s/%s.yaml"
,
tmpConfDir
,
option
.
key
());
}
if
(
FileUtil
.
exist
(
filePath
))
{
String
filePath
=
String
.
format
(
Assert
.
isTrue
(
FileUtil
.
del
(
filePath
));
"%s/tmp/Kubernets/%s.yaml"
,
}
System
.
getProperty
(
"user.dir"
),
config
.
getFlinkConfig
().
getJobName
());
FileUtil
.
writeUtf8String
(
podTemplate
,
filePath
);
if
(
FileUtil
.
exist
(
filePath
))
{
addConfigParas
(
option
,
filePath
);
Assert
.
isTrue
(
FileUtil
.
del
(
filePath
));
}
}
FileUtil
.
writeUtf8String
(
podTemplate
,
filePath
);
addConfigParas
(
option
,
filePath
);
}
}
private
void
initKubeClient
()
{
private
void
initKubeClient
()
{
client
=
FlinkKubeClientFactory
.
getInstance
().
fromConfiguration
(
configuration
,
"client"
);
client
=
FlinkKubeClientFactory
.
getInstance
().
fromConfiguration
(
configuration
,
"client"
);
String
kubeFile
=
configuration
.
getString
(
KubernetesConfigOptions
.
KUBE_CONFIG_FILE
);
if
(
TextUtils
.
isEmpty
(
k8sConfig
.
getKubeConfig
()))
{
if
(
TextUtils
.
isEmpty
(
kubeFile
))
{
kubernetesClient
=
new
DefaultKubernetesClient
();
kubernetesClient
=
new
DefaultKubernetesClient
();
}
else
{
}
else
{
String
kubeStr
=
FileUtil
.
readString
(
kubeFile
,
StandardCharsets
.
UTF_8
);
kubernetesClient
=
DefaultKubernetesClient
.
fromConfig
(
k8sConfig
.
getKubeConfig
());
kubernetesClient
=
DefaultKubernetesClient
.
fromConfig
(
kubeStr
);
}
}
}
}
...
@@ -166,6 +168,8 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -166,6 +168,8 @@ public abstract class KubernetesGateway extends AbstractGateway {
public
TestResult
test
()
{
public
TestResult
test
()
{
try
{
try
{
initConfig
();
initConfig
();
// Test mode no jobName, use uuid .
addConfigParas
(
KubernetesConfigOptions
.
CLUSTER_ID
,
UUID
.
randomUUID
().
toString
());
initKubeClient
();
initKubeClient
();
if
(
client
instanceof
Fabric8FlinkKubeClient
)
{
if
(
client
instanceof
Fabric8FlinkKubeClient
)
{
Object
internalClient
=
ReflectUtil
.
getFieldValue
(
client
,
"internalClient"
);
Object
internalClient
=
ReflectUtil
.
getFieldValue
(
client
,
"internalClient"
);
...
@@ -181,6 +185,8 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -181,6 +185,8 @@ public abstract class KubernetesGateway extends AbstractGateway {
logger
.
error
(
Status
.
GAETWAY_KUBERNETS_TEST_FAILED
.
getMessage
(),
e
);
logger
.
error
(
Status
.
GAETWAY_KUBERNETS_TEST_FAILED
.
getMessage
(),
e
);
return
TestResult
.
fail
(
return
TestResult
.
fail
(
StrFormatter
.
format
(
"{}:{}"
,
Status
.
GAETWAY_KUBERNETS_TEST_FAILED
.
getMessage
(),
e
.
getMessage
()));
StrFormatter
.
format
(
"{}:{}"
,
Status
.
GAETWAY_KUBERNETS_TEST_FAILED
.
getMessage
(),
e
.
getMessage
()));
}
finally
{
close
();
}
}
}
}
...
@@ -205,4 +211,14 @@ public abstract class KubernetesGateway extends AbstractGateway {
...
@@ -205,4 +211,14 @@ public abstract class KubernetesGateway extends AbstractGateway {
logger
.
error
(
e
.
getMessage
(),
e
);
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
}
}
public
void
close
()
{
if
(
client
!=
null
)
{
client
.
close
();
}
if
(
kubernetesClient
!=
null
)
{
kubernetesClient
.
close
();
}
FileUtil
.
del
(
tmpConfDir
);
}
}
}
dinky-gateway/src/main/java/org/dinky/gateway/kubernetes/operator/KubernetsOperatorGateway.java
View file @
f3f4d225
...
@@ -35,6 +35,7 @@ import org.dinky.gateway.result.TestResult;
...
@@ -35,6 +35,7 @@ import org.dinky.gateway.result.TestResult;
import
org.dinky.utils.TextUtil
;
import
org.dinky.utils.TextUtil
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.http.util.TextUtils
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -61,16 +62,12 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
...
@@ -61,16 +62,12 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
private
FlinkDeployment
flinkDeployment
=
new
FlinkDeployment
();
private
FlinkDeployment
flinkDeployment
=
new
FlinkDeployment
();
private
FlinkDeploymentSpec
flinkDeploymentSpec
=
new
FlinkDeploymentSpec
();
private
FlinkDeploymentSpec
flinkDeploymentSpec
=
new
FlinkDeploymentSpec
();
private
KubernetesClient
kubernetesClient
;
private
KubernetesClient
kubernetesClient
;
// TODO 改为ProcessStep注释
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
KubernetsOperatorGateway
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
KubernetsOperatorGateway
.
class
);
@Override
@Override
protected
void
init
()
{
protected
void
init
()
{
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
initKubeClient
();
flinkConfig
=
config
.
getFlinkConfig
();
k8sConfig
=
config
.
getKubernetesConfig
();
kubernetesClient
=
new
DefaultKubernetesClient
();
initBase
();
initBase
();
initMetadata
();
initMetadata
();
initSpec
();
initSpec
();
...
@@ -78,13 +75,24 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
...
@@ -78,13 +75,24 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
initJob
();
initJob
();
}
}
private
void
initKubeClient
()
{
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
flinkConfig
=
config
.
getFlinkConfig
();
k8sConfig
=
config
.
getKubernetesConfig
();
if
(
TextUtils
.
isEmpty
(
k8sConfig
.
getKubeConfig
()))
{
kubernetesClient
=
new
DefaultKubernetesClient
();
}
else
{
kubernetesClient
=
DefaultKubernetesClient
.
fromConfig
(
k8sConfig
.
getKubeConfig
());
}
}
@Override
@Override
public
TestResult
test
()
{
public
TestResult
test
()
{
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
flinkConfig
=
config
.
getFlinkConfig
();
flinkConfig
=
config
.
getFlinkConfig
();
config
.
getFlinkConfig
().
setJobName
(
"test"
);
config
.
getFlinkConfig
().
setJobName
(
"test"
);
kubernetesClient
=
new
DefaultKubernetes
Client
();
initKube
Client
();
initBase
();
initBase
();
initMetadata
();
initMetadata
();
initSpec
();
initSpec
();
...
@@ -97,8 +105,7 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
...
@@ -97,8 +105,7 @@ public abstract class KubernetsOperatorGateway extends AbstractGateway {
public
boolean
onJobFinishCallback
(
String
status
)
{
public
boolean
onJobFinishCallback
(
String
status
)
{
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
kubernetsConfiguration
=
config
.
getKubernetesConfig
().
getConfiguration
();
kubernetesClient
=
new
DefaultKubernetesClient
();
initKubeClient
();
String
jobName
=
config
.
getFlinkConfig
().
getJobName
();
String
jobName
=
config
.
getFlinkConfig
().
getJobName
();
if
(
status
.
equals
(
JobStatus
.
FINISHED
.
getValue
()))
{
if
(
status
.
equals
(
JobStatus
.
FINISHED
.
getValue
()))
{
logger
.
info
(
logger
.
info
(
...
...
dinky-gateway/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
View file @
f3f4d225
...
@@ -34,6 +34,7 @@ import org.dinky.gateway.result.TestResult;
...
@@ -34,6 +34,7 @@ import org.dinky.gateway.result.TestResult;
import
org.apache.flink.client.deployment.ClusterRetrieveException
;
import
org.apache.flink.client.deployment.ClusterRetrieveException
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.client.program.ClusterClient
;
import
org.apache.flink.configuration.CoreOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.DeploymentOptions
;
import
org.apache.flink.configuration.GlobalConfiguration
;
import
org.apache.flink.configuration.GlobalConfiguration
;
import
org.apache.flink.configuration.SecurityOptions
;
import
org.apache.flink.configuration.SecurityOptions
;
...
@@ -89,6 +90,7 @@ public abstract class YarnGateway extends AbstractGateway {
...
@@ -89,6 +90,7 @@ public abstract class YarnGateway extends AbstractGateway {
private
void
initConfig
()
{
private
void
initConfig
()
{
final
ClusterConfig
clusterConfig
=
config
.
getClusterConfig
();
final
ClusterConfig
clusterConfig
=
config
.
getClusterConfig
();
configuration
=
GlobalConfiguration
.
loadConfiguration
(
clusterConfig
.
getFlinkConfigPath
());
configuration
=
GlobalConfiguration
.
loadConfiguration
(
clusterConfig
.
getFlinkConfigPath
());
configuration
.
set
(
CoreOptions
.
CLASSLOADER_RESOLVE_ORDER
,
"parent-first"
);
final
FlinkConfig
flinkConfig
=
config
.
getFlinkConfig
();
final
FlinkConfig
flinkConfig
=
config
.
getFlinkConfig
();
if
(
Asserts
.
isNotNull
(
flinkConfig
.
getConfiguration
()))
{
if
(
Asserts
.
isNotNull
(
flinkConfig
.
getConfiguration
()))
{
...
...
dinky-web/src/locales/en-US/pages.ts
View file @
f3f4d225
...
@@ -656,7 +656,7 @@ export default {
...
@@ -656,7 +656,7 @@ export default {
'rc.cc.flinkConfig'
:
'Flink Config'
,
'rc.cc.flinkConfig'
:
'Flink Config'
,
'rc.cc.flinkConfigPath'
:
'Flink Config File Path'
,
'rc.cc.flinkConfigPath'
:
'Flink Config File Path'
,
'rc.cc.flinkConfigPathHelp'
:
'rc.cc.flinkConfigPathHelp'
:
'
Please enter flink-conf.yaml path! Values such as /opt/module/flink/conf
'
,
'
Only specify to the folder, dinky will auto read the configuration, this parameter is optional in K8S mode
'
,
'rc.cc.flinkConfigPathPlaceholder'
:
'rc.cc.flinkConfigPathPlaceholder'
:
'Please enter the flink-conf.yaml path! Values such as /opt/module/flink/conf '
,
'Please enter the flink-conf.yaml path! Values such as /opt/module/flink/conf '
,
'rc.cc.hadoop.defineConfig'
:
'Hadoop Custom Config (high priority)'
,
'rc.cc.hadoop.defineConfig'
:
'Hadoop Custom Config (high priority)'
,
...
@@ -685,6 +685,8 @@ export default {
...
@@ -685,6 +685,8 @@ export default {
'rc.cc.k8s.tmCpu'
:
'TaskManager CPU Config'
,
'rc.cc.k8s.tmCpu'
:
'TaskManager CPU Config'
,
'rc.cc.k8s.tmCpuHelp'
:
'TaskManager CPU configuration! eg'
,
'rc.cc.k8s.tmCpuHelp'
:
'TaskManager CPU configuration! eg'
,
'rc.cc.k8sConfig'
:
'Kubernetes Config'
,
'rc.cc.k8sConfig'
:
'Kubernetes Config'
,
'rc.cc.k8s.defaultKubeConfigHelp'
:
'If you do not fill in this field, the `~/.kube/config` file will be used by default'
,
'rc.cc.k8sOp.version'
:
'Flink Version'
,
'rc.cc.k8sOp.version'
:
'Flink Version'
,
'rc.cc.k8sOp.versionHelp'
:
'Please select the Flink version!'
,
'rc.cc.k8sOp.versionHelp'
:
'Please select the Flink version!'
,
'rc.cc.key'
:
'Config Key'
,
'rc.cc.key'
:
'Config Key'
,
...
@@ -714,6 +716,8 @@ export default {
...
@@ -714,6 +716,8 @@ export default {
'rc.cc.type'
:
'Type'
,
'rc.cc.type'
:
'Type'
,
'rc.cc.typePlaceholder'
:
'Please select the cluster configuration type!'
,
'rc.cc.typePlaceholder'
:
'Please select the cluster configuration type!'
,
'rc.cc.value'
:
'Config Value'
,
'rc.cc.value'
:
'Config Value'
,
'rc.cc.loadFromLocal'
:
'Load from a local file'
,
'rc.ci.alias'
:
'Alias'
,
'rc.ci.alias'
:
'Alias'
,
'rc.ci.aliasPlaceholder'
:
'Please enter an alias!'
,
'rc.ci.aliasPlaceholder'
:
'Please enter an alias!'
,
'rc.ci.ar'
:
'Auto Registration'
,
'rc.ci.ar'
:
'Auto Registration'
,
...
...
dinky-web/src/locales/zh-CN/pages.ts
View file @
f3f4d225
...
@@ -611,7 +611,7 @@ export default {
...
@@ -611,7 +611,7 @@ export default {
'rc.cc.addConfig'
:
'添加配置项'
,
'rc.cc.addConfig'
:
'添加配置项'
,
'rc.cc.baseConfig'
:
'基本配置'
,
'rc.cc.baseConfig'
:
'基本配置'
,
'rc.cc.ckpDir'
:
'检查点路径'
,
'rc.cc.ckpDir'
:
'检查点路径'
,
'rc.cc.ckpDirHelp'
:
'
请输入检查点路径! 此参数配置项为
'
,
'rc.cc.ckpDirHelp'
:
'
对应SavePoint路径
'
,
'rc.cc.create'
:
'创建集群配置'
,
'rc.cc.create'
:
'创建集群配置'
,
'rc.cc.defineConfig'
:
'Flink 预设配置(高优先级)'
,
'rc.cc.defineConfig'
:
'Flink 预设配置(高优先级)'
,
'rc.cc.delete'
:
'删除集群配置'
,
'rc.cc.delete'
:
'删除集群配置'
,
...
@@ -634,7 +634,8 @@ export default {
...
@@ -634,7 +634,8 @@ export default {
'rc.cc.flink.defineConfig'
:
'Flink 自定义配置(高优先级)'
,
'rc.cc.flink.defineConfig'
:
'Flink 自定义配置(高优先级)'
,
'rc.cc.flinkConfig'
:
'Flink 配置'
,
'rc.cc.flinkConfig'
:
'Flink 配置'
,
'rc.cc.flinkConfigPath'
:
'Flink 配置文件路径'
,
'rc.cc.flinkConfigPath'
:
'Flink 配置文件路径'
,
'rc.cc.flinkConfigPathHelp'
:
'请输入 flink-conf.yaml 路径!值如 /opt/module/flink/conf '
,
'rc.cc.flinkConfigPathHelp'
:
'仅指定到文件夹,dinky会自行读取文件夹下的配置文件,k8s模式下此参数可选填'
,
'rc.cc.flinkConfigPathPlaceholder'
:
'请输入 flink-conf.yaml 路径!值如 /opt/module/flink/conf '
,
'rc.cc.flinkConfigPathPlaceholder'
:
'请输入 flink-conf.yaml 路径!值如 /opt/module/flink/conf '
,
'rc.cc.hadoop.defineConfig'
:
'Hadoop 自定义配置(高优先级)'
,
'rc.cc.hadoop.defineConfig'
:
'Hadoop 自定义配置(高优先级)'
,
'rc.cc.hadoopConfig'
:
'Hadoop 配置'
,
'rc.cc.hadoopConfig'
:
'Hadoop 配置'
,
...
@@ -659,6 +660,7 @@ export default {
...
@@ -659,6 +660,7 @@ export default {
'rc.cc.k8s.tmCpu'
:
'TaskManager CPU 配置'
,
'rc.cc.k8s.tmCpu'
:
'TaskManager CPU 配置'
,
'rc.cc.k8s.tmCpuHelp'
:
'TaskManager CPU 配置! eg'
,
'rc.cc.k8s.tmCpuHelp'
:
'TaskManager CPU 配置! eg'
,
'rc.cc.k8sConfig'
:
'Kubernetes 配置'
,
'rc.cc.k8sConfig'
:
'Kubernetes 配置'
,
'rc.cc.k8s.defaultKubeConfigHelp'
:
'如果不填写,则默认使用`~/.kube/config`文件'
,
'rc.cc.k8sOp.version'
:
'Flink 版本'
,
'rc.cc.k8sOp.version'
:
'Flink 版本'
,
'rc.cc.k8sOp.versionHelp'
:
'请选择Flink 版本!'
,
'rc.cc.k8sOp.versionHelp'
:
'请选择Flink 版本!'
,
'rc.cc.key'
:
'配置项'
,
'rc.cc.key'
:
'配置项'
,
...
@@ -671,7 +673,7 @@ export default {
...
@@ -671,7 +673,7 @@ export default {
'rc.cc.search'
:
'搜索 名称'
,
'rc.cc.search'
:
'搜索 名称'
,
'rc.cc.namePlaceholder'
:
'请输入集群配置名称!'
,
'rc.cc.namePlaceholder'
:
'请输入集群配置名称!'
,
'rc.cc.spDir'
:
'保存点路径'
,
'rc.cc.spDir'
:
'保存点路径'
,
'rc.cc.spDirHelp'
:
'
请输入保存点路径! 此参数配置项为
'
,
'rc.cc.spDirHelp'
:
'
对应CheckPoint目录,如 hdfs://xxx/flink
'
,
'rc.cc.sqlSubmitJarPath'
:
'Jar 文件路径'
,
'rc.cc.sqlSubmitJarPath'
:
'Jar 文件路径'
,
'rc.cc.sqlSubmitJarPathHelp'
:
'请输入 Jar 文件路径! eg'
,
'rc.cc.sqlSubmitJarPathHelp'
:
'请输入 Jar 文件路径! eg'
,
'rc.cc.start'
:
'启动 Session 集群'
,
'rc.cc.start'
:
'启动 Session 集群'
,
...
@@ -685,8 +687,11 @@ export default {
...
@@ -685,8 +687,11 @@ export default {
'rc.cc.type'
:
'类型'
,
'rc.cc.type'
:
'类型'
,
'rc.cc.typePlaceholder'
:
'请选择集群配置类型!'
,
'rc.cc.typePlaceholder'
:
'请选择集群配置类型!'
,
'rc.cc.value'
:
'配置值'
,
'rc.cc.value'
:
'配置值'
,
'rc.cc.loadFromLocal'
:
'从本地文件加载'
,
'rc.ci.alias'
:
'实例别名'
,
'rc.ci.alias'
:
'实例别名'
,
'rc.ci.aliasPlaceholder'
:
'请输入别名!'
,
'rc.ci.aliasPlaceholder'
:
'请输入别名!'
,
'rc.ci.ar'
:
'自动注册'
,
'rc.ci.ar'
:
'自动注册'
,
'rc.ci.mr'
:
'手动注册'
,
'rc.ci.mr'
:
'手动注册'
,
'rc.ci.create'
:
'创建集群'
,
'rc.ci.create'
:
'创建集群'
,
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/contants.tsx
View file @
f3f4d225
...
@@ -23,7 +23,6 @@ export const ExposedTypeOptions = [
...
@@ -23,7 +23,6 @@ export const ExposedTypeOptions = [
];
];
export
const
versionOptions
=
[
export
const
versionOptions
=
[
{
label
:
'1.13'
,
value
:
'v1_13'
},
{
label
:
'1.14'
,
value
:
'v1_14'
},
{
label
:
'1.14'
,
value
:
'v1_14'
},
{
label
:
'1.15'
,
value
:
'v1_15'
},
{
label
:
'1.15'
,
value
:
'v1_15'
},
{
label
:
'1.16'
,
value
:
'v1_16'
},
{
label
:
'1.16'
,
value
:
'v1_16'
},
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/FlinkK8s/index.tsx
View file @
f3f4d225
...
@@ -28,6 +28,7 @@ import { KUBERNETES_CONFIG_LIST } from '@/pages/RegCenter/Cluster/Configuration/
...
@@ -28,6 +28,7 @@ import { KUBERNETES_CONFIG_LIST } from '@/pages/RegCenter/Cluster/Configuration/
import
{
ClusterType
}
from
'@/pages/RegCenter/Cluster/constants'
;
import
{
ClusterType
}
from
'@/pages/RegCenter/Cluster/constants'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
connect
}
from
'@@/exports'
;
import
{
connect
}
from
'@@/exports'
;
import
{
UploadOutlined
}
from
'@ant-design/icons'
;
import
{
import
{
ProCard
,
ProCard
,
ProFormGroup
,
ProFormGroup
,
...
@@ -36,17 +37,29 @@ import {
...
@@ -36,17 +37,29 @@ import {
ProFormSelect
,
ProFormSelect
,
ProFormText
ProFormText
}
from
'@ant-design/pro-components'
;
}
from
'@ant-design/pro-components'
;
import
{
Col
,
Divider
,
Row
,
Space
}
from
'antd'
;
import
{
Button
,
Col
,
Divider
,
Row
,
Space
,
Typography
,
Upload
,
UploadProps
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
RcFile
}
from
'antd/es/upload/interface'
;
import
{
Values
}
from
'async-validator'
;
import
{
useState
}
from
'react'
;
const
{
Text
}
=
Typography
;
const
CodeEditProps
=
{
const
CodeEditProps
=
{
height
:
'
4
0vh'
,
height
:
'
3
0vh'
,
width
:
'90vh'
,
width
:
'90vh'
,
lineNumbers
:
'on'
,
lineNumbers
:
'on'
,
language
:
'yaml'
language
:
'yaml'
};
};
const
FlinkK8s
=
(
props
:
{
type
:
string
;
value
:
any
}
&
connect
)
=>
{
const
FlinkK8s
=
(
props
:
{
type
:
string
;
value
:
any
;
form
:
FormInstance
<
Values
>
}
&
connect
)
=>
{
const
{
type
,
value
,
flinkConfigOptions
}
=
props
;
const
{
type
,
value
,
form
,
flinkConfigOptions
}
=
props
;
const
k8sConfig
=
value
.
config
?.
kubernetesConfig
;
const
[
kubeConfig
,
setKubeConfig
]
=
useState
<
string
>
(
k8sConfig
?.
kubeConfig
);
const
[
podTemplate
,
setPodTemplate
]
=
useState
<
string
>
(
k8sConfig
?.
podTemplate
);
const
[
jmPodTemplate
,
setJmPodTemplate
]
=
useState
<
string
>
(
k8sConfig
?.
jmPodTemplate
);
const
[
tmPodTemplate
,
setTmPodTemplate
]
=
useState
<
string
>
(
k8sConfig
?.
tmPodTemplate
);
const
renderK8sConfig
=
()
=>
{
const
renderK8sConfig
=
()
=>
{
return
(
return
(
...
@@ -58,6 +71,7 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
...
@@ -58,6 +71,7 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
name=
{
[
'config'
,
'kubernetesConfig'
,
'configuration'
,
item
.
name
]
}
name=
{
[
'config'
,
'kubernetesConfig'
,
'configuration'
,
item
.
name
]
}
label=
{
item
.
label
}
label=
{
item
.
label
}
width=
{
260
}
width=
{
260
}
rules=
{
item
.
rules
??
[]
}
placeholder=
{
item
.
placeholder
}
placeholder=
{
item
.
placeholder
}
/>
/>
))
}
))
}
...
@@ -65,32 +79,81 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
...
@@ -65,32 +79,81 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
);
);
};
};
const
renderEdit
=
(
name
:
string
[],
onChange
:
(
value
:
string
)
=>
void
,
key
:
string
,
value
?:
string
,
tips
?:
string
)
=>
{
const
uploadProp
:
UploadProps
=
{
beforeUpload
:
(
file
:
RcFile
)
=>
{
const
reader
=
new
FileReader
();
reader
.
readAsText
(
file
);
reader
.
onload
=
()
=>
{
form
.
setFieldValue
(
name
,
reader
.
result
as
string
);
onChange
(
reader
.
result
as
string
);
};
},
showUploadList
:
false
};
return
(
<
Space
direction=
{
'vertical'
}
>
<
Upload
{
...
uploadProp
}
>
<
Button
icon=
{
<
UploadOutlined
/>
}
>
{
l
(
'rc.cc.loadFromLocal'
)
}
</
Button
>
<
Text
type=
{
'secondary'
}
>
{
tips
}
</
Text
>
</
Upload
>
<
ProFormItem
key=
{
key
}
name=
{
name
}
>
<
CodeEdit
{
...
CodeEditProps
}
code=
{
value
??
''
}
/>
</
ProFormItem
>
</
Space
>
);
};
const
configTags
=
[
const
configTags
=
[
{
key
:
'kubeConfig'
,
forceRender
:
true
,
label
:
<
TagAlignCenter
>
K8s KubeConfig
</
TagAlignCenter
>,
children
:
renderEdit
(
[
'config'
,
'kubernetesConfig'
,
'kubeConfig'
],
(
value
)
=>
setKubeConfig
(
value
),
'k8s-kubeconfig-item'
,
kubeConfig
,
l
(
'rc.cc.k8s.defaultKubeConfigHelp'
)
)
},
{
{
key
:
'defaultPodTemplate'
,
key
:
'defaultPodTemplate'
,
forceRender
:
true
,
label
:
<
TagAlignCenter
>
Default Pod Template
</
TagAlignCenter
>,
label
:
<
TagAlignCenter
>
Default Pod Template
</
TagAlignCenter
>,
children
:
(
children
:
renderEdit
(
<
ProFormItem
key=
'dpe'
name=
{
[
'config'
,
'kubernetesConfig'
,
'podTemplate'
]
}
>
[
'config'
,
'kubernetesConfig'
,
'podTemplate'
],
<
CodeEdit
{
...
CodeEditProps
}
code=
{
value
.
config
?.
kubernetesConfig
?.
podTemplate
??
''
}
/>
(
value
)
=>
setPodTemplate
(
value
),
</
ProFormItem
>
'k8s-podTemplate-item'
,
podTemplate
)
)
},
},
{
{
key
:
'JMPodTemplate'
,
key
:
'JMPodTemplate'
,
forceRender
:
true
,
label
:
<
TagAlignCenter
>
JM Pod Template
</
TagAlignCenter
>,
label
:
<
TagAlignCenter
>
JM Pod Template
</
TagAlignCenter
>,
children
:
(
children
:
renderEdit
(
<
ProFormItem
key=
'jmdpe'
name=
{
[
'config'
,
'kubernetesConfig'
,
'jmPodTemplate'
]
}
>
[
'config'
,
'kubernetesConfig'
,
'jmPodTemplate'
],
<
CodeEdit
{
...
CodeEditProps
}
code=
{
value
.
config
?.
kubernetesConfig
?.
jmPodTemplate
??
''
}
/>
(
value
)
=>
setJmPodTemplate
(
value
),
</
ProFormItem
>
'k8s-jmPodTemplate-item'
,
jmPodTemplate
)
)
},
},
{
{
key
:
'TMPodTemplate'
,
key
:
'TMPodTemplate'
,
forceRender
:
true
,
label
:
<
TagAlignCenter
>
TM Pod Template
</
TagAlignCenter
>,
label
:
<
TagAlignCenter
>
TM Pod Template
</
TagAlignCenter
>,
children
:
(
children
:
renderEdit
(
<
ProFormItem
key=
'tmdpe'
name=
{
[
'config'
,
'kubernetesConfig'
,
'tmPodTemplate'
]
}
>
[
'config'
,
'kubernetesConfig'
,
'tmPodTemplate'
],
<
CodeEdit
{
...
CodeEditProps
}
code=
{
value
.
config
?.
kubernetesConfig
?.
tmPodTemplate
??
''
}
/>
(
value
)
=>
setTmPodTemplate
(
value
),
</
ProFormItem
>
'k8s-tmPodTemplate-item'
,
tmPodTemplate
)
)
}
}
];
];
...
@@ -113,6 +176,7 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
...
@@ -113,6 +176,7 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
tooltip=
{
l
(
'rc.cc.k8s.exposedHelp'
)
}
tooltip=
{
l
(
'rc.cc.k8s.exposedHelp'
)
}
placeholder=
{
l
(
'rc.cc.k8s.exposedHelp'
)
}
placeholder=
{
l
(
'rc.cc.k8s.exposedHelp'
)
}
options=
{
ExposedTypeOptions
}
options=
{
ExposedTypeOptions
}
rules=
{
[{
required
:
true
}]
}
width=
{
250
}
width=
{
250
}
/>
/>
)
}
)
}
...
@@ -123,9 +187,16 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
...
@@ -123,9 +187,16 @@ const FlinkK8s = (props: { type: string; value: any } & connect) => {
width=
{
250
}
width=
{
250
}
placeholder=
{
l
(
'rc.cc.k8sOp.versionHelp'
)
}
placeholder=
{
l
(
'rc.cc.k8sOp.versionHelp'
)
}
options=
{
versionOptions
}
options=
{
versionOptions
}
rules=
{
[{
required
:
true
}]
}
/>
/>
)
}
)
}
{
renderK8sConfig
()
}
{
renderK8sConfig
()
}
<
ProFormText
name=
{
[
'config'
,
'clusterConfig'
,
'flinkConfigPath'
]
}
label=
{
l
(
'rc.cc.flinkConfigPath'
)
}
placeholder=
{
l
(
'rc.cc.flinkConfigPathPlaceholder'
)
}
tooltip=
{
l
(
'rc.cc.flinkConfigPathHelp'
)
}
/>
</
ProFormGroup
>
</
ProFormGroup
>
<
ProFormList
<
ProFormList
name=
{
[
'config'
,
'flinkConfig'
,
'flinkConfigList'
]
}
name=
{
[
'config'
,
'flinkConfig'
,
'flinkConfigList'
]
}
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/HighPriorityConfig/index.tsx
View file @
f3f4d225
...
@@ -42,11 +42,6 @@ const HighPriorityConfig = () => {
...
@@ -42,11 +42,6 @@ const HighPriorityConfig = () => {
<
Divider
>
{
l
(
'rc.cc.defineConfig'
)
}
</
Divider
>
<
Divider
>
{
l
(
'rc.cc.defineConfig'
)
}
</
Divider
>
<
ProFormGroup
direction=
{
'horizontal'
}
align=
{
'baseline'
}
>
<
ProFormGroup
direction=
{
'horizontal'
}
align=
{
'baseline'
}
>
{
renderHighPriorityConfig
()
}
{
renderHighPriorityConfig
()
}
<
ProFormText
name=
{
[
'config'
,
'clusterConfig'
,
'flinkConfigPath'
]
}
label=
{
'Flink Conf Yaml Path'
}
width=
{
400
}
/>
</
ProFormGroup
>
</
ProFormGroup
>
</>
</>
);
);
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/ConfigurationModal/ConfigurationForm/index.tsx
View file @
f3f4d225
...
@@ -44,7 +44,7 @@ const ConfigurationForm: React.FC<ConfigurationFormProps> = (props) => {
...
@@ -44,7 +44,7 @@ const ConfigurationForm: React.FC<ConfigurationFormProps> = (props) => {
{
type
&&
type
===
ClusterType
.
YARN
?
(
{
type
&&
type
===
ClusterType
.
YARN
?
(
<
YarnConfig
/>
<
YarnConfig
/>
)
:
(
)
:
(
<
FlinkK8s
type=
{
type
}
value=
{
value
}
/>
<
FlinkK8s
type=
{
type
}
value=
{
value
}
form=
{
form
}
/>
)
}
)
}
<
HighPriorityConfig
/>
<
HighPriorityConfig
/>
<
ApplicationConfig
/>
<
ApplicationConfig
/>
...
...
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/contants.tsx
View file @
f3f4d225
...
@@ -133,19 +133,22 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
...
@@ -133,19 +133,22 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
name
:
'kubernetes.namespace'
,
name
:
'kubernetes.namespace'
,
label
:
l
(
'rc.cc.k8s.namespace'
),
label
:
l
(
'rc.cc.k8s.namespace'
),
placeholder
:
l
(
'rc.cc.k8s.namespaceHelp'
),
placeholder
:
l
(
'rc.cc.k8s.namespaceHelp'
),
tooltip
:
l
(
'rc.cc.k8s.namespaceHelp'
)
tooltip
:
l
(
'rc.cc.k8s.namespaceHelp'
),
rules
:
[{
required
:
true
}]
},
},
{
{
name
:
'kubernetes.service.account'
,
name
:
'kubernetes.service.account'
,
label
:
l
(
'rc.cc.k8s.account'
),
label
:
l
(
'rc.cc.k8s.account'
),
placeholder
:
l
(
'rc.cc.k8s.accountHelp'
),
placeholder
:
l
(
'rc.cc.k8s.accountHelp'
),
tooltip
:
l
(
'rc.cc.k8s.accountHelp'
)
tooltip
:
l
(
'rc.cc.k8s.accountHelp'
),
rules
:
[{
required
:
true
}]
},
},
{
{
name
:
'kubernetes.container.image'
,
name
:
'kubernetes.container.image'
,
label
:
l
(
'rc.cc.k8s.image'
),
label
:
l
(
'rc.cc.k8s.image'
),
placeholder
:
l
(
'rc.cc.k8s.imageHelp'
),
placeholder
:
l
(
'rc.cc.k8s.imageHelp'
),
tooltip
:
l
(
'rc.cc.k8s.imageHelp'
)
tooltip
:
l
(
'rc.cc.k8s.imageHelp'
),
rules
:
[{
required
:
true
}]
},
},
{
{
name
:
'kubernetes.jobmanager.cpu'
,
name
:
'kubernetes.jobmanager.cpu'
,
...
@@ -158,11 +161,5 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
...
@@ -158,11 +161,5 @@ export const KUBERNETES_CONFIG_LIST: FormConfig[] = [
label
:
l
(
'rc.cc.k8s.tmCpu'
),
label
:
l
(
'rc.cc.k8s.tmCpu'
),
placeholder
:
l
(
'rc.cc.k8s.tmCpuHelp'
),
placeholder
:
l
(
'rc.cc.k8s.tmCpuHelp'
),
tooltip
:
l
(
'rc.cc.k8s.tmCpuHelp'
)
tooltip
:
l
(
'rc.cc.k8s.tmCpuHelp'
)
},
{
name
:
'kubernetes.config.file'
,
label
:
l
(
'rc.cc.k8s.configFile'
),
placeholder
:
l
(
'rc.cc.k8s.configFileHelp'
),
tooltip
:
l
(
'rc.cc.k8s.configFileHelp'
)
}
}
];
];
dinky-web/src/pages/RegCenter/Cluster/Configuration/components/data.d.ts
View file @
f3f4d225
...
@@ -26,4 +26,5 @@ export type FormConfig = {
...
@@ -26,4 +26,5 @@ export type FormConfig = {
help
?:
string
;
help
?:
string
;
showOnSubmitType
?:
string
;
showOnSubmitType
?:
string
;
showType
?:
string
;
showType
?:
string
;
rules
?:
any
[];
};
};
dinky-web/src/types/Studio/data.d.ts
View file @
f3f4d225
...
@@ -124,6 +124,7 @@ export type AppConfig = {
...
@@ -124,6 +124,7 @@ export type AppConfig = {
export
type
K8sConfig
=
{
export
type
K8sConfig
=
{
configuration
:
Map
<
string
,
string
>
;
configuration
:
Map
<
string
,
string
>
;
dockerConfig
:
Map
<
string
,
string
>
;
dockerConfig
:
Map
<
string
,
string
>
;
kubeConfig
:
string
;
podTemplate
:
string
;
podTemplate
:
string
;
jmPodTemplate
:
string
;
jmPodTemplate
:
string
;
tmPodTemplate
:
string
;
tmPodTemplate
:
string
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment