Search in sources :

Example 1 with V1ServiceSpec

use of io.kubernetes.client.openapi.models.V1ServiceSpec in project heron by twitter.

the class V1Controller method createTopologyService.

/**
 * Creates a headless <code>Service</code> to facilitate communication between Pods in a <code>topology</code>.
 * @return A fully configured <code>Service</code> to be used by a <code>topology</code>.
 */
private V1Service createTopologyService() {
    final String topologyName = getTopologyName();
    final V1Service service = new V1Service();
    // Setup service metadata.
    final V1ObjectMeta objectMeta = new V1ObjectMeta().name(topologyName).annotations(getServiceAnnotations()).labels(getServiceLabels());
    service.setMetadata(objectMeta);
    // Create the headless service.
    final V1ServiceSpec serviceSpec = new V1ServiceSpec().clusterIP("None").selector(getPodMatchLabels(topologyName));
    service.setSpec(serviceSpec);
    return service;
}
Also used : V1ObjectMeta(io.kubernetes.client.openapi.models.V1ObjectMeta) V1ServiceSpec(io.kubernetes.client.openapi.models.V1ServiceSpec) V1Service(io.kubernetes.client.openapi.models.V1Service)

Aggregations

V1ObjectMeta (io.kubernetes.client.openapi.models.V1ObjectMeta)1 V1Service (io.kubernetes.client.openapi.models.V1Service)1 V1ServiceSpec (io.kubernetes.client.openapi.models.V1ServiceSpec)1