From 5f5383d556d902f42659ad83eb33a9f8aeab2675 Mon Sep 17 00:00:00 2001 From: Arek Burdach Date: Fri, 1 Mar 2024 10:35:03 +0100 Subject: [PATCH] [NU-1069] streaming-lite and request-response mode replaced by one, lite-k8s mode --- deploy-values-request-response.yaml | 6 +- deploy-values-streaming-lite.yaml | 6 +- deploy-values.yaml | 2 +- .../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 | 40 +++++----- src/templates/_helpers.tpl | 38 +++++---- src/templates/configmap.yaml | 80 ++++++++++++++++--- src/values.yaml | 4 + 11 files changed, 140 insertions(+), 61 deletions(-) diff --git a/deploy-values-request-response.yaml b/deploy-values-request-response.yaml index befd1ee8..5f5ab133 100644 --- a/deploy-values-request-response.yaml +++ b/deploy-values-request-response.yaml @@ -1,9 +1,11 @@ image: - tag: staging-latest + tag: release_1.14-latest_scala-2.12 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..07513f76 100644 --- a/deploy-values-streaming-lite.yaml +++ b/deploy-values-streaming-lite.yaml @@ -1,12 +1,14 @@ image: - tag: staging-latest + tag: release_1.14-latest_scala-2.12 pullPolicy: Always flink: enabled: false nussknacker: - mode: "streaming-lite" + mode: "lite-k8s" + requestResponse: + enabled: false telegraf: enabled: false diff --git a/deploy-values.yaml b/deploy-values.yaml index 68e7f841..03e132a2 100644 --- a/deploy-values.yaml +++ b/deploy-values.yaml @@ -1,5 +1,5 @@ image: - tag: staging-latest_scala-2.12 + tag: release_1.14-latest_scala-2.12 pullPolicy: Always imagePullSecrets: 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..d4338674 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: ``` 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,7 +123,7 @@ 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 + - `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 `request-response` 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/templates/_helpers.tpl b/src/templates/_helpers.tpl index 0fe8e75a..e4f045aa 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,12 +218,15 @@ nussknacker-request-response-scenario } {{- end -}} +{{/* +TODO: make both streaming.enabled and requestResponse.enabled allowed +*/}} {{- define "nussknacker.scenarioType" -}} {{- if eq .Values.nussknacker.mode "flink" -}} StreamMetaData -{{- else if eq .Values.nussknacker.mode "streaming-lite" -}} +{{- else if and (eq .Values.nussknacker.mode "lite-k8s") (.Values.nussknacker.streaming.enabled) -}} LiteStreamMetaData -{{- else if eq .Values.nussknacker.mode "request-response" -}} +{{- else if and (eq .Values.nussknacker.mode "lite-k8s") (.Values.nussknacker.requestResponse.enabled) -}} RequestResponseMetaData {{- end -}} {{- end -}} diff --git a/src/templates/configmap.yaml b/src/templates/configmap.yaml index 390c6397..2ff19fa1 100644 --- a/src/templates/configmap.yaml +++ b/src/templates/configmap.yaml @@ -14,7 +14,8 @@ data: scenarioTypes { {{- if .Values.nussknacker.useDefaultScenarioType }} - "default": { + {{- if .Values.nussknacker.streaming.enabled }} + "streaming": { category: "Default" {{- if eq .Values.nussknacker.mode "flink" }} deploymentConfig: { @@ -32,10 +33,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 +44,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 +75,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 +89,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 +102,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 +165,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/values.yaml b/src/values.yaml index a1b662ca..3bfbf6bd 100644 --- a/src/values.yaml +++ b/src/values.yaml @@ -161,7 +161,11 @@ nussknacker: usageStatisticsReports: true usageStatisticsReportsFingerprint: ~ usageStatisticsReportsSource: "helmchart" + streaming: + enabled: true requestResponse: + enabled: true + dashboard: "nussknacker-request-response-scenario" servicePort: 80 ingress: enabled: true