.editOrNewMetadata() .withName(getKeycloakRouteName(env)) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec()
private static void ensureRouteExists(NamespacedOpenShiftClient client, ServiceBrokerOptions serviceBrokerOptions) throws IOException { Route proxyRoute = client.routes().withName(serviceBrokerOptions.getConsoleProxyRouteName()).get(); if (proxyRoute == null) { String caCertificate = new String(Files.readAllBytes(new File(serviceBrokerOptions.getCertDir(), "tls.crt").toPath()), StandardCharsets.UTF_8); client.routes().createNew() .editOrNewMetadata() .withName(serviceBrokerOptions.getConsoleProxyRouteName()) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec() .editOrNewPort() .withNewTargetPort("https") .endPort() .editOrNewTo() .withKind("Service") .withName("service-broker") .endTo() .editOrNewTls() .withTermination("reencrypt") .withCaCertificate(caCertificate) .endTls() .endSpec() .done(); } }
.editOrNewMetadata() .withName(options.getRestapiRouteName()) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec()
.addToAnnotations(AnnotationKeys.ADDRESS_SPACE, addressSpace.getMetadata().getName()) .addToAnnotations(AnnotationKeys.SERVICE_NAME, serviceName) .addToLabels(LabelKeys.INFRA_TYPE, addressSpace.getSpec().getType()) .addToLabels(LabelKeys.INFRA_UUID, infraUuid) .endMetadata() .editOrNewSpec()
private void ensureRoute(String name, DeploymentData deploymentData) { openShiftClient.routes().withName(name).createOrReplaceWithNew() .withNewMetadata() .withName(name) .addToAnnotations(deploymentData.getAnnotations()) .addToLabels(deploymentData.getLabels()) .endMetadata() .withNewSpec() .withNewTo() .withKind("Service") .withName(name) .endTo() .withNewTls() .withTermination("edge") .endTls() .endSpec() .done(); }