Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kie-kogito-examples-1922: Serverless Workflow Operator DataIndex Use cases updates #1923

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ Collection of artifacts to test SonataFlow Use Cases TP2.
1. Minikube installed

We recommend that you start Minikube with the following parameters, note that the `registry` addon must be enabled.
Additionally, the ingress addon is also enabled facilitate data-index querying by using an Ingress. Note that the Ingress provided is just en example to expose the data-index graphiql.
This is not mandatory, and in production environments you must provide your own setup if needed, or even use an OpenShift route, etc.

```shell
minikube start --cpus 4 --memory 10240 --addons registry --addons metrics-server --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000"
minikube start --cpus 4 --memory 10240 --addons registry --addons metrics-server --addons ingress --insecure-registry "10.0.0.0/24" --insecure-registry "localhost:5000"
```

To verify that the registry addon was property added you can execute this command:
Expand All @@ -24,6 +26,15 @@ minikube addons list | grep registry
| registry-creds | minikube | disabled | 3rd party (UPMC Enterprises) |
```

To verify that the ingress addon was property added you can execute this command:

```shell
minikube addons list | grep ingress
```

```
| ingress | minikube | enabled ✅ | Kubernetes |
```

2. kubectl installed

Expand Down Expand Up @@ -62,17 +73,16 @@ kubectl create namespace data-index-usecase
2. Deploy the Data Index Service:

```shell
kubectl kustomize infra/dataindex | kubectl apply -f - -n data-index-usecase
kubectl kustomize platforms/data_index_as_platform_service | kubectl apply -f - -n data-index-usecase
```

```
configmap/dataindex-properties-hg9ff8bff5 created
secret/postgres-secrets-22tkgc2dt7 created
service/data-index-service-postgresql created
service/postgres created
persistentvolumeclaim/postgres-pvc created
deployment.apps/data-index-service-postgresql created
deployment.apps/postgres created
service/postgres created
sonataflowplatform.sonataflow.org/sonataflow-platform created
ingress.networking.k8s.io/data-index-service-ingress created
secret/postgres-secrets created
```

This will deploy a Data Index for you in the `data-index-usecase` namespace. (If you don't use a namespace the `default` is used instead)
Expand All @@ -93,14 +103,15 @@ postgres-7f78499688-j6282 1/1 Running 0
To access the Data Index, using Minikube you can run:

```shell
minikube service data-index-service-postgresql --url -n data-index-usecase
minikube ip
```

Example output:
```
http://192.168.49.2:30352
192.168.49.2
```
The output is the Data Index URL, so you can access the GraphiQL UI by using a url like this http://192.168.49.2:30352/grpahiql/ (host and por might be different in your installation.)

Use the returned ip to access the data-index-service GraphiQL by using the Ingress with a url like this http://192.168.49.2/graphiql/ (that ip might be different in your installation.)

For more information about Data Index and this deployment see [Data Index standalone service](https://sonataflow.org/serverlessworkflow/latest/data-index/data-index-service.html) in SonataFlow guides.

Expand Down Expand Up @@ -130,19 +141,18 @@ kubectl create namespace usecase1
```

2. Deploy the Data Index Service:

```shell
kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase1
kubectl kustomize platforms/data_index_as_platform_service | kubectl apply -f - -n usecase1
```

```
configmap/dataindex-properties-hg9ff8bff5 created
secret/postgres-secrets-22tkgc2dt7 created
service/data-index-service-postgresql created
service/postgres created
persistentvolumeclaim/postgres-pvc created
deployment.apps/data-index-service-postgresql created
deployment.apps/postgres created

service/postgres created
sonataflowplatform.sonataflow.org/sonataflow-platform created
ingress.networking.k8s.io/data-index-service-ingress created
secret/postgres-secrets created
```

Give some time for the data index to start, you can check that it's running by executing.
Expand All @@ -164,7 +174,6 @@ postgres-7f78499688-lc8n6 1/1 Running 0
```

```
configmap/greeting-props created
sonataflow.sonataflow.org/greeting created
```

Expand Down Expand Up @@ -227,19 +236,18 @@ kubectl create namespace usecase2
```

2. Deploy the Data Index Service:
3.
```shell
kubectl kustomize infra/dataindex | kubectl apply -f - -n usecase2
kubectl kustomize platforms/data_index_as_platform_service | kubectl apply -f - -n usecase2
```

```
configmap/dataindex-properties-hg9ff8bff5 created
secret/postgres-secrets-22tkgc2dt7 created
service/data-index-service-postgresql created
service/postgres created
persistentvolumeclaim/postgres-pvc created
deployment.apps/data-index-service-postgresql created
deployment.apps/postgres created

service/postgres created
sonataflowplatform.sonataflow.org/sonataflow-platform created
ingress.networking.k8s.io/data-index-service-ingress created
secret/postgres-secrets created
```

Give some time for the data index to start, you can check that it's running by executing.
Expand All @@ -261,8 +269,6 @@ postgres-7f78499688-lc8n6 1/1 Running 0
```

```
configmap/greeting-props created
configmap/helloworld-props created
sonataflow.sonataflow.org/greeting created
sonataflow.sonataflow.org/helloworld created
```
Expand Down Expand Up @@ -325,12 +331,12 @@ This procedure apply to all use cases with that deploys the Data Index Service.
1. Get the Data Index Url:

```shell
minikube service data-index-service-postgresql --url -n my_usecase
minikube ip
```

2. Open the GrahiqlUI

Using the url returned in 1, open a browser window in the following url http://192.168.49.2:32409/graphiql/, note that IP and port will be different in your installation, and don't forget to add the last slash "/" to the url, otherwise the GraphiqlUI won't be opened.
Using the ip returned in 1, open a browser window in the following url http://192.168.49.2/graphiql/, note that IP will be different in your installation, and don't forget to add the last slash "/" to the url, otherwise the GraphiqlUI won't be opened.


To see the process instances information you can execute this query:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
name: sonataflow-platform
spec:
build:
config:
strategyOptions:
KanikoBuildCacheEnabled: "false"
services:
dataIndex:
enabled: true
persistence:
postgresql:
jdbcUrl: jdbc:postgresql://postgres:5432/sonataflow?currentSchema=data-index-service
secretRef:
name: postgres-secrets
userKey: POSTGRES_USER
passwordKey: POSTGRES_PASSWORD
podTemplate:
initContainers:
- name: init-postgres
image: registry.access.redhat.com/ubi9/ubi-minimal:latest
imagePullPolicy: IfNotPresent
command: [ 'sh', '-c', 'until (echo 1 > /dev/tcp/postgres.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local/5432) >/dev/null 2>&1; do echo "Waiting for postgres server"; sleep 3; done;' ]

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: data-index-service-ingress
annotations:
nginx.ingress.kubernetes.io/app-root: /
spec:
rules:
- http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: sonataflow-platform-data-index-service
port:
number: 80
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
resources:
- 01-postgres.yaml
- 02-dataindex.yaml
- 02-sonataflow_platform.yaml
- 03-data-index-service-ingress.yaml

generatorOptions:
disableNameSuffixHash: true

secretGenerator:
- name: postgres-secrets
Expand All @@ -10,8 +14,5 @@ secretGenerator:
- POSTGRES_DB=sonataflow
- PGDATA=/var/lib/postgresql/data/mydata

configMapGenerator:
- name: dataindex-properties
files:
- application.properties

sortOptions:
order: fifo
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
resources:
- ../../infra/service_discovery
- ../../workflows/sonataflow-greeting
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
resources:
- ../../infra/service_discovery
- ../../workflows/sonataflow-greeting
- ../../workflows/sonataflow-helloworld
Loading
Loading