.withNewMetadata() .withName(serviceName) .withNamespace(namespace) .withLabels(serviceLabels) .endMetadata()
.withNewMetadata() .withName(serviceName) .withNamespace(namespace) .withLabels(serviceLabels) .endMetadata()
.editOrNewMetadata() .withName(serviceName) .withNamespace(namespace) .addToAnnotations(exposeSpec.getAnnotations()) .addToAnnotations(AnnotationKeys.ADDRESS_SPACE, addressSpace.getMetadata().getName())
.withNamespace(NAMESPACE) .withName(RESOURCE_NAME) .endMetadata() .withNamespace(NAMESPACE) .withName(RESOURCE_NAME) .endMetadata()
.withNewMetadata() .withName(serviceModel.getName()) .withNamespace(dataHolder.getNamespace()) .addToLabels(serviceModel.getLabels()) .endMetadata()
protected Service createHeadlessService(List<ServicePort> ports, Map<String, String> annotations) { Service service = new ServiceBuilder() .withNewMetadata() .withName(headlessServiceName) .withLabels(getLabelsWithName(headlessServiceName, templateHeadlessServiceLabels)) .withNamespace(namespace) .withAnnotations(mergeAnnotations(annotations, templateHeadlessServiceAnnotations)) .withOwnerReferences(createOwnerReference()) .endMetadata() .withNewSpec() .withType("ClusterIP") .withClusterIP("None") .withSelector(getSelectorLabels()) .withPorts(ports) .endSpec() .build(); log.trace("Created headless service {}", service); return service; }
protected Service createService(String name, String type, List<ServicePort> ports, Map<String, String> labels, Map<String, String> selector, Map<String, String> annotations) { Service service = new ServiceBuilder() .withNewMetadata() .withName(name) .withLabels(labels) .withNamespace(namespace) .withAnnotations(annotations) .withOwnerReferences(createOwnerReference()) .endMetadata() .withNewSpec() .withType(type) .withSelector(selector) .withPorts(ports) .endSpec() .build(); log.trace("Created service {}", service); return service; }
@Override protected Service resource() { return new ServiceBuilder().withNewMetadata().withNamespace(NAMESPACE).withName(RESOURCE_NAME).endMetadata().build(); }
@Before public void setup() { pod = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test").and().build(); service = new ServiceBuilder() .withNewMetadata().withName("service1").withNamespace("test").and() .build(); final ReplicationController rc = new ReplicationControllerBuilder() .withNewMetadata().withName("repl1").withNamespace("test").endMetadata() .withNewSpec().withReplicas(1).endSpec() .build(); kubeList = new KubernetesListBuilder().withItems(pod, service, rc).build(); }