use of org.apache.flink.kubernetes.kubeclient.resources.KubernetesService in project flink by apache.
the class Fabric8FlinkKubeClient method getService.
@Override
public Optional<KubernetesService> getService(KubernetesService.ServiceType serviceType, String clusterId) {
final String serviceName = getServiceName(serviceType, clusterId);
final Service service = this.internalClient.services().withName(serviceName).fromServer().get();
if (service == null) {
LOG.debug("Service {} does not exist", serviceName);
return Optional.empty();
}
return Optional.of(new KubernetesService(service));
}
use of org.apache.flink.kubernetes.kubeclient.resources.KubernetesService in project flink by apache.
the class Fabric8FlinkKubeClient method getRestEndpoint.
@Override
public Optional<Endpoint> getRestEndpoint(String clusterId) {
Optional<KubernetesService> restService = getService(KubernetesService.ServiceType.REST_SERVICE, clusterId);
if (!restService.isPresent()) {
return Optional.empty();
}
final Service service = restService.get().getInternalResource();
final int restPort = getRestPortFromExternalService(service);
final KubernetesConfigOptions.ServiceExposedType serviceExposedType = ServiceType.classify(service);
// Return the external service.namespace directly when using ClusterIP.
if (serviceExposedType.isClusterIP()) {
return Optional.of(new Endpoint(ExternalServiceDecorator.getNamespacedExternalServiceName(clusterId, namespace), restPort));
}
return getRestEndPointFromService(service, restPort);
}
Aggregations