Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dlink
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
zhaowei
dlink
Commits
fbd80e57
Commit
fbd80e57
authored
Jan 23, 2022
by
wenmo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增K8S集群配置
parent
edb23f49
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
21 deletions
+148
-21
ClusterConfigurationServiceImpl.java
...m/dlink/service/impl/ClusterConfigurationServiceImpl.java
+21
-3
JobConfig.java
dlink-core/src/main/java/com/dlink/job/JobConfig.java
+21
-3
index.tsx
dlink-web/src/components/Studio/index.tsx
+1
-0
ClusterConfigurationForm.tsx
...sterConfiguration/components/ClusterConfigurationForm.tsx
+46
-2
conf.ts
dlink-web/src/pages/ClusterConfiguration/conf.ts
+21
-0
function.ts
dlink-web/src/pages/ClusterConfiguration/function.ts
+34
-12
Welcome.tsx
dlink-web/src/pages/Welcome.tsx
+4
-1
No files found.
dlink-admin/src/main/java/com/dlink/service/impl/ClusterConfigurationServiceImpl.java
View file @
fbd80e57
...
...
@@ -52,14 +52,32 @@ public class ClusterConfigurationServiceImpl extends SuperServiceImpl<ClusterCon
clusterConfiguration
.
parseConfig
();
Map
<
String
,
Object
>
config
=
clusterConfiguration
.
getConfig
();
GatewayConfig
gatewayConfig
=
new
GatewayConfig
();
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
config
.
get
(
"hadoopConfigPath"
).
toString
()));
if
(
config
.
containsKey
(
"hadoopConfigPath"
))
{
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
config
.
get
(
"hadoopConfigPath"
).
toString
()));
}
else
{
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
""
));
}
if
(
config
.
containsKey
(
"flinkConfig"
)){
gatewayConfig
.
setFlinkConfig
(
FlinkConfig
.
build
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)));
}
if
(
Asserts
.
isEqualsIgnoreCase
(
clusterConfiguration
.
getType
(),
"Yarn"
)){
gatewayConfig
.
setType
(
GatewayType
.
YARN_PER_JOB
);
}
else
if
(
Asserts
.
isEqualsIgnoreCase
(
clusterConfiguration
.
getType
(),
"Kubernetes"
)){
gatewayConfig
.
setType
(
GatewayType
.
KUBERNETES_APPLICATION
);
Map
kubernetesConfig
=
(
Map
)
config
.
get
(
"kubernetesConfig"
);
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.namespace"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.namespace"
,
kubernetesConfig
.
get
(
"kubernetes.namespace"
).
toString
());
}
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.cluster-id"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.cluster-id"
,
kubernetesConfig
.
get
(
"kubernetes.cluster-id"
).
toString
());
}
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.container.image"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.container.image"
,
kubernetesConfig
.
get
(
"kubernetes.container.image"
).
toString
());
}
}
return
JobManager
.
testGateway
(
gatewayConfig
);
}
...
...
dlink-core/src/main/java/com/dlink/job/JobConfig.java
View file @
fbd80e57
...
...
@@ -159,9 +159,15 @@ public class JobConfig {
public
void
buildGatewayConfig
(
Map
<
String
,
Object
>
config
){
gatewayConfig
=
new
GatewayConfig
();
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
config
.
get
(
"hadoopConfigPath"
).
toString
()));
if
(
config
.
containsKey
(
"hadoopConfigPath"
))
{
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
config
.
get
(
"hadoopConfigPath"
).
toString
()));
}
else
{
gatewayConfig
.
setClusterConfig
(
ClusterConfig
.
build
(
config
.
get
(
"flinkConfigPath"
).
toString
(),
config
.
get
(
"flinkLibPath"
).
toString
(),
""
));
}
AppConfig
appConfig
=
new
AppConfig
();
if
(
config
.
containsKey
(
"userJarPath"
)
&&
Asserts
.
isNotNullString
((
String
)
config
.
get
(
"userJarPath"
))){
appConfig
.
setUserJarPath
(
config
.
get
(
"userJarPath"
).
toString
());
...
...
@@ -176,6 +182,18 @@ public class JobConfig {
if
(
config
.
containsKey
(
"flinkConfig"
)
&&
Asserts
.
isNotNullMap
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
))){
gatewayConfig
.
setFlinkConfig
(
FlinkConfig
.
build
((
Map
<
String
,
String
>)
config
.
get
(
"flinkConfig"
)));
}
if
(
config
.
containsKey
(
"kubernetesConfig"
)){
Map
kubernetesConfig
=
(
Map
)
config
.
get
(
"kubernetesConfig"
);
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.namespace"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.namespace"
,
kubernetesConfig
.
get
(
"kubernetes.namespace"
).
toString
());
}
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.cluster-id"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.cluster-id"
,
kubernetesConfig
.
get
(
"kubernetes.cluster-id"
).
toString
());
}
if
(
kubernetesConfig
.
containsKey
(
"kubernetes.container.image"
))
{
gatewayConfig
.
getFlinkConfig
().
getConfiguration
().
put
(
"kubernetes.container.image"
,
kubernetesConfig
.
get
(
"kubernetes.container.image"
).
toString
());
}
}
}
public
void
addGatewayConfig
(
List
<
Map
<
String
,
String
>>
configList
){
...
...
dlink-web/src/components/Studio/index.tsx
View file @
fbd80e57
...
...
@@ -60,6 +60,7 @@ const Studio = (props: any) => {
listSession
(
dispatch
);
showJars
(
dispatch
);
showEnv
(
dispatch
);
onResize
();
},
[]);
const
onClick
=
()
=>
{
...
...
dlink-web/src/pages/ClusterConfiguration/components/ClusterConfigurationForm.tsx
View file @
fbd80e57
...
...
@@ -3,7 +3,7 @@ import {Form, Button, Input, Modal, Select,Divider,Space,Switch} from 'antd';
import
{
MinusCircleOutlined
,
PlusOutlined
}
from
'@ant-design/icons'
;
import
type
{
ClusterConfigurationTableListItem
}
from
"@/pages/ClusterConfiguration/data"
;
import
{
getConfig
,
getConfigFormValues
}
from
"@/pages/ClusterConfiguration/function"
;
import
{
FLINK_CONFIG_LIST
,
HADOOP_CONFIG_LIST
}
from
"@/pages/ClusterConfiguration/conf"
;
import
{
FLINK_CONFIG_LIST
,
HADOOP_CONFIG_LIST
,
KUBERNETES_CONFIG_LIST
}
from
"@/pages/ClusterConfiguration/conf"
;
import
type
{
Config
}
from
"@/pages/ClusterConfiguration/conf"
;
import
{
testClusterConfigurationConnect
}
from
"@/pages/ClusterConfiguration/service"
;
...
...
@@ -39,6 +39,10 @@ const ClusterConfigurationForm: React.FC<ClusterConfigurationFormProps> = (props
modalVisible
,
}
=
props
;
const
onValuesChange
=
(
change
:
any
,
all
:
any
)
=>
{
setFormVals
({...
formVals
,...
change
});
};
const
buildConfig
=
(
config
:
Config
[])
=>
{
const
itemList
:
JSX
.
Element
[]
=
[];
config
.
forEach
(
configItem
=>
{
...
...
@@ -79,6 +83,7 @@ const ClusterConfigurationForm: React.FC<ClusterConfigurationFormProps> = (props
<
Option
value=
"Kubernetes"
>
Flink On Kubernetes
</
Option
>
</
Select
>
</
Form
.
Item
>
{
formValsPara
.
type
==
'Yarn'
?<>
<
Divider
>
Hadoop 配置
</
Divider
>
<
Form
.
Item
name=
"hadoopConfigPath"
...
...
@@ -123,7 +128,45 @@ const ClusterConfigurationForm: React.FC<ClusterConfigurationFormProps> = (props
</>
)
}
</
Form
.
List
>
</
Form
.
Item
>
</
Form
.
Item
></>:
undefined
}
{
formValsPara
.
type
==
'Kubernetes'
?<>
<
Divider
>
Kubernetes 配置
</
Divider
>
{
buildConfig
(
KUBERNETES_CONFIG_LIST
)
}
<
Form
.
Item
label=
"其他配置"
>
<
Form
.
List
name=
"kubernetesConfigList"
>
{
(
fields
,
{
add
,
remove
})
=>
(
<>
{
fields
.
map
(({
key
,
name
,
fieldKey
,
...
restField
})
=>
(
<
Space
key=
{
key
}
style=
{
{
display
:
'flex'
}
}
align=
"baseline"
>
<
Form
.
Item
{
...
restField
}
name=
{
[
name
,
'name'
]
}
fieldKey=
{
[
fieldKey
,
'name'
]
}
>
<
Input
placeholder=
"name"
/>
</
Form
.
Item
>
<
Form
.
Item
{
...
restField
}
name=
{
[
name
,
'value'
]
}
fieldKey=
{
[
fieldKey
,
'value'
]
}
>
<
Input
placeholder=
"value"
/>
</
Form
.
Item
>
<
MinusCircleOutlined
onClick=
{
()
=>
remove
(
name
)
}
/>
</
Space
>
))
}
<
Form
.
Item
>
<
Button
type=
"dashed"
onClick=
{
()
=>
add
()
}
block
icon=
{
<
PlusOutlined
/>
}
>
添加一个自定义项
</
Button
>
</
Form
.
Item
>
</>
)
}
</
Form
.
List
>
</
Form
.
Item
>
</>:
undefined
}
<
Divider
>
Flink 配置
</
Divider
>
<
Form
.
Item
name=
"flinkLibPath"
...
...
@@ -250,6 +293,7 @@ const ClusterConfigurationForm: React.FC<ClusterConfigurationFormProps> = (props
{
...
formLayout
}
form=
{
form
}
initialValues=
{
getConfigFormValues
(
formVals
)
}
onValuesChange=
{
onValuesChange
}
>
{
renderContent
(
formVals
)
}
</
Form
>
...
...
dlink-web/src/pages/ClusterConfiguration/conf.ts
View file @
fbd80e57
...
...
@@ -9,6 +9,19 @@ export const HADOOP_CONFIG_LIST: Config[] = [{
lable
:
'ha.zookeeper.quorum'
,
placeholder
:
'192.168.123.1:2181,192.168.123.2:2181,192.168.123.3:2181'
,
}];
export
const
KUBERNETES_CONFIG_LIST
:
Config
[]
=
[{
name
:
'kubernetes.namespace'
,
lable
:
'kubernetes.namespace'
,
placeholder
:
'dlink'
,
},{
name
:
'kubernetes.cluster-id'
,
lable
:
'kubernetes.cluster-id'
,
placeholder
:
'dlink'
,
},{
name
:
'kubernetes.container.image'
,
lable
:
'kubernetes.container.image'
,
placeholder
:
'dlink'
,
}];
export
const
FLINK_CONFIG_LIST
:
Config
[]
=
[{
name
:
'jobmanager.memory.process.size'
,
lable
:
'jobmanager.memory.process.size'
,
...
...
@@ -44,6 +57,14 @@ export function HADOOP_CONFIG_NAME_LIST () {
return
list
;
}
export
function
KUBERNETES_CONFIG_NAME_LIST
()
{
const
list
:
string
[]
=
[];
KUBERNETES_CONFIG_LIST
.
forEach
(
item
=>
{
list
.
push
(
item
.
name
);
});
return
list
;
}
export
function
FLINK_CONFIG_NAME_LIST
()
{
const
list
:
string
[]
=
[];
FLINK_CONFIG_LIST
.
forEach
(
item
=>
{
...
...
dlink-web/src/pages/ClusterConfiguration/function.ts
View file @
fbd80e57
import
{
FLINK_CONFIG_NAME_LIST
,
HADOOP_CONFIG_NAME_LIST
}
from
"@/pages/ClusterConfiguration/conf"
;
import
{
FLINK_CONFIG_NAME_LIST
,
HADOOP_CONFIG_NAME_LIST
,
KUBERNETES_CONFIG_NAME_LIST
}
from
"@/pages/ClusterConfiguration/conf"
;
export
function
getConfig
(
values
:
any
)
{
let
hadoopConfig
=
addValueToMap
(
values
,
HADOOP_CONFIG_NAME_LIST
());
addListToMap
(
values
.
hadoopConfigList
,
hadoopConfig
);
let
flinkConfig
=
addValueToMap
(
values
,
FLINK_CONFIG_NAME_LIST
());
addListToMap
(
values
.
flinkConfigList
,
flinkConfig
);
return
{
hadoopConfigPath
:
values
.
hadoopConfigPath
,
flinkLibPath
:
values
.
flinkLibPath
,
flinkConfigPath
:
values
.
flinkConfigPath
,
hadoopConfig
:
hadoopConfig
,
flinkConfig
:
flinkConfig
,
};
if
(
values
.
type
==
'Yarn'
)
{
let
hadoopConfig
=
addValueToMap
(
values
,
HADOOP_CONFIG_NAME_LIST
());
addListToMap
(
values
.
hadoopConfigList
,
hadoopConfig
);
return
{
hadoopConfigPath
:
values
.
hadoopConfigPath
,
flinkLibPath
:
values
.
flinkLibPath
,
flinkConfigPath
:
values
.
flinkConfigPath
,
hadoopConfig
,
flinkConfig
,
};
}
else
if
(
values
.
type
==
'Kubernetes'
)
{
let
kubernetesConfig
=
addValueToMap
(
values
,
KUBERNETES_CONFIG_NAME_LIST
());
addListToMap
(
values
.
kubernetesConfigList
,
kubernetesConfig
);
return
{
flinkLibPath
:
values
.
flinkLibPath
,
flinkConfigPath
:
values
.
flinkConfigPath
,
kubernetesConfig
,
flinkConfig
,
};
}
}
type
ConfigItem
=
{
...
...
@@ -27,6 +42,9 @@ function addListToMap(list:[ConfigItem],config:{}){
function
addValueToMap
(
values
:{},
keys
:
string
[]){
let
config
=
{};
if
(
!
values
){
return
config
;
}
for
(
let
i
in
keys
){
config
[
keys
[
i
]]
=
values
[
keys
[
i
]];
}
...
...
@@ -53,16 +71,20 @@ export function getConfigFormValues(values:any) {
'flinkConfigPath'
,
]);
let
hadoopConfig
=
addValueToMap
(
config
.
hadoopConfig
,
HADOOP_CONFIG_NAME_LIST
());
let
kubernetesConfig
=
addValueToMap
(
config
.
kubernetesConfig
,
KUBERNETES_CONFIG_NAME_LIST
());
let
flinkConfig
=
addValueToMap
(
config
.
flinkConfig
,
FLINK_CONFIG_NAME_LIST
());
let
hadoopConfigList
=
addMapToList
(
config
.
hadoopConfig
,
HADOOP_CONFIG_NAME_LIST
());
let
kubernetesConfigList
=
addMapToList
(
config
.
kubernetesConfig
,
KUBERNETES_CONFIG_NAME_LIST
());
let
flinkConfigList
=
addMapToList
(
config
.
flinkConfig
,
FLINK_CONFIG_NAME_LIST
());
return
{
...
formValues
,
...
configValues
,
...
hadoopConfig
,
hadoopConfigList
:
hadoopConfigList
,
...
kubernetesConfig
,
hadoopConfigList
,
kubernetesConfigList
,
...
flinkConfig
,
flinkConfigList
:
flinkConfigList
flinkConfigList
}
}
...
...
dlink-web/src/pages/Welcome.tsx
View file @
fbd80e57
...
...
@@ -564,7 +564,7 @@ export default (): React.ReactNode => {
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
<
Timeline
.
Item
><
Text
code
>
0.5.1
</
Text
>
<
Text
type=
"secondary"
>
2022-01-
23
</
Text
>
<
Timeline
.
Item
><
Text
code
>
0.5.1
</
Text
>
<
Text
type=
"secondary"
>
2022-01-
??
</
Text
>
<
p
>
</
p
>
<
Paragraph
>
<
ul
>
...
...
@@ -619,6 +619,9 @@ export default (): React.ReactNode => {
<
li
>
<
Link
>
优化 作业配置查看及全屏开发按钮
</
Link
>
</
li
>
<
li
>
<
Link
>
新增 K8S集群配置
</
Link
>
</
li
>
</
ul
>
</
Paragraph
>
</
Timeline
.
Item
>
...
...
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