Search in sources :

Example 1 with KubernetesLoadBalancerDescription

use of com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesLoadBalancerDescription 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>>() {
    });
}
Also used : Names(com.netflix.frigga.Names) ServiceSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings) KubernetesNamedServicePort(com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesNamedServicePort) ArrayList(java.util.ArrayList) KubernetesLoadBalancerDescription(com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesLoadBalancerDescription) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

Names (com.netflix.frigga.Names)1 KubernetesLoadBalancerDescription (com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesLoadBalancerDescription)1 KubernetesNamedServicePort (com.netflix.spinnaker.clouddriver.kubernetes.v1.deploy.description.loadbalancer.KubernetesNamedServicePort)1 ServiceSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ServiceSettings)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1