本文整理了Java中io.fabric8.openshift.api.model.Route.getSpec
方法的一些代码示例,展示了Route.getSpec
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Route.getSpec
方法的具体详情如下:
包路径:io.fabric8.openshift.api.model.Route
类名称:Route
方法名:getSpec
暂无
代码示例来源:origin: fabric8io/kubernetes-client
@Override
public String getURL(Service service, String portName, String namespace, KubernetesClient client) {
String serviceName = service.getMetadata().getName();
ServicePort port = URLFromServiceUtil.getServicePortByName(service, portName);
if(port != null && port.getName() != null && isOpenShift(client)) {
try {
String serviceProtocol = port.getProtocol();
OpenShiftClient openShiftClient = client.adapt(OpenShiftClient.class);
Route route = openShiftClient.routes().inNamespace(namespace).withName(service.getMetadata().getName()).get();
if (route != null) {
return (serviceProtocol + "://" + route.getSpec().getHost()).toLowerCase();
}
} catch (KubernetesClientException e) {
if(e.getCode() == HttpURLConnection.HTTP_FORBIDDEN) {
logger.warn("Could not lookup route:" + serviceName + " in namespace:"+ namespace +", due to: " + e.getMessage());
}
}
}
return null;
}
代码示例来源:origin: io.fabric8.pipeline/kubernetes-pipeline-devops-steps
private String serviceNameFromRoute(Route route) {
if(route.getSpec() != null && route.getSpec().getTo() != null && route.getSpec().getTo().getKind().equals("Service")) {
return route.getSpec().getTo().getName();
} else {
return null;
}
}
代码示例来源:origin: jenkinsci/kubernetes-pipeline-plugin
private String serviceNameFromRoute(Route route) {
if(route.getSpec() != null && route.getSpec().getTo() != null && route.getSpec().getTo().getKind().equals("Service")) {
return route.getSpec().getTo().getName();
} else {
return null;
}
}
代码示例来源:origin: EnMasseProject/enmasse
private static String getKeycloakAuthUrl(NamespacedOpenShiftClient client, Map<String, String> env) {
Route keycloakRoute = client.routes().withName("keycloak").get();
String keycloakOauthUrl = null;
if (keycloakRoute != null && !keycloakRoute.getSpec().getHost().contains("127.0.0.1")) {
keycloakOauthUrl = String.format("https://%s/auth", keycloakRoute.getSpec().getHost());
} else {
keycloakOauthUrl = getEnv(env, "STANDARD_AUTHSERVICE_SERVICE_HOST").map(ip -> "https://" + ip + ":8443/auth").orElse(null);
}
return keycloakOauthUrl;
}
代码示例来源:origin: io.syndesis.server/server-openshift
@Override
public Optional<String> getExposedHost(String name) {
Route route = openShiftClient.routes().withName(openshiftName(name)).get();
return Optional.ofNullable(route)
.flatMap(r -> Optional.ofNullable(r.getSpec()))
.map(RouteSpec::getHost);
}
代码示例来源:origin: org.eclipse.che.infrastructure/infrastructure-openshift
private void enableTls(final Route route) {
RouteSpec spec = route.getSpec();
spec.setTls(getTLSConfig());
}
代码示例来源:origin: jenkinsci/kubernetes-pipeline-plugin
private Route updateRoute(Route route, Service service) {
route.getSpec().getTo().setName(service.getMetadata().getName());
return route;
}
代码示例来源:origin: io.fabric8.pipeline/kubernetes-pipeline-devops-steps
private Route updateRoute(Route route, Service service) {
route.getSpec().getTo().setName(service.getMetadata().getName());
return route;
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-ala-openshift-provider
public static void setRoutes(RouteList routeList, String routerHost) {
InetAddress routerAddr;
try {
routerAddr = routerHost == null ? null : InetAddress.getByName(routerHost);
} catch (UnknownHostException e) {
throw new IllegalArgumentException("Invalid IP for router host", e);
}
if (routeList != null) {
synchronized (ROUTING) {
for (Route route : routeList.getItems()) {
String host = route.getSpec().getHost();
if (routerAddr != null) {
System.out.println(String.format("Adding route (router -> host): %s -> %s", routerHost, host));
ROUTING.put(host, routerAddr);
} else {
ROUTING.remove(host);
}
}
}
}
}
代码示例来源:origin: EnMasseProject/enmasse
public Endpoint getKeycloakEndpoint() {
OpenShiftClient openShift = client.adapt(OpenShiftClient.class);
Route route = openShift.routes().inNamespace(globalNamespace).withName("keycloak").get();
Endpoint endpoint = new Endpoint(route.getSpec().getHost(), 443);
log.info("Testing endpoint : " + endpoint);
if (TestUtils.resolvable(endpoint)) {
return endpoint;
} else {
log.info("Endpoint didn't resolve, falling back to service endpoint");
return getEndpoint("standard-authservice", "https");
}
}
代码示例来源:origin: org.eclipse.che.infrastructure/infrastructure-openshift
private void fillRouteServers(Route route, Map<String, ServerImpl> servers) {
Annotations.newDeserializer(route.getMetadata().getAnnotations())
.servers()
.forEach(
(name, config) ->
servers.put(
name,
newServer(
config.getProtocol(),
route.getSpec().getHost(),
null,
config.getPath(),
config.getAttributes())));
}
}
代码示例来源:origin: fabric8io/fabric8-maven-plugin
public void applyRoute(Route entity, String sourceName) {
OpenShiftClient openShiftClient = getOpenShiftClient();
if (openShiftClient != null) {
String id = getName(entity);
Objects.requireNonNull(id, "No name for " + entity + " " + sourceName);
String namespace = KubernetesHelper.getNamespace(entity);
if (StringUtils.isBlank(namespace)) {
namespace = getNamespace();
}
Route route = openShiftClient.routes().inNamespace(namespace).withName(id).get();
if (route == null) {
try {
log.info("Creating Route " + namespace + ":" + id + " " +
(entity.getSpec() != null ?
"host: " + entity.getSpec().getHost() :
"No Spec !"));
openShiftClient.routes().inNamespace(namespace).create(entity);
} catch (Exception e) {
onApplyError("Failed to create Route from " + sourceName + ". " + e + ". " + entity, e);
}
}
}
}
代码示例来源:origin: org.domeos/kubernetes-model
public RouteBuilder(Route instance,Boolean validationEnabled){
this.fluent = this;
this.withApiVersion(instance.getApiVersion());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withSpec(instance.getSpec());
this.withStatus(instance.getStatus());
this.validationEnabled = validationEnabled;
}
代码示例来源:origin: org.domeos/kubernetes-model
public RouteFluentImpl(Route instance){
this.withApiVersion(instance.getApiVersion());
this.withKind(instance.getKind());
this.withMetadata(instance.getMetadata());
this.withSpec(instance.getSpec());
this.withStatus(instance.getStatus());
}
代码示例来源:origin: org.apache.stratos/kubernetes-model
public RouteBuilder( RouteFluent<?> fluent , Route instance ){
this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus());
}
public RouteBuilder( Route instance ){
代码示例来源:origin: org.domeos/kubernetes-model
public RouteBuilder(RouteFluent<?> fluent,Route instance,Boolean validationEnabled){
this.fluent = fluent;
fluent.withApiVersion(instance.getApiVersion());
fluent.withKind(instance.getKind());
fluent.withMetadata(instance.getMetadata());
fluent.withSpec(instance.getSpec());
fluent.withStatus(instance.getStatus());
this.validationEnabled = validationEnabled;
}
public RouteBuilder(Route instance){
代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model
public RouteBuilder( RouteFluent<?> fluent , Route instance ){
this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withMetadata(instance.getMetadata()); fluent.withSpec(instance.getSpec()); fluent.withStatus(instance.getStatus());
}
public RouteBuilder( Route instance ){
代码示例来源:origin: io.fabric8.schemagenerator/kubernetes-model
public RouteBuilder( Route instance ){
this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus());
}
代码示例来源:origin: org.apache.stratos/kubernetes-model
public RouteBuilder( Route instance ){
this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withMetadata(instance.getMetadata()); this.withSpec(instance.getSpec()); this.withStatus(instance.getStatus());
}
代码示例来源:origin: io.fabric8/openshift-client
@Override
public String getURL(Service service, String portName, String namespace, KubernetesClient client) {
String serviceName = service.getMetadata().getName();
ServicePort port = URLFromServiceUtil.getServicePortByName(service, portName);
if(port != null && port.getName() != null && isOpenShift(client)) {
try {
String serviceProtocol = port.getProtocol();
OpenShiftClient openShiftClient = client.adapt(OpenShiftClient.class);
Route route = openShiftClient.routes().inNamespace(namespace).withName(service.getMetadata().getName()).get();
if (route != null) {
return (serviceProtocol + "://" + route.getSpec().getHost()).toLowerCase();
}
} catch (KubernetesClientException e) {
if(e.getCode() == HttpURLConnection.HTTP_FORBIDDEN) {
logger.warn("Could not lookup route:" + serviceName + " in namespace:"+ namespace +", due to: " + e.getMessage());
}
}
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!