Skip to content

Commit

Permalink
[NU-2048] [NU-2048] Request-response enabled by default for both flin…
Browse files Browse the repository at this point in the history
…k and kafka. Global "mode" values replaced by "streaming.deploymentMode" (#177)
  • Loading branch information
arkadius authored Feb 27, 2025
1 parent 606663e commit 1c2e7d2
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 130 deletions.
43 changes: 9 additions & 34 deletions .github/workflows/helm-test-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
name: helm-build
path: "dist/${{env.NAME}}-${{steps.setVersion.outputs.version}}.tgz"
test-flink:
name: test flink mode
name: test flink streaming deployment mode
runs-on: ubuntu-latest
needs: [ build ]
steps:
Expand All @@ -84,8 +84,8 @@ jobs:
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-kafka-config.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12"
- name: helmTestRelease
run: ./test.sh "${{env.RELEASE_NAME}}"
test-streaming-lite-postgres:
name: test streaming-lite mode postgres
test-lite-postgres:
name: test lite-k8s streaming deployment mode postgres
runs-on: ubuntu-latest
needs: [ build ]
steps:
Expand All @@ -106,11 +106,11 @@ jobs:
id: setNussknackerVersion
run: '[[ $GITHUB_REF == refs/heads/release-* || $GITHUB_REF == refs/tags/release-* ]] && version=${GITHUB_REF##*/release-} && echo "Using version based on release branch/tag name: $version" && echo "nuVersion=$version" >> $GITHUB_OUTPUT || (echo "Using default version" && echo "nuVersion=${{env.NUSSKNACKER_VERSION}}" >> $GITHUB_OUTPUT)'
- name: helmUpgrade
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-kafka-config.yaml -f deploy-values-streaming-lite.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12"
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-kafka-config.yaml -f deploy-values-lite.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12"
- name: helmTestRelease
run: ./test.sh "${{env.RELEASE_NAME}}"
test-streaming-lite-hsql:
name: test streaming-lite mode hsql
test-lite-hsql:
name: test lite-k8s streaming deployment hsql
runs-on: ubuntu-latest
needs: [ build ]
steps:
Expand All @@ -133,41 +133,16 @@ jobs:
--wait --debug \
-f deploy-values.yaml \
-f deploy-values-kafka-config.yaml \
-f deploy-values-streaming-lite.yaml \
-f deploy-values-lite.yaml \
-f deploy-values-db-hsql.yaml \
--set "image.tag=${{env.NUSSKNACKER_VERSION}}"
- name: helmTestRelease
run: ./test.sh "${{env.RELEASE_NAME}}"
test-request-response:
name: test request-response mode
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: helm-build
path: dist
- uses: AbsaOSS/k3d-action@v2.4.0
with:
cluster-name: "k3s-default"
k3d-version: "v5.6.0"
args: >-
--config=.k3d/single-cluster.yml
--trace
- name: Set Nussknacker image version
id: setNussknackerVersion
run: '[[ $GITHUB_REF == refs/heads/release-* || $GITHUB_REF == refs/tags/release-* ]] && version=${GITHUB_REF##*/release-} && echo "Using version based on release branch/tag name: $version" && echo "nuVersion=$version" >> $GITHUB_OUTPUT || (echo "Using default version" && echo "nuVersion=${{env.NUSSKNACKER_VERSION}}" >> $GITHUB_OUTPUT)'
- name: helmUpgrade
run: helm upgrade -i "${{env.RELEASE_NAME}}" dist/*.tgz --version "${{needs.build.outputs.version}}" --wait --debug -f deploy-values.yaml -f deploy-values-request-response.yaml --set "image.tag=${{steps.setNussknackerVersion.outputs.nuVersion}}_scala-2.12"
- name: helmTestRelease
run: ./test.sh "${{env.RELEASE_NAME}}"
publish-snapshot:
name: publish-snapshot
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.head_ref, 'preview/') }}
runs-on: ubuntu-latest
needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ]
needs: [ build, test-flink, test-lite-postgres, test-lite-hsql ]
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -178,7 +153,7 @@ jobs:
name: publish-release
if: ${{ startsWith(github.ref, 'refs/tags') }}
runs-on: ubuntu-latest
needs: [ build, test-flink, test-streaming-lite-postgres, test-streaming-lite-hsql, test-request-response ]
needs: [ build, test-flink, test-lite-postgres, test-lite-hsql ]
steps:
- uses: actions/download-artifact@v4
with:
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ By default, the script uses `deploy-values.yaml`, you can add
other files appending `-f [path]` as many times as needed.

Dev samples:
- `./build-deploy-verify.sh release-name` - deploy chart in flink mode
- `./build-deploy-verify.sh release-name -f deploy-values-streaming-lite.yaml` - deploy chart in streaming-lite mode
- `./build-deploy-verify.sh release-name` - deploy chart with streaming using flink deployment mode
- `./build-deploy-verify.sh release-name -f deploy-values-lite.yaml` - deploy chart with streaming using lite-k8s deployment mode

Examples:
- `./build-deploy-verify.sh release-name -f deploy-values-streaming-lite.yaml -f examples/customComponents/custom-component-docker-values.yaml` - deploy chart in streaming-lite mode, with custom image (see description in `custom-component-docker-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-streaming-lite.yaml -f examples/customComponents/custom-component-url-values.yaml` - deploy chart in streaming-lite mode, with custom component URL (see description in `custom-component-url-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-streaming-lite.yaml -f examples/customSecret/custom-secret-values.yaml` - deploy chart in streaming-lite mode, passing secret to both designer and runtime container (see description in `custom-secret-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-streaming-lite.yaml -f examples/custom-logging.yaml` - deploy chart in streaming-lite mode with custom logging configuration of the designer and runtime containers (see description in `custom-logging.yaml`)
- `./build-deploy-verify.sh release-name -f examples/customConfig/custom-conf-values.yaml` - deploy chart in streaming-lite mode with additional config map with custom application.conf configuration of the designer
- `./build-deploy-verify.sh release-name -f deploy-values-lite.yaml -f examples/customComponents/custom-component-docker-values.yaml` - deploy chart with streaming using lite-k8s deployment mode, with custom image (see description in `custom-component-docker-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-lite.yaml -f examples/customComponents/custom-component-url-values.yaml` - deploy chart with streaming using lite-k8s deployment mode, with custom component URL (see description in `custom-component-url-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-lite.yaml -f examples/customSecret/custom-secret-values.yaml` - deploy chart with streaming using lite-k8s deployment mode, passing secret to both designer and runtime container (see description in `custom-secret-values.yaml`)
- `./build-deploy-verify.sh release-name -f deploy-values-lite.yaml -f examples/custom-logging.yaml` - deploy chart with streaming using lite-k8s deployment mode with custom logging configuration of the designer and runtime containers (see description in `custom-logging.yaml`)
- `./build-deploy-verify.sh release-name -f examples/customConfig/custom-conf-values.yaml` - deploy chart with streaming using lite-k8s deployment mode with additional config map with custom application.conf configuration of the designer

### Rendering helm locally
To check how helm is rendered with default values, you can execute helm this way in root directory:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ flink:
enabled: false

nussknacker:
mode: "lite-k8s"
streaming:
deploymentMode: "lite-k8s"

telegraf:
enabled: false
Expand All @@ -18,3 +19,4 @@ kafka:
enabled: true
externalZookeeper:
servers: []

22 changes: 0 additions & 22 deletions deploy-values-request-response.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions deploy-values-streaming-lite.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#This configuration shows how to use custom images for lite-k8s mode (for Flink mode you only have to configure image.repository)
#This configuration shows how to use custom images for Lite engine (for Flink 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
2 changes: 1 addition & 1 deletion examples/customComponents/custom-component-url-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#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 configuration shows how to use custom components/libs by custom URL for Lite engine (for Flink engine 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:
Expand Down
3 changes: 2 additions & 1 deletion examples/customConfig/custom-conf-values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#This configuration shows how to run NU designer using configuration from external file provided from configmap
nussknacker:
mode: "lite-k8s"
streaming:
mode: "lite-k8s"
configFile: /etc/nussknacker/application.conf,/etc/nussknacker/extra/extra-application.conf

additionalVolumes:
Expand Down
3 changes: 2 additions & 1 deletion examples/customSecret/custom-secret-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ extraEnv:
name: 'nussknacker-secrets'
key: OPEN_API_KEY
nussknacker:
mode: "lite-k8s"
streaming:
mode: "lite-k8s"
k8sDeploymentConfig:
spec:
template:
Expand Down
30 changes: 16 additions & 14 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,18 @@ provided outside. The table below lists components and their roles
| Flink | Runtime for Nussknacker jobs | true |
| Telegraf | Relay passing metrics from Flink to InfluxDB | true |

Modes
Streaming deployment modes
-----

The `mode` configuration variable is used to set up the engine. To read more about engines see [Documentation](https://nussknacker.io/documentation/docs/about/engines).
The `streaming.deploymentMode` configuration variable is used to set up the deployment mode used for streaming processing mode.
To read more about engines see [Documentation](https://nussknacker.io/documentation/docs/about/engines).

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`:
By default, the chart runs Nussknacker in `flink` deployment mode for streaming which deploys streaming scenarios to Flink engine (either installed directly by the chart, or external one).
It is also possible to deploy Nussknacker scenarios on K8s when `lite-k8s` deployment mode for streaming is configured. You will need to manually adjust values of the following variables if you use this `deploymentMode`:
```
nussknacker:
mode: lite-k8s
streaming:
deploymentMode: lite-k8s
flink:
enable: false
telegraf:
Expand All @@ -85,7 +87,6 @@ zookeeper:
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: lite-k8s
streaming:
enabled: false
flink:
Expand Down Expand Up @@ -126,8 +127,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 `lite-k8s` mode
- `requestResponse` - here you can specify `servicePort` and `ingress` configuration for deployed scenarios on k8s when running in `lite-k8s` mode
- `k8sDeploymentConfig` - here you can specify your own k8s runtime deployment yaml config. it is applicable for request-response and for streaming in `lite-k8s` deployment mode
- `requestResponse` - here you can specify `servicePort` and `ingress` configuration for deployed scenarios on k8s

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 All @@ -149,7 +150,7 @@ Using your own components/image
By default, this chart is installed with the official Nussknacker image, which contains generic components:

- integration with Kafka and Confluent Schema Registry
- base aggregations (accessible only in flink mode)
- base aggregations (accessible only in flink streaming deployment mode)

Should you need to run Nussknacker with your own components/customizations, the best way is to create an image based on the official one and
install the chart with appropriate image configuration. Please note that when using Lite engine you also have to create image of Lite runtime with
Expand All @@ -164,7 +165,7 @@ image:
repository: nussknacker-sample-components
tag: 1.15
```
For flink mode, only `image.repository` configuration is needed, as Designer itself prepares fatjar with dependencies of the Flink job.
For `flink` streaming deployment mode, only `image.repository` configuration is needed, as Designer itself prepares fatjar with dependencies of the Flink job.

Other way of installing custom components is direct configuration of classpath, adding URL accessible in the K8s cluster. Below sample
configuration adding additional JDBC driver for [SQL enrichers](https://docs.nussknacker.io/documentation/docs/scenarios_authoring/Enrichers#sql-enricher):
Expand All @@ -185,7 +186,7 @@ nussknacker:
configExecutionOverrides:
modelClassPath: *streamingModelClassPath
```
Again, for `flink` mode it's only necessary to set `streamingModelClassPath`.
Again, for `flink` streaming deployment mode it's only necessary to set `streamingModelClassPath`.

Security/RBAC
-------------
Expand Down Expand Up @@ -229,9 +230,9 @@ The chart comes with the following monitoring components:

- Influxdb
- Grafana
- Telegraf (used in flink mode)
- Telegraf (used in flink streaming deployment mode)

In the `flink` mode, the metrics from Nussknacker are exposed via Prometheus interface. They are read (and preprocessed)
In the `flink` streaming deployment mode, the metrics from Nussknacker are exposed via Prometheus interface. They are read (and preprocessed)
with Telegraf and sent to InfluxDB. When using the Lite engine, the metrics are sent directly from pods running scenarios to InfluxDB.
Grafana with a predefined dashboard is used to visualize process data in Nussknacker.

Expand Down Expand Up @@ -284,7 +285,8 @@ You can deploy configMap/secret on your own using, or use special `extraDeploy`
Example:
```
nussknacker:
mode: "lite-k8s"
streaming:
deploymentMode: "lite-k8s"
configFile: /etc/nussknacker/application.conf,/etc/nussknacker/extra/extra-application.conf
additionalVolumes:
Expand Down
Loading

0 comments on commit 1c2e7d2

Please sign in to comment.