Skip to content

Commit df93f8b

Browse files
committed
add host property for StandaloneFlinkDeployingAIAssistSupport
1 parent a155466 commit df93f8b

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

tis-incr/tis-realtime-flink/src/main/java/com/qlangtech/plugins/incr/flink/launch/clustertype/StandaloneFlinkDeployingAIAssistSupport.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ public class StandaloneFlinkDeployingAIAssistSupport extends AIAssistSupport<Sta
9999
@FormField(ordinal = 4, type = FormFieldType.MEMORY_SIZE_OF_MEGA, validate = {Validator.require})
100100
public com.qlangtech.tis.plugin.MemorySize tmMemory;
101101

102-
@FormField(ordinal = 5, type = FormFieldType.INT_NUMBER, advance = true, validate = {Validator.require, Validator.integer})
102+
@FormField(ordinal = 5, type = FormFieldType.INPUTTEXT, advance = true, validate = {Validator.require, Validator.hostWithoutPort})
103+
public String host;
104+
105+
@FormField(ordinal = 6, type = FormFieldType.INT_NUMBER, advance = true, validate = {Validator.require, Validator.integer})
103106
public Integer port;
104107

105108

@@ -492,7 +495,8 @@ private Standalone createNewFlinkCluster(IAgentContext agentContext, IPluginCont
492495
FlinkCluster flinkCluster = new FlinkCluster();
493496
IdentityName newClusterId = IdentityName.createNewPrimaryFieldValue(IFlinkCluster.KEY_DISPLAY_NAME, clusters);
494497
flinkCluster.name = newClusterId.identityValue();
495-
flinkCluster.jobManagerAddress = LOCAL_HOST_VALUE + ":" + this.port;
498+
// com.qlangtech.tis.realtime.utils.NetUtils.getHost()
499+
flinkCluster.jobManagerAddress = this.host + ":" + this.port;
496500
flinkCluster.maxRetry = FLINK_DEFAULT_RETRY_MAX_ATTEMPTS;
497501
flinkCluster.retryDelay = RestOptions.RETRY_DELAY.defaultValue().toMillis();
498502

@@ -584,6 +588,14 @@ public boolean validateSlot(IFieldErrorHandler msgHandler, Context context, Stri
584588
}
585589

586590

591+
public boolean validateHost(IFieldErrorHandler msgHandler, Context context, String fieldName, String value) {
592+
if (NetUtils.isReachable(value)) {
593+
msgHandler.addFieldError(context, fieldName, "地址不可用");
594+
return false;
595+
}
596+
return true;
597+
}
598+
587599
// public boolean validatePort(IFieldErrorHandler msgHandler, Context context, String fieldName, String value) {
588600
// if (NetUtils.isPortAvailable(LOCAL_HOST_VALUE, Integer.parseInt(value))) {
589601
// msgHandler.addFieldError(context, fieldName, "端口:" + value + "不可用,或者已被占用");

tis-incr/tis-realtime-flink/src/main/resources/com/qlangtech/plugins/incr/flink/launch/clustertype/StandaloneFlinkDeployingAIAssistSupport.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@
2121
"label": "Flink Port",
2222
"dftVal": "8081",
2323
"help": "Flink 暴露的的REST API Http 端口"
24+
},
25+
"host": {
26+
"label": "主机地址",
27+
"dftVal": "com.qlangtech.tis.realtime.utils.NetUtils.getHost()",
28+
"help": "部署flink所在的地址,需要是与TIS控制台同一个主机节点地址"
2429
}
2530
}

0 commit comments

Comments
 (0)