class Fabric8FlinkKubeClient implements FlinkKubeClient {

	@Override
	public Optional<Endpoint> getRestEndpoint(String clusterId) {
		Optional<KubernetesService> restService = getRestService(clusterId);
		if (!restService.isPresent()) {
			return Optional.empty();
		}
		final Service service = restService.get().getInternalResource();
		final int restPort = getRestPortFromExternalService(service);

		final KubernetesConfigOptions.ServiceExposedType serviceExposedType =
			KubernetesConfigOptions.ServiceExposedType.valueOf(service.getSpec().getType());

		// Return the external service.namespace directly when using ClusterIP.
		if (serviceExposedType == KubernetesConfigOptions.ServiceExposedType.ClusterIP) {
			return Optional.of(
				new Endpoint(ExternalServiceDecorator.getNamespacedExternalServiceName(clusterId, namespace), restPort));
		}

		return getRestEndPointFromService(service, restPort);
	}

	public  Fabric8FlinkKubeClient(
			Configuration flinkConfig,
			KubernetesClient client,
			Supplier<ExecutorService> asyncExecutorFactory);

}