|
29 | 29 | import org.dinky.gateway.enums.SavePointStrategy; |
30 | 30 | import org.dinky.gateway.model.FlinkClusterConfig; |
31 | 31 |
|
| 32 | +import org.apache.commons.lang3.StringUtils; |
32 | 33 | import org.apache.flink.configuration.Configuration; |
33 | 34 | import org.apache.flink.configuration.CoreOptions; |
34 | 35 | import org.apache.flink.configuration.RestOptions; |
|
42 | 43 | import lombok.AllArgsConstructor; |
43 | 44 | import lombok.Builder; |
44 | 45 | import lombok.Data; |
| 46 | +import lombok.extern.slf4j.Slf4j; |
45 | 47 |
|
46 | 48 | /** |
47 | 49 | * JobConfig |
48 | 50 | * |
49 | 51 | * @since 2021/6/27 18:45 |
50 | 52 | */ |
| 53 | +@Slf4j |
51 | 54 | @Data |
52 | 55 | @Builder |
53 | 56 | @AllArgsConstructor |
@@ -257,9 +260,18 @@ public void buildGatewayConfig(FlinkClusterConfig config) { |
257 | 260 | Assert.notNull(customConfig.getValue(), "Custom flink config has null value"); |
258 | 261 | flinkConfig.getConfiguration().put(customConfig.getName(), customConfig.getValue()); |
259 | 262 | } |
| 263 | + |
| 264 | + Map<String, String> configuration = flinkConfig.getConfiguration(); |
| 265 | + |
| 266 | + // In Kubernetes mode, must set jobmanager.memory.process.size. |
| 267 | + if (StringUtils.isBlank(configuration.get("jobmanager.memory.process.size"))) { |
| 268 | + log.warn("In Kubernetes mode, please configure 'jobmanager.memory.process.size', default 2048m"); |
| 269 | + configuration.put("jobmanager.memory.process.size", "2048m"); |
| 270 | + } |
| 271 | + |
260 | 272 | // Load job configuration content afterwards |
261 | | - flinkConfig.getConfiguration().putAll(getConfigJson()); |
262 | | - flinkConfig.getConfiguration().put(CoreOptions.DEFAULT_PARALLELISM.key(), String.valueOf(parallelism)); |
| 273 | + configuration.putAll(getConfigJson()); |
| 274 | + configuration.put(CoreOptions.DEFAULT_PARALLELISM.key(), String.valueOf(parallelism)); |
263 | 275 | flinkConfig.setJobName(getJobName()); |
264 | 276 |
|
265 | 277 | gatewayConfig = GatewayConfig.build(config); |
|
0 commit comments