-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][scaleph-ui-react] add flink kubernetes job deploy form (#578)
* feature: update flink kubernetes job instance service * feature: add flink service handler * fix: seatunnel example * feature: add flink kubernetes job detail model * feature: add flink kubernetes job detail model * feature: add flink kubernetes job deploy form * feature: add flink kubernetes job deploy form * feature: add flink kubernetes job deploy form
- Loading branch information
Showing
22 changed files
with
570 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
scaleph-common/src/main/java/cn/sliew/scaleph/common/dict/flink/kubernetes/UpgradeMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cn.sliew.scaleph.common.dict.flink.kubernetes; | ||
|
||
import cn.sliew.scaleph.common.dict.DictInstance; | ||
import com.baomidou.mybatisplus.annotation.EnumValue; | ||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
|
||
import java.util.Arrays; | ||
|
||
@JsonFormat(shape = JsonFormat.Shape.OBJECT) | ||
public enum UpgradeMode implements DictInstance { | ||
|
||
STATELESS("stateless", "stateless"), | ||
LAST_STATE("last-state", "last-state"), | ||
SAVEPOINT("savepoint", "savepoint"), | ||
; | ||
|
||
@JsonCreator | ||
public static UpgradeMode of(String value) { | ||
return Arrays.stream(values()) | ||
.filter(instance -> instance.getValue().equals(value)) | ||
.findAny().orElseThrow(() -> new EnumConstantNotPresentException(UpgradeMode.class, value)); | ||
} | ||
|
||
@EnumValue | ||
private String value; | ||
private String label; | ||
|
||
UpgradeMode(String value, String label) { | ||
this.value = value; | ||
this.label = label; | ||
} | ||
|
||
@Override | ||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String getLabel() { | ||
return label; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ava/cn/sliew/scaleph/engine/flink/kubernetes/resource/handler/FlinkJobServiceHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cn.sliew.scaleph.engine.flink.kubernetes.resource.handler; | ||
|
||
import cn.sliew.scaleph.engine.flink.kubernetes.operator.spec.FlinkDeploymentSpec; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Component | ||
public class FlinkJobServiceHandler { | ||
|
||
public void handle(FlinkDeploymentSpec spec) { | ||
Map<String, String> flinkConfiguration = Optional.of(spec.getFlinkConfiguration()).orElse(new HashMap()); | ||
Map<String, String> nodePortService = FlinkServiceUtil.addNodePortService(); | ||
flinkConfiguration.putAll(nodePortService); | ||
spec.setFlinkConfiguration(flinkConfiguration); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...main/java/cn/sliew/scaleph/engine/flink/kubernetes/resource/handler/FlinkServiceUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cn.sliew.scaleph.engine.flink.kubernetes.resource.handler; | ||
|
||
import cn.sliew.scaleph.common.dict.flink.NodePortAddressType; | ||
import cn.sliew.scaleph.common.dict.flink.ServiceExposedType; | ||
import cn.sliew.scaleph.engine.flink.kubernetes.operator.spec.IngressSpec; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public enum FlinkServiceUtil { | ||
; | ||
|
||
static Map<String, String> addNodePortService() { | ||
Map<String, String> flinkConfiguration = new HashMap<>(); | ||
flinkConfiguration.put("kubernetes.rest-service.exposed.type", ServiceExposedType.NODE_PORT.getValue()); | ||
flinkConfiguration.put("kubernetes.rest-service.exposed.node-port-address-type", NodePortAddressType.EXTERNAL_IP.getValue()); | ||
return flinkConfiguration; | ||
} | ||
|
||
static Map<String, String> addLoadBalancerService() { | ||
Map<String, String> flinkConfiguration = new HashMap<>(); | ||
flinkConfiguration.put("kubernetes.rest-service.exposed.type", ServiceExposedType.LOAD_BALANCER.getValue()); | ||
return flinkConfiguration; | ||
} | ||
|
||
static IngressSpec createIngressSpec() { | ||
IngressSpec spec = new IngressSpec(); | ||
spec.setTemplate("/{{namespace}}/{{name}}(/|$)(.*)"); | ||
spec.setClassName("nginx"); | ||
Map<String, String> annotations = new HashMap<>(); | ||
annotations.put("nginx.ingress.kubernetes.io/rewrite-target", "/$2"); | ||
spec.setAnnotations(annotations); | ||
return spec; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
.../scaleph/engine/flink/kubernetes/resource/handler/FlinkSessioinClusterServiceHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package cn.sliew.scaleph.engine.flink.kubernetes.resource.handler; | ||
|
||
import cn.sliew.scaleph.engine.flink.kubernetes.operator.spec.FlinkDeploymentSpec; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Component | ||
public class FlinkSessioinClusterServiceHandler { | ||
|
||
public void handle(FlinkDeploymentSpec spec) { | ||
Map<String, String> flinkConfiguration = Optional.of(spec.getFlinkConfiguration()).orElse(new HashMap()); | ||
Map<String, String> loadBalancerService = FlinkServiceUtil.addLoadBalancerService(); | ||
flinkConfiguration.putAll(loadBalancerService); | ||
spec.setFlinkConfiguration(flinkConfiguration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.