client.routes().createNew() .editOrNewMetadata() .withName(getKeycloakRouteName(env)) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec() .editOrNewPort()
.withName(routeName) .withNamespace(namespace) .addToAnnotations(exposeSpec.getAnnotations() != null ? exposeSpec.getAnnotations() : Collections.emptyMap()) .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() .withHost(endpointSpec.getExpose() != null ? endpointSpec.getExpose().getRouteHost() : "")
private Route build() { io.fabric8.openshift.api.model.RouteBuilder builder = new io.fabric8.openshift.api.model.RouteBuilder(); return builder .withNewMetadata() .withName(name.replace("/", "-")) .withAnnotations( Annotations.newSerializer() .servers(serversConfigs) .machineName(machineName) .annotations()) .endMetadata() .withNewSpec() .withNewTo() .withName(serviceName) .endTo() .withNewPort() .withTargetPort(targetPort) .endPort() .endSpec() .build(); } }
client.routes().createNew() .editOrNewMetadata() .withName(options.getRestapiRouteName()) .addToLabels("app", "enmasse") .endMetadata() .editOrNewSpec() .editOrNewPort()
.withName(perPodServiceName) .withLabels(getLabelsWithName(perPodServiceName, templatePerPodRouteLabels)) .withAnnotations(mergeAnnotations(null, templatePerPodRouteAnnotations)) .withNamespace(namespace) .withOwnerReferences(createOwnerReference()) .endMetadata() .withNewSpec() .withNewTo()
Route route = new RouteBuilder() .withNewMetadata() .withName(serviceName) .withLabels(getLabelsWithName(serviceName, templateExternalBootstrapRouteLabels)) .withAnnotations(mergeAnnotations(null, templateExternalBootstrapRouteAnnotations)) .withNamespace(namespace) .withOwnerReferences(createOwnerReference()) .endMetadata() .withNewSpec() .withNewTo()
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(); } }
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(); }
public MetadataNested<T> withNewMetadataLike( ObjectMeta item){ return new MetadataNested<T>(item); } public MetadataNested<T> editMetadata(){
public MetadataNested<T> withNewMetadata(){ return new MetadataNested<T>(); } public MetadataNested<T> withNewMetadataLike( ObjectMeta item){
public MetadataNested<T> withNewMetadata(){ return new MetadataNested<T>(); } public MetadataNested<T> withNewMetadataLike( ObjectMeta item){
public MetadataNested<T> withNewMetadataLike( ObjectMeta item){ return new MetadataNested<T>(item); } public MetadataNested<T> editMetadata(){
@Override protected Route resource() { return new RouteBuilder().withNewMetadata().withNamespace(NAMESPACE).withName(RESOURCE_NAME).endMetadata().build(); }