From 5dfd18acd024be0ae2a2d64a61069337c3a13aef Mon Sep 17 00:00:00 2001 From: Arek Burdach Date: Mon, 4 Mar 2024 14:04:05 +0100 Subject: [PATCH] [NU-1069] streaming-lite and request-response modes replaced by one lite-k8s (#137) --- deploy-values-lite-both-processing-modes.yaml | 21 +++++ deploy-values-request-response.yaml | 4 +- deploy-values-streaming-lite.yaml | 4 +- .../custom-component-docker-values.yaml | 2 +- .../custom-component-url-values.yaml | 19 ++--- examples/customConfig/custom-conf-values.yaml | 2 +- .../customSecret/custom-secret-values.yaml | 2 +- src/README.md | 42 +++++----- src/bats-suites/kafka-only.bats | 5 +- src/bats-suites/rr-only.bats | 6 +- src/bats-suites/rr-testprocess.json | 11 +-- src/bats-suites/testprocess.json | 17 +--- src/templates/_helpers.tpl | 37 +++++---- src/templates/configmap.yaml | 81 ++++++++++++++++--- src/templates/tests/test-job.yaml | 13 ++- src/values.yaml | 7 +- 16 files changed, 174 insertions(+), 99 deletions(-) create mode 100644 deploy-values-lite-both-processing-modes.yaml diff --git a/deploy-values-lite-both-processing-modes.yaml b/deploy-values-lite-both-processing-modes.yaml new file mode 100644 index 00000000..a9acdfd9 --- /dev/null +++ b/deploy-values-lite-both-processing-modes.yaml @@ -0,0 +1,21 @@ +image: + tag: staging-latest + pullPolicy: Always + +flink: + enabled: false + +nussknacker: + mode: "lite-k8s" + +telegraf: + enabled: false + +zookeeper: + enabled: false + +kafka: + kraft: + enabled: true + externalZookeeper: + servers: [] diff --git a/deploy-values-request-response.yaml b/deploy-values-request-response.yaml index befd1ee8..766a098b 100644 --- a/deploy-values-request-response.yaml +++ b/deploy-values-request-response.yaml @@ -3,7 +3,9 @@ image: pullPolicy: Always nussknacker: - mode: "request-response" + mode: "lite-k8s" + streaming: + enabled: false flink: enabled: false diff --git a/deploy-values-streaming-lite.yaml b/deploy-values-streaming-lite.yaml index 91fbb7db..a99f8394 100644 --- a/deploy-values-streaming-lite.yaml +++ b/deploy-values-streaming-lite.yaml @@ -6,7 +6,9 @@ flink: enabled: false nussknacker: - mode: "streaming-lite" + mode: "lite-k8s" + requestResponse: + enabled: false telegraf: enabled: false diff --git a/examples/customComponents/custom-component-docker-values.yaml b/examples/customComponents/custom-component-docker-values.yaml index 2661795e..93a908a8 100644 --- a/examples/customComponents/custom-component-docker-values.yaml +++ b/examples/customComponents/custom-component-docker-values.yaml @@ -1,4 +1,4 @@ -#This configuration shows how to use custom images for streaming-lite mode (for Flink mode you only have to configure image.repository) +#This configuration shows how to use custom images for lite-k8s mode (for Flink mode you only have to configure image.repository) #This assumes that nussknacker-sample-components and nussknacker-sample-components-lite-runtime-app images #(created e.g. with https://github.com/TouK/nussknacker-sample-components) #are available in K8s cluster. If k3d is used, the image has to imported first. diff --git a/examples/customComponents/custom-component-url-values.yaml b/examples/customComponents/custom-component-url-values.yaml index 17bb5300..67c1c114 100644 --- a/examples/customComponents/custom-component-url-values.yaml +++ b/examples/customComponents/custom-component-url-values.yaml @@ -1,14 +1,15 @@ -#This configuration shows how to use custom components/libs by custom URL for streaming-lite mode (for Flink mode you only have to configure nussknacker.modelClasspath) +#This configuration shows how to use custom components/libs by custom URL for lite-k8s mode (for Flink mode you only have to configure nussknacker.streaming.modelClassPath) #This assumes that URL points to location accessible from container, which contains jar with all needed dependencies #Here we add custom DB driver, as it's easy to use nussknacker: #At the moment one has to override whole classPath to add custom entries - modelClassPath: &modelClassPath - - "model/defaultModel.jar" - - "components/lite/liteBase.jar" - - "components/lite/liteKafka.jar" - - "components/common" - - "https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.6.1/hsqldb-2.6.1.jar" + streaming: + modelClassPath: &streamingModelClassPath + - "model/defaultModel.jar" + - "components/lite/liteBase.jar" + - "components/lite/liteKafka.jar" + - "components/common" + - "https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.6.1/hsqldb-2.6.1.jar" modelConfig: components: @@ -25,5 +26,5 @@ nussknacker: scenarioTypes: default: deploymentConfig: - configExecutionOverrides: - modelClassPath: *modelClassPath + configExecutionOverrides: + modelClassPath: *streamingModelClassPath diff --git a/examples/customConfig/custom-conf-values.yaml b/examples/customConfig/custom-conf-values.yaml index ff285ef3..b0bd41c1 100644 --- a/examples/customConfig/custom-conf-values.yaml +++ b/examples/customConfig/custom-conf-values.yaml @@ -1,6 +1,6 @@ #This configuration shows how to run NU designer using configuration from external file provided from configmap nussknacker: - mode: "streaming-lite" + mode: "lite-k8s" configFile: /etc/nussknacker/application.conf,/etc/nussknacker/extra/extra-application.conf additionalVolumes: diff --git a/examples/customSecret/custom-secret-values.yaml b/examples/customSecret/custom-secret-values.yaml index 7fea0f34..8024a2e6 100644 --- a/examples/customSecret/custom-secret-values.yaml +++ b/examples/customSecret/custom-secret-values.yaml @@ -10,7 +10,7 @@ extraEnv: name: 'nussknacker-secrets' key: OPEN_API_KEY nussknacker: - mode: "streaming-lite" + mode: "lite-k8s" k8sDeploymentConfig: spec: template: diff --git a/src/README.md b/src/README.md index e145a954..677e6a6d 100644 --- a/src/README.md +++ b/src/README.md @@ -69,29 +69,32 @@ Modes The `mode` configuration variable is a convenient umbrella term for the processing mode and engine. See [Glossary](https://nussknacker.io/documentation/about/GLOSSARY) for the explanation of these terms. -By default, the chart runs Nussknacker in `flink` mode which deploys scenarios to Flink engine (either installed directly by the chart, or external one). It is also possible to run Nussknacker on K8s in `streaming-lite` and `request-response` modes. You will need to manually adjust values of the following variables if you use `mode` other than `flink`. - -For: -* `streaming-lite` mode: +By default, the chart runs Nussknacker in `flink` mode which deploys scenarios to Flink engine (either installed directly by the chart, or external one). It is also possible to run Nussknacker on K8s in `lite-k8s` mode. You will need to manually adjust values of the following variables if you use this `mode`: ``` nussknacker: - mode: streaming-lite + mode: lite-k8s flink: enable: false telegraf: enabled: false ``` - -* `request-response` mode + +In case if you want to use only request-response processing mode in your scenarios you can also disable streaming part of the application stack: ``` nussknacker: - mode: request-response + mode: lite-k8s + streaming: + enabled: false flink: enable: false telegraf: enabled: false kafka: enabled: false + zookeeper: + enabled: false + apicurio-registry: + enabled: false ``` Configuration @@ -120,8 +123,8 @@ Nussknacker configuration consists of three [configuration areas](https://nusskn included in ```modelConfig``` section of the configuration - `uiConfig` - modifies the Designer configuration options. You can override things like environment name, metrics and so on. They are included on the root level of ```application.conf``` - the Deployment Manager configuration parameters (and Helm variables) are documented fully in Nussknacker configuration [documentation](https://nussknacker.io/documentation/docs/next/installation_configuration_guide/DeploymentManagerConfiguration#lite-engine-based-on-kubernetes); below we mention just those which are most often modified: - - `k8sDeploymentConfig` - here you can specify your own k8s runtime deployment yaml config in `streaming-lite` and `request-response` modes - - `requestResponse` - here you can specify `servicePort` and `ingress` configuration for deployed scenarios on k8s when running in `request-response` mode + - `k8sDeploymentConfig` - here you can specify your own k8s runtime deployment yaml config in `lite-k8s` mode + - `requestResponse` - here you can specify `servicePort` and `ingress` configuration for deployed scenarios on k8s when running in `lite-k8s` mode Yaml keys expected by Nussknacker to be in the form of nested yaml structures in the Values file are converted to json; check the chart implementation if in doubt. @@ -165,20 +168,21 @@ configuration adding additional JDBC driver for [SQL enrichers](https://docs.nus ``` nussknacker: #At the moment one has to override whole classPath to add custom entries - modelClassPath: &modelClassPath - - "model/defaultModel.jar" - - "components/lite/liteBase.jar" - - "components/lite/liteKafka.jar" - - "components/common" - - "https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.6.1/hsqldb-2.6.1.jar" + streaming: + modelClassPath: &streamingModelClassPath + - "model/defaultModel.jar" + - "components/lite/liteBase.jar" + - "components/lite/liteKafka.jar" + - "components/common" + - "https://repo1.maven.org/maven2/org/hsqldb/hsqldb/2.6.1/hsqldb-2.6.1.jar" uiConfig: scenarioTypes: default: deploymentConfig: configExecutionOverrides: - modelClassPath: *modelClassPath + modelClassPath: *streamingModelClassPath ``` -Again, for `flink` mode it's only necessary to set `modelClassPath`. +Again, for `flink` mode it's only necessary to set `streamingModelClassPath`. Security/RBAC ------------- @@ -277,7 +281,7 @@ You can deploy configMap/secret on your own using, or use special `extraDeploy` Example: ``` nussknacker: - mode: "streaming-lite" + mode: "lite-k8s" configFile: /etc/nussknacker/application.conf,/etc/nussknacker/extra/extra-application.conf additionalVolumes: diff --git a/src/bats-suites/kafka-only.bats b/src/bats-suites/kafka-only.bats index 9a9dce7b..62326f24 100755 --- a/src/bats-suites/kafka-only.bats +++ b/src/bats-suites/kafka-only.bats @@ -4,7 +4,7 @@ : "${AUTHORIZATION:?required environment value not set}" : "${KAFKA_BOOTSTRAP_SERVER:?required environment value not set}" : "${SCHEMA_REGISTRY_URL:?required environment value not set}" -: "${SCENARIO_TYPE:?required environment value not set}" +: "${STREAMING_SCENARIO_TYPE:?required environment value not set}" function curl() { /usr/bin/curl -f -k -v -H "Content-type: application/json" -H "Authorization: ${AUTHORIZATION}" "$@" @@ -38,12 +38,13 @@ _END function given_a_proxy_process() { local PROCESS_NAME="${1:?required}" local PROCESS_OBJECT="${2:?required}" + local PROCESSES_URL="${NUSSKNACKER_URL%/}/api/processes" local PROCESS_URL=$(echo ${NUSSKNACKER_URL%/}/api/processes/${PROCESS_NAME} | sed -e 's/ /%20/g') local PROCESS_DEPLOY_URL=$(echo ${NUSSKNACKER_URL%/}/api/processManagement/deploy/${PROCESS_NAME} | sed -e 's/ /%20/g') local PROCESS_CANCEL_URL=$(echo ${NUSSKNACKER_URL%/}/api/processManagement/cancel/${PROCESS_NAME} | sed -e 's/ /%20/g') local PROCESS_IMPORT_URL=$(echo ${NUSSKNACKER_URL%/}/api/processes/import/${PROCESS_NAME} | sed -e 's/ /%20/g') - curl ${PROCESS_URL} || curl -X POST ${PROCESS_URL%/}/Default + curl ${PROCESS_URL} || echo "{ \"name\": \"$PROCESS_NAME\", \"processingMode\": \"Unbounded-Stream\", \"isFragment\": false }" | curl -X POST ${PROCESSES_URL} -d @- echo ${PROCESS_OBJECT} | /usr/bin/curl -f -k -v -H "Authorization: ${AUTHORIZATION}" ${PROCESS_IMPORT_URL} -F process=@- | jq .scenarioGraph | (echo '{ "comment": "created by a bats test", "scenarioGraph": '; cat; echo '}') | curl -X PUT ${PROCESS_URL} -d @- [[ $(curl ${PROCESS_URL%/}/status | jq -r .status.name) == "RUNNING" ]] && curl -X POST ${PROCESS_CANCEL_URL} diff --git a/src/bats-suites/rr-only.bats b/src/bats-suites/rr-only.bats index 0b69e6cd..194bdfdf 100755 --- a/src/bats-suites/rr-only.bats +++ b/src/bats-suites/rr-only.bats @@ -2,7 +2,6 @@ : "${NUSSKNACKER_URL:?required environment value not set}" : "${AUTHORIZATION:?required environment value not set}" -: "${SCENARIO_TYPE:?required environment value not set}" function curl() { /usr/bin/curl -f -k -v -H "Content-type: application/json" -H "Authorization: ${AUTHORIZATION}" "$@" @@ -31,11 +30,12 @@ function wait_for_status() { function given_a_proxy_process() { local PROCESS_NAME="${1:?required}" + local PROCESSES_URL="${NUSSKNACKER_URL%/}/api/processes" local PROCESS_URL=$(echo ${NUSSKNACKER_URL%/}/api/processes/${PROCESS_NAME} | sed -e 's/ /%20/g') local PROCESS_DEPLOY_URL=$(echo ${NUSSKNACKER_URL%/}/api/processManagement/deploy/${PROCESS_NAME} | sed -e 's/ /%20/g') local PROCESS_IMPORT_URL=$( echo ${NUSSKNACKER_URL%/}/api/processes/import/${PROCESS_NAME} | sed -e 's/ /%20/g') - curl ${PROCESS_URL} || curl -X POST ${PROCESS_URL%/}/Default + curl ${PROCESS_URL} || echo "{ \"name\": \"$PROCESS_NAME\", \"processingMode\": \"Request-Response\", \"isFragment\": false }" | curl -X POST ${PROCESSES_URL} -d @- export PROCESS_NAME GROUP INPUT_TOPIC OUTPUT_TOPIC cat ${BATS_TEST_DIRNAME}/rr-testprocess.json | envsubst | /usr/bin/curl -f -k -v -H "Authorization: ${AUTHORIZATION}" ${PROCESS_IMPORT_URL} -F process=@- | jq .scenarioGraph | (echo '{ "comment": "created by a bats test", "scenarioGraph": '; cat; echo '}') | curl -X PUT ${PROCESS_URL} -d @- @@ -58,7 +58,7 @@ function setup() { INPUT_MESSAGE='{"productId":10}' EXPECTED_OUTPUT_MESSAGE='{"productId":20}' - if [[ $(curl $SCENARIO_URL -d $INPUT_MESSAGE) == $EXPECTED_OUTPUT_MESSAGE ]]; then echo ok; else exit 1; fi + if [[ $(curl $RR_SCENARIO_INPUT_URL -d $INPUT_MESSAGE) == $EXPECTED_OUTPUT_MESSAGE ]]; then echo ok; else exit 1; fi cancel_process "$PROCESS_NAME" wait_for_status "$PROCESS_NAME" "CANCELED" diff --git a/src/bats-suites/rr-testprocess.json b/src/bats-suites/rr-testprocess.json index c660dc95..a3a24c49 100644 --- a/src/bats-suites/rr-testprocess.json +++ b/src/bats-suites/rr-testprocess.json @@ -1,19 +1,14 @@ { "metaData" : { "id" : "test-scenario-for-rr-only", - "typeSpecificData" : { - "slug" : "test-scenario-for-rr-only", - "type" : "RequestResponseMetaData" - }, "additionalFields" : { "description" : null, "properties" : { + "slug" : "test-scenario-for-rr-only", "inputSchema" : "{\n \"title\": \"Product\",\n \"description\": \"A product from Acme's catalog\",\n \"type\": \"object\",\n \"properties\": {\n \"productId\": {\n \"description\": \"The unique identifier for a product\",\n \"type\": \"integer\"\n }\n },\n \"required\": [ \"productId\" ]\n}", "outputSchema" : "{\n \"title\": \"Product\",\n \"description\": \"A product from Acme's catalog\",\n \"type\": \"object\",\n \"properties\": {\n \"productId\": {\n \"description\": \"The unique identifier for a product\",\n \"type\": \"integer\"\n }\n },\n \"required\": [ \"productId\" ]\n}" - } - }, - "subprocessVersions" : { - + }, + "metaDataType": "RequestResponseMetaData" } }, "nodes" : [ diff --git a/src/bats-suites/testprocess.json b/src/bats-suites/testprocess.json index 2f141c92..6afcce83 100644 --- a/src/bats-suites/testprocess.json +++ b/src/bats-suites/testprocess.json @@ -1,25 +1,14 @@ { "metaData": { "id": "${PROCESS_NAME}", - "typeSpecificData": { - "parallelism": 1, - "type": "${SCENARIO_TYPE}" - }, - "isSubprocess": false, "additionalFields": { "description": null, - "groups": [ - ], "properties": { - } - }, - "subprocessVersions": { + "parallelism": "1" + }, + "metaDataType": "${STREAMING_SCENARIO_TYPE}" } }, - "exceptionHandlerRef": { - "parameters": [ - ] - }, "nodes": [ { "id": "kafka-source", diff --git a/src/templates/_helpers.tpl b/src/templates/_helpers.tpl index 0fe8e75a..9b5104f6 100644 --- a/src/templates/_helpers.tpl +++ b/src/templates/_helpers.tpl @@ -169,34 +169,41 @@ http://{{ include "apicurio-registry.fullname" ( index .Subcharts "apicurio-regi http://{{ include "influxdb.fullname" (dict "Chart" (dict "Name" "influxdb") "Values" .Values.influxdb "Release" .Release "Capabilities" .Capabilities) }}:8086 {{- end -}} -{{- define "nussknacker.defaultDashboard" -}} +{{- define "nussknacker.streaming.dashboard" -}} {{- if eq .Values.nussknacker.mode "flink" -}} nussknacker-scenario -{{- else if eq .Values.nussknacker.mode "streaming-lite" -}} +{{- else if eq .Values.nussknacker.mode "lite-k8s" -}} nussknacker-lite-scenario -{{- else if eq .Values.nussknacker.mode "request-response" -}} -nussknacker-request-response-scenario {{- else -}} -{{- .Values.nussknacker.defaultDashboard }} +{{- .Values.nussknacker.streaming.dashboard }} {{- end -}} {{- end -}} -{{- define "nussknacker.modelClassPath" -}} -{{- if .Values.nussknacker.modelClassPath -}} -{{ tpl ( mustToJson .Values.nussknacker.modelClassPath) . }} +{{- define "nussknacker.streaming.modelClassPath" -}} +{{- if .Values.nussknacker.streaming.modelClassPath -}} +{{ tpl ( mustToJson .Values.nussknacker.streaming.modelClassPath) . }} {{- else if eq .Values.nussknacker.mode "flink" -}} ["model/defaultModel.jar", "model/flinkExecutor.jar", "components/flink", "components/common"] {{- else if eq .Values.nussknacker.mode "ververica" -}} ["model/defaultModel.jar", "model/flinkExecutor.jar", "components/flink", "components/common", "compatibility-provider/nussknacker-ververica-compatibility-provider.jar"] -{{- else if eq .Values.nussknacker.mode "streaming-lite" -}} +{{- else if eq .Values.nussknacker.mode "lite-k8s" -}} ["model/defaultModel.jar", "components/lite/liteBase.jar", "components/lite/liteKafka.jar", "components/common"] -{{- else if eq .Values.nussknacker.mode "request-response" -}} -["model/defaultModel.jar", "components/lite/liteBase.jar", "components/lite/liteRequestResponse.jar", "components/common"] {{- else -}} -{{- fail "Value for .Values.nussknacker.mode is not supported. Supported modes are: flink, streaming-lite and request-response" }} +{{- fail "Value for .Values.nussknacker.mode is not supported. Supported modes are: flink, ververica and lite-k8s" }} {{- end -}} {{- end -}} +{{- define "nussknacker.requestResponse.modelClassPath" -}} +{{- if .Values.nussknacker.requestResponse.modelClassPath -}} +{{ tpl ( mustToJson .Values.nussknacker.requestResponse.modelClassPath) . }} +{{- else if or (eq .Values.nussknacker.mode "flink") (eq .Values.nussknacker.mode "ververica") -}} +[] +{{- else if eq .Values.nussknacker.mode "lite-k8s" -}} +["model/defaultModel.jar", "components/lite/liteBase.jar", "components/lite/liteRequestResponse.jar", "components/common"] +{{- else -}} +{{- fail "Value for .Values.nussknacker.mode is not supported. Supported modes are: flink, ververica and lite-k8s" }} +{{- end -}} +{{- end -}} {{- define "nussknacker.influxDbConfig" -}} { @@ -211,13 +218,11 @@ nussknacker-request-response-scenario } {{- end -}} -{{- define "nussknacker.scenarioType" -}} +{{- define "nussknacker.streamingScenarioType" -}} {{- if eq .Values.nussknacker.mode "flink" -}} StreamMetaData -{{- else if eq .Values.nussknacker.mode "streaming-lite" -}} +{{- else if eq .Values.nussknacker.mode "lite-k8s" -}} LiteStreamMetaData -{{- else if eq .Values.nussknacker.mode "request-response" -}} -RequestResponseMetaData {{- end -}} {{- end -}} diff --git a/src/templates/configmap.yaml b/src/templates/configmap.yaml index 390c6397..f78931f7 100644 --- a/src/templates/configmap.yaml +++ b/src/templates/configmap.yaml @@ -14,14 +14,14 @@ data: scenarioTypes { {{- if .Values.nussknacker.useDefaultScenarioType }} - "default": { + {{- if .Values.nussknacker.streaming.enabled }} + "streaming": { category: "Default" {{- if eq .Values.nussknacker.mode "flink" }} deploymentConfig: { type: "flinkStreaming" {{- /* Find easier way of passing it through values */}} restUrl: "{{ include "nussknacker.flinkJobManagerUrl" . }}" - queryableStateProxyUrl: "{{ include "nussknacker.flinkTaskManagerUrl" . }}" } {{ tpl (.Values.nussknacker.flinkConfig | mustToJson) . }} {{- else if eq .Values.nussknacker.mode "ververica" }} deploymentConfig: { @@ -32,10 +32,10 @@ data: remoteSyslogPort: {{ .Values.nussknacker.ververica.remoteSyslogPort }} engineVersion: {{ .Values.nussknacker.ververica.engineVersion | quote }} } - {{- else if or (eq .Values.nussknacker.mode "streaming-lite") (eq .Values.nussknacker.mode "request-response") }} + {{- else if eq .Values.nussknacker.mode "lite-k8s" }} deploymentConfig: { type: "lite-k8s" - mode: {{ .Values.nussknacker.mode | replace "-lite" "" }} + mode: "streaming" {{- if .Values.nussknacker.k8sDeploymentConfig }} k8sDeploymentConfig: {{- tpl ( mustToJson .Values.nussknacker.k8sDeploymentConfig ) . }} {{- end }} @@ -43,12 +43,6 @@ data: dockerImageName: {{- .Values.nussknacker.runtimeImage.repository }} dockerImageTag: {{- .Values.nussknacker.runtimeImage.tag }} {{- end }} - {{- if eq .Values.nussknacker.mode "request-response" }} - servicePort: {{ .Values.nussknacker.requestResponse.servicePort }} - {{- if .Values.nussknacker.requestResponse.ingress.enabled }} - ingress: {{- tpl ( mustToJson .Values.nussknacker.requestResponse.ingress ) . }} - {{- end}} - {{- end }} {{- if .Values.prometheusMetrics.enabled }} prometheusMetrics: { enabled: true @@ -80,7 +74,7 @@ data: {{- end }} modelConfig: { - classPath: {{ include "nussknacker.modelClassPath" . }} + classPath: {{ include "nussknacker.streaming.modelClassPath" . }} {{- if and (eq .Values.nussknacker.mode "flink") (not .Values.nussknacker.skipKafkaConfig ) }} components.kafka.config { kafkaProperties { @@ -94,7 +88,7 @@ data: rocksDB { enable: true } - {{- else if and (eq .Values.nussknacker.mode "streaming-lite") (not .Values.nussknacker.skipKafkaConfig ) }} + {{- else if not .Values.nussknacker.skipKafkaConfig }} kafka { kafkaProperties { "bootstrap.servers": "{{ include "nussknacker.kafkaBootstrapServers" . }}" @@ -107,6 +101,59 @@ data: {{- end }} }{{- tpl ( mustToJson .Values.nussknacker.modelConfig ) . }} } + {{- end }} + {{- if and (.Values.nussknacker.requestResponse.enabled) (eq .Values.nussknacker.mode "lite-k8s") }} + "request-response": { + category: "Default" + + deploymentConfig: { + type: "lite-k8s" + mode: "request-response" + {{- if .Values.nussknacker.k8sDeploymentConfig }} + k8sDeploymentConfig: {{- tpl ( mustToJson .Values.nussknacker.k8sDeploymentConfig ) . }} + {{- end }} + {{- if .Values.nussknacker.runtimeImage }} + dockerImageName: {{- .Values.nussknacker.runtimeImage.repository }} + dockerImageTag: {{- .Values.nussknacker.runtimeImage.tag }} + {{- end }} + servicePort: {{ .Values.nussknacker.requestResponse.servicePort }} + {{- if .Values.nussknacker.requestResponse.ingress.enabled }} + ingress: {{- tpl ( mustToJson .Values.nussknacker.requestResponse.ingress ) . }} + {{- end }} + {{- if .Values.prometheusMetrics.enabled }} + prometheusMetrics: { + enabled: true + port: {{ .Values.prometheusMetrics.port }} + } + {{- end }} + {{- if .Values.nussknacker.scalingConfig }} + scalingConfig: {{- tpl ( mustToJson .Values.nussknacker.scalingConfig ) . }} + {{- end }} + nussknackerInstanceName: ${?HELM_RELEASE_NAME} + logbackConfigPath: ${?RUNTIME_LOGBACK_FILE} + {{- with .Values.runtimeCommonConfigMapForLogback }} + commonConfigMapForLogback: {{ . }} + {{- end }} + configExecutionOverrides: { + {{- if .Values.influxdb.enabled }} + metrics { + environment: ${environment}, + influx { + url: "{{ include "nussknacker.influxUrl" .}}/write", + database: "nussknacker" + username: ${INFLUXDB_USER} + password: ${INFLUXDB_PASSWORD} + } + } + {{- end }} + }{{- tpl ( mustToJson .Values.nussknacker.configExecutionOverrides ) . }} + } + + modelConfig: { + classPath: {{ include "nussknacker.requestResponse.modelClassPath" . }} + } + } + {{- end }} {{- end }} } @@ -117,7 +164,15 @@ data: {{- if .Values.grafana.enabled }} metricsSettings: { url: "{{ include "nussknacker.grafanaUrl" .}}/d/$dashboard?theme=dark&var-scenarioName=$scenarioName&var-env="${environment} - defaultDashboard: "{{ include "nussknacker.defaultDashboard" .}}" + defaultDashboard: "" + scenarioTypeToDashboard: { + {{- if .Values.nussknacker.streaming.enabled }} + "streaming": "{{ include "nussknacker.streaming.dashboard" .}}" + {{- end }} + {{- if and (.Values.nussknacker.requestResponse.enabled) (eq .Values.nussknacker.mode "lite-k8s") }} + "request-response": "{{ .Values.nussknacker.requestResponse.dashboard }}" + {{- end }} + } } {{- end }} diff --git a/src/templates/tests/test-job.yaml b/src/templates/tests/test-job.yaml index 22587814..2d5e122a 100644 --- a/src/templates/tests/test-job.yaml +++ b/src/templates/tests/test-job.yaml @@ -23,9 +23,10 @@ spec: - /usr/local/bin/bats args: - -t - {{- if eq .Values.nussknacker.mode "request-response" }} + {{- if and (.Values.nussknacker.requestResponse.enabled) (eq .Values.nussknacker.mode "lite-k8s") }} - //suites/rr-only.bats - {{- else }} + {{- end }} + {{- if .Values.nussknacker.streaming.enabled }} - //suites/kafka-only.bats {{- end }} env: @@ -37,14 +38,12 @@ spec: value: {{ .Release.Name }} - name: KAFKA_BOOTSTRAP_SERVER value: "{{ include "nussknacker.kafkaBootstrapServers" . }}" - - name: SCENARIO_TYPE - value: "{{ include "nussknacker.scenarioType" . }}" + - name: STREAMING_SCENARIO_TYPE + value: "{{ include "nussknacker.streamingScenarioType" . }}" - name: SCHEMA_REGISTRY_URL value: "{{ include "nussknacker.schemaRegistryUrl" . }}" - {{- if eq .Values.nussknacker.mode "request-response" }} - - name: SCENARIO_URL + - name: RR_SCENARIO_INPUT_URL value: "http://{{ .Release.Name }}-test-scenario-for-rr-only:{{ .Values.nussknacker.requestResponse.servicePort }}" - {{- end }} volumeMounts: - name: suites mountPath: /suites diff --git a/src/values.yaml b/src/values.yaml index a1b662ca..7f67f78c 100644 --- a/src/values.yaml +++ b/src/values.yaml @@ -145,9 +145,6 @@ nussknacker: configFile: /etc/nussknacker/application.conf flinkConfig: jobManagerTimeout: "1m" - #Have to be provided if Flink not enabled - #restUrl: - #queryableStateProxyUrl: useDefaultScenarioType: true modelConfig: {} configExecutionOverrides: {} @@ -161,7 +158,11 @@ nussknacker: usageStatisticsReports: true usageStatisticsReportsFingerprint: ~ usageStatisticsReportsSource: "helmchart" + streaming: + enabled: true requestResponse: + enabled: true + dashboard: "nussknacker-request-response-scenario" servicePort: 80 ingress: enabled: true