use of com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesNamedServicePort in project halyard by spinnaker.
the class KubernetesV1DistributedService method getLoadBalancerDescription.
default Map<String, Object> getLoadBalancerDescription(AccountDeploymentDetails<KubernetesAccount> details, SpinnakerRuntimeSettings runtimeSettings) {
ServiceSettings settings = runtimeSettings.getServiceSettings(getService());
int port = settings.getPort();
String accountName = details.getAccount().getName();
KubernetesLoadBalancerDescription description = new KubernetesLoadBalancerDescription();
String namespace = getNamespace(settings);
String name = getServiceName();
Names parsedName = Names.parseName(name);
description.setApp(parsedName.getApp());
description.setStack(parsedName.getStack());
description.setDetail(parsedName.getDetail());
description.setName(name);
description.setNamespace(namespace);
description.setAccount(accountName);
KubernetesNamedServicePort servicePort = new KubernetesNamedServicePort();
servicePort.setPort(port);
servicePort.setTargetPort(port);
servicePort.setName("http");
servicePort.setProtocol("TCP");
KubernetesNamedServicePort monitoringPort = new KubernetesNamedServicePort();
monitoringPort.setPort(8008);
monitoringPort.setTargetPort(8008);
monitoringPort.setName("monitoring");
monitoringPort.setProtocol("TCP");
List<KubernetesNamedServicePort> servicePorts = new ArrayList<>();
servicePorts.add(servicePort);
servicePorts.add(monitoringPort);
description.setPorts(servicePorts);
return getObjectMapper().convertValue(description, new TypeReference<Map<String, Object>>() {
});
}
Aggregations