Skip to content

Commit

Permalink
[NU-1069] streaming-lite and request-response mode replaced by one, l…
Browse files Browse the repository at this point in the history
…ite-k8s mode
  • Loading branch information
arkadius committed Mar 1, 2024
1 parent b6b1f4d commit 5f5383d
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 61 deletions.
6 changes: 4 additions & 2 deletions deploy-values-request-response.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions deploy-values-streaming-lite.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion deploy-values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image:
tag: staging-latest_scala-2.12
tag: release_1.14-latest_scala-2.12
pullPolicy: Always

imagePullSecrets:
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
19 changes: 10 additions & 9 deletions examples/customComponents/custom-component-url-values.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -25,5 +26,5 @@ nussknacker:
scenarioTypes:
default:
deploymentConfig:
configExecutionOverrides:
modelClassPath: *modelClassPath
configExecutionOverrides:
modelClassPath: *streamingModelClassPath
2 changes: 1 addition & 1 deletion examples/customConfig/custom-conf-values.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion examples/customSecret/custom-secret-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extraEnv:
name: 'nussknacker-secrets'
key: OPEN_API_KEY
nussknacker:
mode: "streaming-lite"
mode: "lite-k8s"
k8sDeploymentConfig:
spec:
template:
Expand Down
40 changes: 22 additions & 18 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
-------------
Expand Down Expand Up @@ -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:
Expand Down
38 changes: 24 additions & 14 deletions src/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" -}}
{
Expand All @@ -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 -}}
Expand Down
80 changes: 68 additions & 12 deletions src/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -32,23 +33,17 @@ 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 }}
{{- if .Values.nussknacker.runtimeImage }}
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
Expand Down Expand Up @@ -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 {
Expand All @@ -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" . }}"
Expand All @@ -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 }}
}
Expand All @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions src/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f5383d

Please sign in to comment.