annotationName, annotations.get(annotationName)); serviceBuilder.editMetadata().addToAnnotations(annotations).and().buildMetadata();
.withName(serviceName) .withNamespace(namespace) .addToAnnotations(exposeSpec.getAnnotations()) .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)
@Override public void provideCert(AddressSpace addressSpace, EndpointInfo endpointInfo) { Secret secret = client.secrets().inNamespace(namespace).withName(endpointInfo.getCertSpec().getSecretName()).get(); if (secret == null) { String serviceName = KubeUtil.getAddressSpaceServiceName(endpointInfo.getServiceName(), addressSpace); Service service = client.services().withName(serviceName).get(); if (service != null && (service.getMetadata().getAnnotations() == null || service.getMetadata().getAnnotations().get(AnnotationKeys.OPENSHIFT_SERVING_CERT_SECRET_NAME) == null)) { log.info("Adding service annotation to generate OpenShift cert"); client.services().withName(serviceName).edit() .editMetadata() .addToAnnotations(AnnotationKeys.OPENSHIFT_SERVING_CERT_SECRET_NAME, endpointInfo.getCertSpec().getSecretName()) .endMetadata() .done(); } } } }
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(); }