mirror of
https://github.com/apache/incubator-kie-kogito-examples.git
synced 2025-08-06 15:20:20 +08:00
kie-kogito-examples-1922: Serverless Workflow Operator DataIndex Use cases updates (#1923)
This commit is contained in:
@ -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:
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
@ -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.
|
||||
|
||||
@ -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.
|
||||
@ -164,7 +174,6 @@ postgres-7f78499688-lc8n6 1/1 Running 0
|
||||
```
|
||||
|
||||
```
|
||||
configmap/greeting-props created
|
||||
sonataflow.sonataflow.org/greeting created
|
||||
```
|
||||
|
||||
@ -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.
|
||||
@ -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
|
||||
```
|
||||
@ -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:
|
||||
|
@ -1,92 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: data-index-service-postgresql
|
||||
name: data-index-service-postgresql
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: data-index-service-postgresql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: data-index-service-postgresql
|
||||
spec:
|
||||
containers:
|
||||
- name: data-index-service-postgresql
|
||||
image: quay.io/kiegroup/kogito-data-index-postgresql:latest
|
||||
imagePullPolicy: Always
|
||||
resources:
|
||||
limits:
|
||||
memory: "256Mi"
|
||||
cpu: "500m"
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: http
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: KOGITO_DATA_INDEX_QUARKUS_PROFILE
|
||||
value: http-events-support
|
||||
- name: KUBERNETES_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: QUARKUS_DATASOURCE_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: POSTGRES_USER
|
||||
name: postgres-secrets
|
||||
- name: QUARKUS_DATASOURCE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: POSTGRES_PASSWORD
|
||||
name: postgres-secrets
|
||||
volumeMounts:
|
||||
- name: application-config
|
||||
mountPath: "/home/kogito/config"
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /q/health/live
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 10
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /q/health/ready
|
||||
port: 8080
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 0
|
||||
periodSeconds: 30
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 10
|
||||
volumes:
|
||||
- name: application-config
|
||||
configMap:
|
||||
name: dataindex-properties
|
||||
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;']
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: data-index-service-postgresql
|
||||
name: data-index-service-postgresql
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 8080
|
||||
selector:
|
||||
app.kubernetes.io/name: data-index-service-postgresql
|
||||
type: NodePort
|
@ -1,10 +0,0 @@
|
||||
quarkus.http.port=8080
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.origins=/.*/
|
||||
|
||||
quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=data-index-service
|
||||
quarkus.hibernate-orm.database.generation=update
|
||||
quarkus.flyway.migrate-at-start=true
|
||||
|
||||
# Disable kafka client health check since the quarkus-http connector is being used instead.
|
||||
quarkus.smallrye-health.check."io.quarkus.kafka.client.health.KafkaHealthCheck".enabled=false
|
@ -1,36 +0,0 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: service-discovery-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
- statefulsets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- apiGroups:
|
||||
- networking.k8s.io
|
||||
resources:
|
||||
- ingresses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
# Knative
|
||||
- apiGroups:
|
||||
- serving.knative.dev
|
||||
resources:
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
@ -1,11 +0,0 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: service-discovery-rolebinding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: service-discovery-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: default
|
@ -1,3 +0,0 @@
|
||||
resources:
|
||||
- 01-service-discovery-role.yaml
|
||||
- 02-service-discovery-rolebinding.yaml
|
@ -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;' ]
|
||||
|
@ -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
|
@ -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
|
||||
@ -10,8 +14,5 @@ secretGenerator:
|
||||
- POSTGRES_DB=sonataflow
|
||||
- PGDATA=/var/lib/postgresql/data/mydata
|
||||
|
||||
configMapGenerator:
|
||||
- name: dataindex-properties
|
||||
files:
|
||||
- application.properties
|
||||
|
||||
sortOptions:
|
||||
order: fifo
|
@ -1,3 +1,2 @@
|
||||
resources:
|
||||
- ../../infra/service_discovery
|
||||
- ../../workflows/sonataflow-greeting
|
@ -1,4 +1,3 @@
|
||||
resources:
|
||||
- ../../infra/service_discovery
|
||||
- ../../workflows/sonataflow-greeting
|
||||
- ../../workflows/sonataflow-helloworld
|
||||
|
@ -1,23 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
application.properties: |
|
||||
# Data Index configuration
|
||||
mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
|
||||
|
||||
mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
|
||||
|
||||
mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
|
||||
|
||||
# Skip user tasks and variables events sending.
|
||||
kogito.events.usertasks.enabled=false
|
||||
kogito.events.variables.enabled=false
|
||||
|
||||
quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
|
||||
quarkus.log.category."org.kie".level = DEBUG
|
||||
quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
|
||||
quarkus.log.category."io.vertx".level = DEBUG
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
app: greeting
|
||||
name: greeting-props
|
@ -1,3 +1,2 @@
|
||||
resources:
|
||||
- 02-configmap_greeting-props.yaml
|
||||
- 03-sonataflow_greeting.yaml
|
||||
- 01-sonataflow_greeting.yaml
|
||||
|
@ -1,23 +0,0 @@
|
||||
apiVersion: v1
|
||||
data:
|
||||
application.properties: |
|
||||
# Data Index configuration
|
||||
mp.messaging.outgoing.kogito-processinstances-events.url=http://data-index-service-postgresql/processes
|
||||
|
||||
mp.messaging.outgoing.kogito-usertaskinstances-events.url=http://data-index-service-postgresql/tasks
|
||||
|
||||
mp.messaging.outgoing.kogito-variables-events.url=http://data-index-service-postgresql/variables
|
||||
|
||||
# Skip user tasks and variables events sending.
|
||||
kogito.events.usertasks.enabled=false
|
||||
kogito.events.variables.enabled=false
|
||||
|
||||
quarkus.log.category."io.smallrye.reactive.messaging".level = DEBUG
|
||||
quarkus.log.category."org.kie".level = DEBUG
|
||||
quarkus.log.category."io.quarkus.reactivemessaging".level = DEBUG
|
||||
quarkus.log.category."io.vertx".level = DEBUG
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
app: helloworld
|
||||
name: helloworld-props
|
@ -1,3 +1,2 @@
|
||||
resources:
|
||||
- 02-configmap_helloworld-props.yaml
|
||||
- 03-sonataflow_helloworld.yaml
|
||||
- 01-sonataflow_helloworld.yaml
|
||||
|
Reference in New Issue
Block a user