Skip to content
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
724 changes: 682 additions & 42 deletions README.md

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions dataindex/kustomization.yaml

This file was deleted.

File renamed without changes.
39 changes: 35 additions & 4 deletions dataindex/02-dataindex.yaml → infra/dataindex/02-dataindex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ spec:
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
- name: QUARKUS_DATASOURCE_USERNAME
valueFrom:
secretKeyRef:
key: POSTGRES_USER
Expand All @@ -41,9 +43,38 @@ spec:
secretKeyRef:
key: POSTGRES_PASSWORD
name: postgres-secrets
envFrom:
- configMapRef:
name: dataindex-properties
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: busybox:1.36
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'until nc -vz postgres.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local 5432; do echo "Waiting for postgres server"; sleep 3; done;']
---
apiVersion: v1
kind: Service
Expand Down
10 changes: 10 additions & 0 deletions infra/dataindex/application.properties
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 infra/dataindex/kustomization.yaml
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

91 changes: 91 additions & 0 deletions infra/dataindex_and_jobservice/03-jobservice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: jobs-service-postgresql
name: jobs-service-postgresql
spec:
replicas: 1
# remove after https://issues.redhat.com/browse/KOGITO-8311 is done
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: jobs-service-postgresql
template:
metadata:
labels:
app.kubernetes.io/name: jobs-service-postgresql
spec:
containers:
- name: jobs-service-postgresql
image: quay.io/kiegroup/kogito-jobs-service-allinone:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
- name: JOBS_SERVICE_PERSISTENCE
value: postgresql
- 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: jobs-service-properties
initContainers:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead, can we use Startup probes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if a startup probe will help here, what we need to check, is that, before the jobs-service initialization begins, the postgres service is available. And this is what the init-postgres init container is trying to do.
But, a startup prob, won't prevent the jobs-service container to wait for the postgres service to start , instead, the jobs-service container will just start, and if the postgres service is not there yet, it'll just fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that for prod, we can't use busybox. The Quarkus Health checks won't ping the postgres service?

- name: init-postgres
image: busybox:1.36
imagePullPolicy: IfNotPresent
command: ['sh', '-c', 'until nc -vz postgres.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local 5432; do echo "Waiting for postgres server"; sleep 3; done;']
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: jobs-service-postgresql
name: jobs-service-postgresql
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app.kubernetes.io/name: jobs-service-postgresql
type: NodePort
13 changes: 13 additions & 0 deletions infra/dataindex_and_jobservice/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kogito.service.url=http://jobs-service-postgresql

quarkus.datasource.jdbc.url=jdbc:postgresql://postgres:5432/sonataflow?currentSchema=jobs-service
quarkus.datasource.reactive.url=postgresql://postgres:5432/sonataflow?search_path=jobs-service

# Enable the job status change events notification.
kogito.jobs-service.http.job-status-change-events=true
# Deliver the job status change events directly to the data-index-service-postgresql.
mp.messaging.outgoing.kogito-job-service-job-status-events-http.url=http://data-index-service-postgresql/jobs
# Disable the K_SINK injection health check since we knative eventing is not being used.
quarkus.smallrye-health.check."org.kie.kogito.jobs.service.messaging.http.health.knative.KSinkInjectionHealthCheck".enabled=false
# if you use env variables you must use this env var instead.
#QUARKUS_SMALLRYE_HEALTH_CHECK__ORG_KIE_KOGITO_JOBS_SERVICE_MESSAGING_HTTP_HEALTH_KNATIVE_KSINKINJECTIONHEALTHCHECK__ENABLED=false
8 changes: 8 additions & 0 deletions infra/dataindex_and_jobservice/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- ../dataindex
- 03-jobservice.yml

configMapGenerator:
- name: jobs-service-properties
files:
- application.properties
36 changes: 36 additions & 0 deletions infra/service_discovery/01-service-discovery-role.yaml
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 infra/service_discovery/02-service-discovery-rolebinding.yaml
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 infra/service_discovery/kustomization.yaml
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
name: sonataflow-platform
spec:
build:
template:
buildArgs:
- name: QUARKUS_EXTENSIONS
value: org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:2.0.0-SNAPSHOT
config:
strategyOptions:
KanikoBuildCacheEnabled: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- 01-sonataflow_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
name: sonataflow-platform
spec:
build:
template:
buildArgs:
- name: QUARKUS_EXTENSIONS
value: org.kie.kogito:kogito-addons-quarkus-jobs-knative-eventing:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-persistence-jdbc:2.0.0-SNAPSHOT,io.quarkus:quarkus-jdbc-postgresql:2.16.10.Final,io.quarkus:quarkus-agroal:2.16.10.Final
config:
strategyOptions:
KanikoBuildCacheEnabled: "true"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- 01-sonataflow_platform.yaml
16 changes: 16 additions & 0 deletions platforms/dataindex_platform/01-sonataflow_platform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: sonataflow.org/v1alpha08
kind: SonataFlowPlatform
metadata:
name: sonataflow-platform
spec:
build:
# kogito-swf-builder and kogito-swf-builder-nightly images already adds:
# kogito-addons-quarkus-events-process and kogito-addons-quarkus-process-management
# we shouldn't need to add them again, unless we want to protect from future changes on these images.
# template:
# buildArgs:
# - name: QUARKUS_EXTENSIONS
# value: org.kie.kogito:kogito-addons-quarkus-events-process:2.0.0-SNAPSHOT,org.kie.kogito:kogito-addons-quarkus-process-management:2.0.0-SNAPSHOT
config:
strategyOptions:
KanikoBuildCacheEnabled: "true"
2 changes: 2 additions & 0 deletions platforms/dataindex_platform/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- 01-sonataflow_platform.yaml
4 changes: 4 additions & 0 deletions usecases/usecase1/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ../../platforms/dataindex_platform
- ../../infra/service_discovery
- ../../workflows/sonataflow-greeting
5 changes: 5 additions & 0 deletions usecases/usecase2/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- ../../platforms/dataindex_platform
- ../../infra/service_discovery
- ../../workflows/sonataflow-greeting
- ../../workflows/sonataflow-helloworld
4 changes: 4 additions & 0 deletions usecases/usecase3-persistence/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ../../platforms/dataindex_and_jobservice_platform_persistence
- ../../infra/service_discovery
- ../../workflows/sonataflow-callbackstatetimeouts-persistence
4 changes: 4 additions & 0 deletions usecases/usecase3/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resources:
- ../../platforms/dataindex_and_jobservice_platform
- ../../infra/service_discovery
- ../../workflows/sonataflow-callbackstatetimeouts
6 changes: 6 additions & 0 deletions usecases/usecase4/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resources:
- ../../platforms/dataindex_and_jobservice_platform
- ../../infra/service_discovery
- ../../workflows/sonataflow-greeting
- ../../workflows/sonataflow-callbackstatetimeouts
- ../../workflows/sonataflow-workflowtimeouts
Loading