From b2aa86402088f55085331636e030316aeb626f03 Mon Sep 17 00:00:00 2001 From: Moti Asayag Date: Thu, 17 Jul 2025 00:33:37 +0300 Subject: [PATCH] Add manifests for select-user/list-users Signed-off-by: Moti Asayag --- workflows/list-users/application.properties | 5 +- .../01-configmap_list-users-props.yaml | 26 ++++++++ ...igmap_01-list-users-resources-schemas.yaml | 40 ++++++++++++ .../manifests/03-sonataflow_list-users.yaml | 64 +++++++++++++++++++ workflows/select-user/application.properties | 5 +- .../01-configmap_select-user-props.yaml | 26 ++++++++ ...gmap_01-select-user-resources-schemas.yaml | 40 ++++++++++++ .../manifests/03-sonataflow_select-user.yaml | 64 +++++++++++++++++++ 8 files changed, 268 insertions(+), 2 deletions(-) create mode 100755 workflows/list-users/manifests/01-configmap_list-users-props.yaml create mode 100755 workflows/list-users/manifests/02-configmap_01-list-users-resources-schemas.yaml create mode 100755 workflows/list-users/manifests/03-sonataflow_list-users.yaml create mode 100755 workflows/select-user/manifests/01-configmap_select-user-props.yaml create mode 100755 workflows/select-user/manifests/02-configmap_01-select-user-resources-schemas.yaml create mode 100755 workflows/select-user/manifests/03-sonataflow_select-user.yaml diff --git a/workflows/list-users/application.properties b/workflows/list-users/application.properties index bbbe0027..00f4fd39 100644 --- a/workflows/list-users/application.properties +++ b/workflows/list-users/application.properties @@ -6,4 +6,7 @@ quarkus.kubernetes-client.trust-certs=true # Possible values: OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL. # and see https://quarkus.io/guides/logging for documentation quarkus.log.category."org.apache.http".level=INFO -quarkus.log.level=INFO \ No newline at end of file +quarkus.log.level=INFO + +# enable persistence +kie.flyway.enabled = true diff --git a/workflows/list-users/manifests/01-configmap_list-users-props.yaml b/workflows/list-users/manifests/01-configmap_list-users-props.yaml new file mode 100755 index 00000000..8ec5ace5 --- /dev/null +++ b/workflows/list-users/manifests/01-configmap_list-users-props.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +data: + application.properties: | + quarkus.tls.trust-all=true + quarkus.kubernetes-client.trust-certs=true + + # This property is used to select the log level, which controls the amount + # of information logged on HTTP requests based on the severity of the events. + # Possible values: OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL. + # and see https://quarkus.io/guides/logging for documentation + quarkus.log.category."org.apache.http".level=INFO + quarkus.log.level=INFO + + # enable persistence + kie.flyway.enabled = true +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + app: list-users + app.kubernetes.io/component: serverless-workflow + app.kubernetes.io/managed-by: sonataflow-operator + app.kubernetes.io/name: list-users + sonataflow.org/workflow-app: list-users + sonataflow.org/workflow-namespace: "" + name: list-users-props diff --git a/workflows/list-users/manifests/02-configmap_01-list-users-resources-schemas.yaml b/workflows/list-users/manifests/02-configmap_01-list-users-resources-schemas.yaml new file mode 100755 index 00000000..5880fd2c --- /dev/null +++ b/workflows/list-users/manifests/02-configmap_01-list-users-resources-schemas.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +data: + list-users.json: |- + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "selectUser": { + "type": "string", + "title": "Please select a user name from the list", + "ui:widget": "ActiveDropdown", + "ui:props": { + "fetch:url": "$${{backend.baseUrl}}/api/catalog/entities?fields=metadata.name,metadata.namespace,kind&filter=kind=user", + "fetch:response:value": "[$map($,function($v){$lowercase( $v.kind ) & ':' & $v.metadata.namespace & '/' & $v.metadata.name})]", + "fetch:response:label": "[$map($,function($v){$lowercase( $v.kind ) & ':' & $v.metadata.namespace & '/' & $v.metadata.name})]", + "fetch:method": "GET", + "fetch:headers": { + "Authorization": "Bearer $${{identityApi.token}}" + } + } + } + } + } + workflow-output-schema.json: |- + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "WorkflowResult", + "description": "Schema of workflow output", + "type": "object", + "properties": { + "result": { + "$ref": "../shared/schemas/workflow-result-schema.json", + "type": "object" + } + } + } +kind: ConfigMap +metadata: + creationTimestamp: null + name: 01-list-users-resources-schemas diff --git a/workflows/list-users/manifests/03-sonataflow_list-users.yaml b/workflows/list-users/manifests/03-sonataflow_list-users.yaml new file mode 100755 index 00000000..829a6203 --- /dev/null +++ b/workflows/list-users/manifests/03-sonataflow_list-users.yaml @@ -0,0 +1,64 @@ +apiVersion: sonataflow.org/v1alpha08 +kind: SonataFlow +metadata: + annotations: + sonataflow.org/description: list-users + sonataflow.org/expressionLang: jq + sonataflow.org/profile: gitops + sonataflow.org/version: "0.1" + creationTimestamp: null + labels: + app: list-users + app.kubernetes.io/component: serverless-workflow + app.kubernetes.io/managed-by: sonataflow-operator + app.kubernetes.io/name: list-users + sonataflow.org/workflow-app: list-users + sonataflow.org/workflow-namespace: "" + name: list-users +spec: + flow: + dataInputSchema: + failOnValidationErrors: true + schema: schemas/list-users.json + functions: + - name: successResult + operation: '{ "result": { "message": "Selected user is: " + .selectUser, "outputs":[], "nextWorkflows":[ ] } }' + type: expression + start: + stateName: Start + states: + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: successResult + name: successResult + end: + terminate: true + name: Start + type: operation + podTemplate: + container: + image: quay.io/orchestrator/serverless-workflows-list-users:1.6 + resources: {} + resources: + configMaps: + - configMap: + name: 01-list-users-resources-schemas + workflowPath: schemas + persistence: + postgresql: + secretRef: + name: sonataflow-psql-postgresql + userKey: postgres-username + passwordKey: postgres-password + serviceRef: + name: sonataflow-psql-postgresql + port: 5432 + databaseName: sonataflow + databaseSchema: list-users +status: + address: {} + lastTimeRecoverAttempt: null diff --git a/workflows/select-user/application.properties b/workflows/select-user/application.properties index bbbe0027..00f4fd39 100644 --- a/workflows/select-user/application.properties +++ b/workflows/select-user/application.properties @@ -6,4 +6,7 @@ quarkus.kubernetes-client.trust-certs=true # Possible values: OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL. # and see https://quarkus.io/guides/logging for documentation quarkus.log.category."org.apache.http".level=INFO -quarkus.log.level=INFO \ No newline at end of file +quarkus.log.level=INFO + +# enable persistence +kie.flyway.enabled = true diff --git a/workflows/select-user/manifests/01-configmap_select-user-props.yaml b/workflows/select-user/manifests/01-configmap_select-user-props.yaml new file mode 100755 index 00000000..ebdacfed --- /dev/null +++ b/workflows/select-user/manifests/01-configmap_select-user-props.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +data: + application.properties: | + quarkus.tls.trust-all=true + quarkus.kubernetes-client.trust-certs=true + + # This property is used to select the log level, which controls the amount + # of information logged on HTTP requests based on the severity of the events. + # Possible values: OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL. + # and see https://quarkus.io/guides/logging for documentation + quarkus.log.category."org.apache.http".level=INFO + quarkus.log.level=INFO + + # enable persistence + kie.flyway.enabled = true +kind: ConfigMap +metadata: + creationTimestamp: null + labels: + app: select-user + app.kubernetes.io/component: serverless-workflow + app.kubernetes.io/managed-by: sonataflow-operator + app.kubernetes.io/name: select-user + sonataflow.org/workflow-app: select-user + sonataflow.org/workflow-namespace: "" + name: select-user-props diff --git a/workflows/select-user/manifests/02-configmap_01-select-user-resources-schemas.yaml b/workflows/select-user/manifests/02-configmap_01-select-user-resources-schemas.yaml new file mode 100755 index 00000000..94c9f2dd --- /dev/null +++ b/workflows/select-user/manifests/02-configmap_01-select-user-resources-schemas.yaml @@ -0,0 +1,40 @@ +apiVersion: v1 +data: + select-user.json: |- + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "selectUser": { + "type": "string", + "title": "Please enter user name. Start typing for autocompletion", + "ui:widget": "ActiveTextInput", + "ui:props": { + "fetch:url": "$${{backend.baseUrl}}/api/catalog/entities?fields=metadata.name,metadata.namespace,kind&filter=kind=user", + "fetch:response:value": "[$map($,function($v){$lowercase( $v.kind ) & ':' & $v.metadata.namespace & '/' & $v.metadata.name})][0]", + "fetch:response:autocomplete": "[$map($,function($v){$lowercase( $v.kind ) & ':' & $v.metadata.namespace & '/' & $v.metadata.name})]", + "fetch:method": "GET", + "fetch:headers": { + "Authorization": "Bearer $${{identityApi.token}}" + } + } + } + } + } + workflow-output-schema.json: |- + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "WorkflowResult", + "description": "Schema of workflow output", + "type": "object", + "properties": { + "result": { + "$ref": "../shared/schemas/workflow-result-schema.json", + "type": "object" + } + } + } +kind: ConfigMap +metadata: + creationTimestamp: null + name: 01-select-user-resources-schemas diff --git a/workflows/select-user/manifests/03-sonataflow_select-user.yaml b/workflows/select-user/manifests/03-sonataflow_select-user.yaml new file mode 100755 index 00000000..1956ffae --- /dev/null +++ b/workflows/select-user/manifests/03-sonataflow_select-user.yaml @@ -0,0 +1,64 @@ +apiVersion: sonataflow.org/v1alpha08 +kind: SonataFlow +metadata: + annotations: + sonataflow.org/description: select-user + sonataflow.org/expressionLang: jq + sonataflow.org/profile: gitops + sonataflow.org/version: "0.1" + creationTimestamp: null + labels: + app: select-user + app.kubernetes.io/component: serverless-workflow + app.kubernetes.io/managed-by: sonataflow-operator + app.kubernetes.io/name: select-user + sonataflow.org/workflow-app: select-user + sonataflow.org/workflow-namespace: "" + name: select-user +spec: + flow: + dataInputSchema: + failOnValidationErrors: true + schema: schemas/select-user.json + functions: + - name: successResult + operation: '{ "result": { "message": "Selected user is: " + .selectUser, "outputs":[], "nextWorkflows":[ ] } }' + type: expression + start: + stateName: Start + states: + - actionMode: sequential + actions: + - actionDataFilter: + useResults: true + functionRef: + invoke: sync + refName: successResult + name: successResult + end: + terminate: true + name: Start + type: operation + podTemplate: + container: + image: quay.io/orchestrator/serverless-workflows-select-user:1.6 + resources: {} + resources: + configMaps: + - configMap: + name: 01-select-user-resources-schemas + workflowPath: schemas + persistence: + postgresql: + secretRef: + name: sonataflow-psql-postgresql + userKey: postgres-username + passwordKey: postgres-password + serviceRef: + name: sonataflow-psql-postgresql + port: 5432 + databaseName: sonataflow + databaseSchema: select-user +status: + address: {} + lastTimeRecoverAttempt: null