diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/java/org/acme/serverless/loanbroker/aggregator/QuotesAggregatorRoute.java b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/java/org/acme/serverless/loanbroker/aggregator/QuotesAggregatorRoute.java index c58a40500d..14ca293698 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/java/org/acme/serverless/loanbroker/aggregator/QuotesAggregatorRoute.java +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/java/org/acme/serverless/loanbroker/aggregator/QuotesAggregatorRoute.java @@ -54,7 +54,7 @@ public void configure() { .getTypeConverterRegistry() .addTypeConverter(CloudEvent.class, AggregationResponse.class, cloudEventsConverter); - + from("direct:aggregator") .routeId("quotes-aggregator") .aggregate(header(IntegrationConstants.KOGITO_FLOW_ID_HEADER), new QuotesAggregationStrategy()) diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/resources/application.properties index 4229056fd6..4d4ac24d33 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/aggregator/src/main/resources/application.properties @@ -23,10 +23,13 @@ org.acme.serverless.loanbroker.aggregator.replyTo=${K_SINK:http://localhost:8080 quarkus.swagger-ui.always-include=true mp.openapi.extensions.smallrye.operationIdStrategy=METHOD +quarkus.kubernetes.name=loanbroker-aggregator +quarkus.kubernetes.deployment-target=kubernetes quarkus.kubernetes.deploy=false -quarkus.kubernetes.image-pull-policy=IfNotPresent +quarkus.kubernetes.image-pull-policy=if-not-present # profile to pack this example into a container, to use it execute activate the maven container profile, -Dcontainer -%container.quarkus.container-image.group=dev.local +%container.quarkus.container-image.registry=dev.local +%container.quarkus.container-image.group=${USER} %container.quarkus.container-image.name=loanbroker-aggregator %container.quarkus.container-image.build=true \ No newline at end of file diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/deploy.sh b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/deploy.sh index 5273539ea4..876af41cab 100755 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/deploy.sh +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/deploy.sh @@ -143,7 +143,7 @@ add_flow_url_to_ui() { expose_loanbroker_ui() { echo "Exposing UI, please run 'minikube tunnel -p knative' in a separate terminal" - kubectl expose deployment serverless-workflow-loanbroker-showcase-ui --name=loanbroker-ui-external --type=LoadBalancer --port=8080 -n ${NAMESPACE} + kubectl expose deployment loanbroker-ui --name=loanbroker-ui-external --type=LoadBalancer --port=8080 -n ${NAMESPACE} sleep 5 LOANBROKER_EXTERNAL_IP=$(kubectl get service loanbroker-ui-external -o=jsonpath --template="{.status.loadBalancer.ingress[0].ip}" -n loanbroker-example) echo "To access the loanbroker-example UI please use this url: http://$LOANBROKER_EXTERNAL_IP:8080" diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/kubernetes/kubernetes.yml b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/kubernetes/kubernetes.yml index 9b8f91c371..34fa981ec8 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/kubernetes/kubernetes.yml +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/kubernetes/kubernetes.yml @@ -232,6 +232,12 @@ metadata: namespace: loanbroker-example spec: template: + metadata: + annotations: + autoscaling.knative.dev/minScale: "1" + autoscaling.knative.dev/maxScale: "1" + labels: + app.kubernetes.io/name: event-display spec: containers: - # This corresponds to diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/kubernetes/knative.yml b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/kubernetes/knative.yml deleted file mode 100644 index eb699098c4..0000000000 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/kubernetes/knative.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -apiVersion: serving.knative.dev/v1 -kind: Service -metadata: - name: loanbroker-flow -spec: - template: - spec: - containers: - - name: loanbroker-flow - imagePullPolicy: IfNotPresent diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties index 89219144b3..6f28b4ce8a 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/main/resources/application.properties @@ -17,36 +17,41 @@ # under the License. # -kogito.service.url=${KOGITO_SERVICE_CLUSTER_URL:http://localhost:8080} +kogito.service.url=${knative:services.v1.serving.knative.dev/loanbroker-example/loanbroker-flow} +%dev.kogito.service.url=http://localhost:8080 kogito.messaging.as-cloudevents=true kogito.addon.messaging.outgoing.cloudEventMode.kogito_outgoing_stream=structured -quarkus.http.cors.origins=* +quarkus.http.cors=true +quarkus.http.cors.origins=/.*/ quarkus.log.category."org.kie".level=DEBUG quarkus.log.category."org.kogito".level=DEBUG quarkus.log.category."org.acme".level=DEBUG quarkus.swagger-ui.always-include=true -quarkus.http.cors=true -quarkus.rest-client.credit_bureau_yaml.url=${CREDIT_BUREAU_URL:http://localhost:8181/} -quarkus.rest-client.aggregator_yaml.url=${AGGREGATOR_URL:http://localhost:8282/} + +# Use the Kogito service discovery mechanism to get the services url. +# For more information see: https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/cloud/kubernetes-service-discovery.html +quarkus.rest-client.credit_bureau_yaml.url=${knative:services.v1.serving.knative.dev/loanbroker-example/loanbroker-credit-bureau} +quarkus.rest-client.aggregator_yaml.url=${kubernetes:services.v1/loanbroker-example/loanbroker-aggregator} + +%dev.quarkus.rest-client.credit_bureau_yaml.url=http://localhost:8181 +%dev.quarkus.rest-client.aggregator_yaml.url=http://localhost:8282 mp.messaging.incoming.kogito_incoming_stream.path=/ mp.messaging.incoming.kogito_incoming_stream.connector=quarkus-http -quarkus.kubernetes.deploy=false quarkus.knative.name=loanbroker-flow quarkus.kubernetes.deployment-target=knative -quarkus.knative.image-pull-policy=IfNotPresent -# Use the Kogito service discovery mechanism to get the services url. -# For more information see: https://kiegroup.github.io/kogito-docs/serverlessworkflow/latest/cloud/kubernetes-service-discovery.html -quarkus.knative.env.vars.kogito_service_cluster_url=${knative:services.v1.serving.knative.dev/loanbroker-example/loanbroker-flow} -quarkus.knative.env.vars.credit_bureau_url=${knative:services.v1.serving.knative.dev/loanbroker-example/loanbroker-credit-bureau} -quarkus.knative.env.vars.aggregator_url=${kubernetes:services.v1/loanbroker-example/loanbroker-aggregator} +quarkus.knative.image-pull-policy=if-not-present + +quarkus.knative.min-scale=1 +quarkus.knative.max-scale=1 # Kogito persistence configurations for enabling the serverless workflow persistence -%persistence.quarkus.container-image.group=dev.local +%persistence.quarkus.container-image.registry=dev.local +%persistence.quarkus.container-image.group=${USER} %persistence.quarkus.container-image.name=loanbroker-flow %persistence.quarkus.container-image.build=true diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/test/resources/application.properties b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/test/resources/application.properties index 2cbd4686e6..e8953f6fe6 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/test/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-flow/src/test/resources/application.properties @@ -21,6 +21,6 @@ quarkus.http.test-port=0 # Act as a placeholder to avoid triggering Kubernetes Service Discovery during test runs # The actual URLs are set by the Quarkus Test Runner -quarkus.knative.env.vars.kogito_service_cluster_url=http://localhost:8080 -quarkus.knative.env.vars.credit_bureau_url=http://localhost:8080 -quarkus.knative.env.vars.aggregator_url=http://localhost:8080 +kogito.service.url=http://localhost:${quarkus.http.port} +quarkus.rest-client.credit_bureau_yaml.url=http://localhost:8181 +quarkus.rest-client.aggregator_yaml.url=http://localhost:8282 \ No newline at end of file diff --git a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/application.properties b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/application.properties index 63daa72507..98b287a932 100644 --- a/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/application.properties +++ b/serverless-workflow-examples/serverless-workflow-loanbroker-showcase/loanbroker-ui/src/main/resources/application.properties @@ -17,6 +17,9 @@ # under the License. # +quarkus.http.cors=true +quarkus.http.cors.origins=/.*/ + # on kubernetes, we can configure the workflow endpoint via an env var org.acme.loanbroker.ui.workflowURL=${WORKFLOW_URL:http://localhost:8080} quarkus.qute.content-types."js"=text/javascript @@ -27,11 +30,13 @@ quarkus.qute.suffixes=js,html %dev.quarkus.http.port=8383 # profile to pack this example into a container, to use it execute activate the maven container profile, -Dcontainer -%container.quarkus.container-image.group=dev.local +%container.quarkus.container-image.registry=dev.local +%container.quarkus.container-image.group=${USER} %container.quarkus.container-image.name=loanbroker-ui %container.quarkus.container-image.build=true +quarkus.kubernetes.name=loanbroker-ui quarkus.kubernetes.deploy=false quarkus.kubernetes.deployment-target=kubernetes -quarkus.kubernetes.image-pull-policy=IfNotPresent +quarkus.kubernetes.image-pull-policy=if-not-present quarkus.kubernetes.env.vars.workflow_url=http://loanbroker-flow.loanbroker-example.svc.cluster.local