serviceBuilder.editOrNewMetadata().addToLabels( labelName, labelValue).and().buildMetadata(); log.info("Add %s label: \"%s\" : \"%s\"", PREFIX,
.withLabels(idMap).withAnnotations(annotations).addToLabels(SPRING_MARKER_KEY, SPRING_MARKER_VALUE) .endMetadata().withSpec(spec.build()).done();
.endSpec() .done()); log("Updated service", client.services().inNamespace("thisisatest").withName("testservice").edit().editMetadata().addToLabels("test", "label").endMetadata().done()); client.replicationControllers().inNamespace("thisisatest").withField("metadata.name", "testservice").delete(); log("Deleted service by field");
.addToAnnotations(AnnotationKeys.ADDRESS_SPACE, addressSpace.getMetadata().getName()) .addToAnnotations(AnnotationKeys.SERVICE_NAME, KubeUtil.getAddressSpaceServiceName(endpointSpec.getService(), addressSpace)) .addToLabels(LabelKeys.INFRA_TYPE, addressSpace.getSpec().getType()) .addToLabels(LabelKeys.INFRA_UUID, infraUuid) .endMetadata() .editOrNewSpec()
.editOrNewMetadata() .withName(options.getRestapiRouteName()) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec()
.withName(serviceModel.getName()) .withNamespace(dataHolder.getNamespace()) .addToLabels(serviceModel.getLabels()) .endMetadata() .withNewSpec()
private void ensureService(String name, DeploymentData deploymentData) { final Map<String, String> labels = prepareServiceLabels(deploymentData); final Map<String, String> annotations = prepareServiceAnnotations(deploymentData); openShiftClient.services().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(annotations) .addToLabels(labels) .endMetadata() .withNewSpec() .addToSelector(INTEGRATION_NAME_LABEL, name) .addNewPort() .withName("http") .withProtocol("TCP") .withPort(INTEGRATION_SERVICE_PORT) .withNewTargetPort(INTEGRATION_SERVICE_PORT) .endPort() .endSpec() .done(); }
private static Service getMessagingClientServiceResource() { return new ServiceBuilder() .withNewMetadata() .withName(SystemtestsOpenshiftApp.MESSAGING_CLIENTS.toString()) .addToLabels("run", SystemtestsOpenshiftApp.MESSAGING_CLIENTS.toString()) .endMetadata() .withNewSpec() .withSelector(Collections.singletonMap("app", SystemtestsOpenshiftApp.MESSAGING_CLIENTS.toString())) .addNewPort() .withName("http") .withPort(4242) .withProtocol("TCP") .endPort() .endSpec() .build(); } }