forked from apache/incubator-kie-kogito-examples
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KOGITO-9971: Adding Data-index with operator use cases (apache#1839)
* KOGITO-9971: Adding Data-index with operator use cases * KOGITO-9971: Adding Data-index with operator use cases * Removing platform resources regarding they are provided by the default swf-builder
- Loading branch information
1 parent
13b2324
commit a15acff
Showing
16 changed files
with
776 additions
and
0 deletions.
There are no files selected for viewing
413 changes: 413 additions & 0 deletions
413
serverless-operator-examples/serverless-workflow-dataindex-use-cases/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
...perator-examples/serverless-workflow-dataindex-use-cases/infra/dataindex/01-postgres.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: postgres | ||
name: postgres-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: postgres | ||
name: postgres | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: postgres | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: postgres | ||
spec: | ||
containers: | ||
- name: postgres | ||
image: postgres:13.2-alpine | ||
imagePullPolicy: 'IfNotPresent' | ||
ports: | ||
- containerPort: 5432 | ||
volumeMounts: | ||
- name: storage | ||
mountPath: /var/lib/postgresql/data | ||
envFrom: | ||
- secretRef: | ||
name: postgres-secrets | ||
readinessProbe: | ||
exec: | ||
command: ["pg_isready"] | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 2 | ||
livenessProbe: | ||
exec: | ||
command: ["pg_isready"] | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 2 | ||
resources: | ||
limits: | ||
memory: "256Mi" | ||
cpu: "500m" | ||
volumes: | ||
- name: storage | ||
persistentVolumeClaim: | ||
claimName: postgres-pvc | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: postgres | ||
name: postgres | ||
spec: | ||
selector: | ||
app.kubernetes.io/name: postgres | ||
ports: | ||
- port: 5432 |
92 changes: 92 additions & 0 deletions
92
...erator-examples/serverless-workflow-dataindex-use-cases/infra/dataindex/02-dataindex.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
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 |
10 changes: 10 additions & 0 deletions
10
...r-examples/serverless-workflow-dataindex-use-cases/infra/dataindex/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
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 |
17 changes: 17 additions & 0 deletions
17
...rator-examples/serverless-workflow-dataindex-use-cases/infra/dataindex/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
resources: | ||
- 01-postgres.yaml | ||
- 02-dataindex.yaml | ||
|
||
secretGenerator: | ||
- name: postgres-secrets | ||
literals: | ||
- POSTGRES_USER=sonataflow | ||
- POSTGRES_PASSWORD=sonataflow | ||
- POSTGRES_DB=sonataflow | ||
- PGDATA=/var/lib/postgresql/data/mydata | ||
|
||
configMapGenerator: | ||
- name: dataindex-properties | ||
files: | ||
- application.properties | ||
|
36 changes: 36 additions & 0 deletions
36
...rless-workflow-dataindex-use-cases/infra/service_discovery/01-service-discovery-role.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
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 |
11 changes: 11 additions & 0 deletions
11
...orkflow-dataindex-use-cases/infra/service_discovery/02-service-discovery-rolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 |
3 changes: 3 additions & 0 deletions
3
...amples/serverless-workflow-dataindex-use-cases/infra/service_discovery/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- 01-service-discovery-role.yaml | ||
- 02-service-discovery-rolebinding.yaml |
3 changes: 3 additions & 0 deletions
3
...tor-examples/serverless-workflow-dataindex-use-cases/usecases/usecase1/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- ../../infra/service_discovery | ||
- ../../workflows/sonataflow-greeting |
4 changes: 4 additions & 0 deletions
4
...tor-examples/serverless-workflow-dataindex-use-cases/usecases/usecase2/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resources: | ||
- ../../infra/service_discovery | ||
- ../../workflows/sonataflow-greeting | ||
- ../../workflows/sonataflow-helloworld |
23 changes: 23 additions & 0 deletions
23
...rkflow-dataindex-use-cases/workflows/sonataflow-greeting/02-configmap_greeting-props.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 |
42 changes: 42 additions & 0 deletions
42
...ss-workflow-dataindex-use-cases/workflows/sonataflow-greeting/03-sonataflow_greeting.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: sonataflow.org/v1alpha08 | ||
kind: SonataFlow | ||
metadata: | ||
name: greeting | ||
annotations: | ||
sonataflow.org/description: Greeting example on k8s! | ||
sonataflow.org/version: 0.0.1 | ||
spec: | ||
flow: | ||
start: ChooseOnLanguage | ||
functions: | ||
- name: greetFunction | ||
type: custom | ||
operation: sysout | ||
states: | ||
- name: ChooseOnLanguage | ||
type: switch | ||
dataConditions: | ||
- condition: "${ .language == \"English\" }" | ||
transition: GreetInEnglish | ||
- condition: "${ .language == \"Spanish\" }" | ||
transition: GreetInSpanish | ||
defaultCondition: GreetInEnglish | ||
- name: GreetInEnglish | ||
type: inject | ||
data: | ||
greeting: "Hello from JSON Workflow, " | ||
transition: GreetPerson | ||
- name: GreetInSpanish | ||
type: inject | ||
data: | ||
greeting: "Saludos desde JSON Workflow, " | ||
transition: GreetPerson | ||
- name: GreetPerson | ||
type: operation | ||
actions: | ||
- name: greetAction | ||
functionRef: | ||
refName: greetFunction | ||
arguments: | ||
message: ".greeting+.name" | ||
end: true |
3 changes: 3 additions & 0 deletions
3
.../serverless-workflow-dataindex-use-cases/workflows/sonataflow-greeting/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- 02-configmap_greeting-props.yaml | ||
- 03-sonataflow_greeting.yaml |
23 changes: 23 additions & 0 deletions
23
...ow-dataindex-use-cases/workflows/sonataflow-helloworld/02-configmap_helloworld-props.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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 |
21 changes: 21 additions & 0 deletions
21
...orkflow-dataindex-use-cases/workflows/sonataflow-helloworld/03-sonataflow_helloworld.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: sonataflow.org/v1alpha08 | ||
kind: SonataFlow | ||
metadata: | ||
name: helloworld | ||
annotations: | ||
sonataflow.org/description: Hello World Workflow | ||
sonataflow.org/version: 0.0.1 | ||
spec: | ||
flow: | ||
start: Inject Hello World | ||
states: | ||
- name: Inject Hello World | ||
type: inject | ||
data: | ||
greeting: Hello World | ||
transition: Inject Mantra | ||
- name: Inject Mantra | ||
type: inject | ||
data: | ||
mantra: Serverless Workflow is awesome! | ||
end: true |
3 changes: 3 additions & 0 deletions
3
...erverless-workflow-dataindex-use-cases/workflows/sonataflow-helloworld/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resources: | ||
- 02-configmap_helloworld-props.yaml | ||
- 03-sonataflow_helloworld.yaml |