From a560a01960e09c0106f427b76013b1adc75e486c Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Mon, 2 Sep 2024 15:25:42 +0200 Subject: [PATCH] feat: configure starter app Extend starter values, such that we can better configure the starter application. New configuration allows to configure: * The bpmnModelPath which is used to read the main process model that is deployed on start up * The extra bpmn models which can be configured to add additional models * The business key, to add an unique identifier for each process instance with given var name * The payload path to configure with which payload the instances are created --- charts/zeebe-benchmark/templates/starter.yaml | 16 +++++- .../test/golden/starter-extended.golden.yaml | 52 +++++++++++++++++++ .../test/golden/starter.golden.yaml | 5 +- charts/zeebe-benchmark/test/golden_test.go | 26 ++++++++++ charts/zeebe-benchmark/values.yaml | 12 +++++ 5 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 charts/zeebe-benchmark/test/golden/starter-extended.golden.yaml diff --git a/charts/zeebe-benchmark/templates/starter.yaml b/charts/zeebe-benchmark/templates/starter.yaml index abfcdeb..b6571c2 100644 --- a/charts/zeebe-benchmark/templates/starter.yaml +++ b/charts/zeebe-benchmark/templates/starter.yaml @@ -27,9 +27,23 @@ spec: -Dapp.starter.rate={{ .Values.starter.rate }} -Dapp.starter.durationLimit=0 -Dzeebe.client.requestTimeout=62000 + {{- if .Values.starter.bpmnXmlPath }} + -Dapp.starter.bpmnXmlPath= {{ .Values.starter.bpmnXmlPath | quote }} + {{- end }} + {{- if .Values.starter.extraResources }} + -Dapp.starter.extraBpmnModels=[{{ join "," .Values.starter.extraResources }}] + {{- end }} + {{- if .Values.starter.businessKey }} + -Dapp.starter.businessKey={{ .Values.starter.businessKey | quote }} + {{- end }} + {{- if .Values.starter.payloadPath }} + -Dapp.starter.payloadPath={{ .Values.starter.payloadPath | quote }} + {{- end }} -XX:+HeapDumpOnOutOfMemoryError + {{- if .Values.starter.logLevel }} - name: LOG_LEVEL - value: "warn" + value: {{ .Values.starter.logLevel | quote }} + {{- end }} envFrom: - configMapRef: name: starter-config diff --git a/charts/zeebe-benchmark/test/golden/starter-extended.golden.yaml b/charts/zeebe-benchmark/test/golden/starter-extended.golden.yaml new file mode 100644 index 0000000..1b03734 --- /dev/null +++ b/charts/zeebe-benchmark/test/golden/starter-extended.golden.yaml @@ -0,0 +1,52 @@ +--- +# Source: zeebe-benchmark/templates/starter.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: starter + labels: + app: starter +spec: + selector: + matchLabels: + app: starter + replicas: 1 + template: + metadata: + labels: + app: starter + app.kubernetes.io/component: zeebe-client + spec: + containers: + - name: starter + image: "gcr.io/zeebe-io/starter:SNAPSHOT" + imagePullPolicy: Always + env: + - name: JDK_JAVA_OPTIONS + value: >- + -Dconfig.override_with_env_vars=true + -Dapp.brokerUrl=benchmark-test-zeebe-gateway:26500 + -Dapp.starter.rate=150 + -Dapp.starter.durationLimit=0 + -Dzeebe.client.requestTimeout=62000 + -Dapp.starter.bpmnXmlPath= "bpmn/real.bpmn" + -Dapp.starter.extraBpmnModels=[bpmn/extra.bpmn,bpmn/extra.dmn] + -Dapp.starter.businessKey="customerId" + -Dapp.starter.payloadPath="empty.json" + -XX:+HeapDumpOnOutOfMemoryError + - name: LOG_LEVEL + value: "INFO" + envFrom: + - configMapRef: + name: starter-config + optional: true + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 250m + memory: 256Mi + ports: + - containerPort: 9600 + name: "http" \ No newline at end of file diff --git a/charts/zeebe-benchmark/test/golden/starter.golden.yaml b/charts/zeebe-benchmark/test/golden/starter.golden.yaml index 32c70ad..1a17ecd 100644 --- a/charts/zeebe-benchmark/test/golden/starter.golden.yaml +++ b/charts/zeebe-benchmark/test/golden/starter.golden.yaml @@ -29,9 +29,12 @@ spec: -Dapp.starter.rate=150 -Dapp.starter.durationLimit=0 -Dzeebe.client.requestTimeout=62000 + -Dapp.starter.bpmnXmlPath= "bpmn/one_task.bpmn" + -Dapp.starter.businessKey="businessKey" + -Dapp.starter.payloadPath="bpmn/big_payload.json" -XX:+HeapDumpOnOutOfMemoryError - name: LOG_LEVEL - value: "warn" + value: "WARN" envFrom: - configMapRef: name: starter-config diff --git a/charts/zeebe-benchmark/test/golden_test.go b/charts/zeebe-benchmark/test/golden_test.go index 7bbc410..f83a365 100644 --- a/charts/zeebe-benchmark/test/golden_test.go +++ b/charts/zeebe-benchmark/test/golden_test.go @@ -52,3 +52,29 @@ func TestGoldenWorkers(t *testing.T) { }) } } + +func TestGoldenExtendedStarter(t *testing.T) { + chartPath, err := filepath.Abs("../") + require.NoError(t, err) + templateNames := []string{"starter"} + + values := map[string]string{ + "starter.logLevel": "INFO", + "starter.payloadPath": "empty.json", + "starter.bpmnXmlPath": "bpmn/real.bpmn", + "starter.extraResources[0]": "bpmn/extra.bpmn", + "starter.extraResources[1]": "bpmn/extra.dmn", + "starter.businessKey": "customerId", + } + + for _, name := range templateNames { + suite.Run(t, &golden.TemplateGoldenTest{ + ChartPath: chartPath, + Release: "benchmark-test", + Namespace: "benchmark-" + strings.ToLower(random.UniqueId()), + GoldenFileName: name + "-extended", + Templates: []string{"templates/" + name + ".yaml"}, + SetValues: values, + }) + } +} diff --git a/charts/zeebe-benchmark/values.yaml b/charts/zeebe-benchmark/values.yaml index 2bf3945..aa5d96c 100644 --- a/charts/zeebe-benchmark/values.yaml +++ b/charts/zeebe-benchmark/values.yaml @@ -101,6 +101,18 @@ starter: replicas: 1 # Starter.rate defines with which rate process instances should be created by the starter rate: 150 + # Starter.logLevel defines the logging level for the benchmark starter + logLevel: "WARN" + # Starter.payloadPath defines the path (inside the starter app) to the payload resource + # that should be used to create the corresponding process instance + payloadPath: "bpmn/big_payload.json" + # Starter.bpmnXmlPath defines the path (inside the starter app) to the main bpmn XML resource that should be deployed + bpmnXmlPath: "bpmn/one_task.bpmn" + # Starter.extraBpmnModels can be used to specify paths (inside the starter app) to extra resources that should be deployed + extraResources: [] + # Starter.businessKey can be used to specify a businessKey variable, inside a unique identifier is stored for + # each created process instance + businessKey: "businessKey" # Publisher configuration for the to be deployed publisher application publisher: