Skip to content

Commit

Permalink
change serviceResName to domain format
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Apr 9, 2024
1 parent a083d78 commit 98fb0b9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tis-console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ spec:
mountPath: /opt/app/tis-uber/tis-assemble/conf/tis-web-config/
- name: tis-console-pvc
mountPath: "/opt/data"
image: registry.cn-hangzhou.aliyuncs.com/tis/tis-console:4.0.0.12
image: registry.cn-hangzhou.aliyuncs.com/tis/tis-console:4.0.0.15
# command: [ "/bin/sh", "-c", "sleep 1000000" ]
ports:
- name: tis-8080
Expand Down
Original file line number Diff line number Diff line change
@@ -1,58 +1,57 @@
/**
* 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:https://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.
* 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
* <p>
* http:https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.qlangtech.tis.datax.job;

import org.apache.commons.lang.StringUtils;

import java.util.Objects;
import com.qlangtech.tis.plugin.k8s.K8sImage;

/**
* @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);
}

public String getHostEvnName() {
return replaceAndUpperCase(getName()) + HOST_SUFFIX;
}

public String getPortEvnName() {
return replaceAndUpperCase(getName()) + PORT_SUFFIX;
// public String getHostEvnName() {
// return replaceAndUpperCase(getName()) + HOST_SUFFIX;
// }
//
// public String getPortEvnName() {
// return replaceAndUpperCase(getName()) + PORT_SUFFIX;
// }
//
public String getHostPortReplacement(K8sImage image) {
return getName() + "." + image.getNamespace();
// return toVarReplacement(getHostEvnName()) + ":" + toVarReplacement(getPortEvnName());
}

public String getHostPortReplacement() {
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() {
Expand Down

0 comments on commit 98fb0b9

Please sign in to comment.