-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98fb0b9
commit 9dc51aa
Showing
1 changed file
with
17 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,17 @@ | |
package com.qlangtech.tis.datax.job; | ||
|
||
import com.qlangtech.tis.plugin.k8s.K8sImage; | ||
import org.apache.commons.lang.StringUtils; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* @author: 百岁([email protected]) | ||
* @create: 2024-03-11 13:33 | ||
**/ | ||
public class ServiceResName<T> extends SubJobResName<T> { | ||
// private static final String HOST_SUFFIX = "_SERVICE_HOST"; | ||
// private static final String PORT_SUFFIX = "_SERVICE_PORT"; | ||
// private static final String HOST_SUFFIX = "_SERVICE_HOST"; | ||
private static final String PORT_SUFFIX = "_SERVICE_PORT"; | ||
|
||
public ServiceResName(String name, SubJobExec<T> subJobExec) { | ||
super(name, subJobExec); | ||
|
@@ -36,22 +39,23 @@ public ServiceResName(String name, SubJobExec<T> subJobExec) { | |
// return replaceAndUpperCase(getName()) + HOST_SUFFIX; | ||
// } | ||
// | ||
// public String getPortEvnName() { | ||
// return replaceAndUpperCase(getName()) + PORT_SUFFIX; | ||
// } | ||
// | ||
public String getPortEvnName() { | ||
return replaceAndUpperCase(getName()) + PORT_SUFFIX; | ||
} | ||
|
||
// | ||
public String getHostPortReplacement(K8sImage image) { | ||
return getName() + "." + image.getNamespace(); | ||
return getName() + "." + image.getNamespace() + ":" + toVarReplacement(getPortEvnName()); | ||
// return toVarReplacement(getHostEvnName()) + ":" + toVarReplacement(getPortEvnName()); | ||
} | ||
|
||
// private String toVarReplacement(String val) { | ||
// return "$(" + Objects.requireNonNull(val, "val can not be null") + ")"; | ||
// } | ||
private String toVarReplacement(String val) { | ||
return "$(" + Objects.requireNonNull(val, "val can not be null") + ")"; | ||
} | ||
|
||
// private String replaceAndUpperCase(String val) { | ||
// return StringUtils.upperCase(StringUtils.replace(val, "-", "_")); | ||
// } | ||
private String replaceAndUpperCase(String val) { | ||
return StringUtils.upperCase(StringUtils.replace(val, "-", "_")); | ||
} | ||
|
||
@Override | ||
protected String getResourceType() { | ||
|