helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Adding bitnami mysql (Version:13.0.0) support

Open PhillypHenning opened this issue 6 months ago • 8 comments

Summary

This PR is to complete the feature request - Add support for deploying and using MySQL. It introduces two new charts to meet the requirements of MySQL and MySQL+ElasticSearch.

Changes

  • Added bitname mysql (version:13.0.0) to Chart.yaml dependencies
  • Adding values file for MySQL (Persistence&Visibility), and MySQL+ES
  • Updated README with new instructions

Proof of implementation

As per the ticket, the supported combinations are MySQL for default persistence and visibility, and MySQL for persistence with Elasticsearch for visibility.

Generated ConfigMap - MySQL for persistence & visibility

# Source: temporal/
/server-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: "temporal-config"
  labels:
    app.kubernetes.io/name: temporal
    helm.sh/chart: temporal-0.63.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: temporal
    app.kubernetes.io/version: "1.27.2"
    app.kubernetes.io/part-of: temporal
data:
  config_template.yaml: |-
    persistence:
      defaultStore: default
      visibilityStore: visibility
      datastores:
        default:
          sql:
            pluginName: "mysql8"
            driverName: "mysql8"
            databaseName: "temporal"
            connectAddr: "temporal-mysql:3306"
            connectProtocol: "tcp"
            user: root
            password: {{ .Env.TEMPORAL_STORE_PASSWORD | quote }}
        visibility:
          sql:
            pluginName: "mysql8"
            driverName: "mysql8"
            databaseName: "temporal_visibility"
            connectAddr: "temporal-mysql:3306"
            connectProtocol: "tcp"
            user: "root"
            password: {{ .Env.TEMPORAL_VISIBILITY_STORE_PASSWORD  | quote }}

Generated ConfigMap - MySQL for persistence & ES for visibility

# Source: temporal/templates/server-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: "temporal-config"
  labels:
    app.kubernetes.io/name: temporal
    helm.sh/chart: temporal-0.63.0
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: temporal
    app.kubernetes.io/version: "1.27.2"
    app.kubernetes.io/part-of: temporal
data:
  config_template.yaml: |-
    persistence:
      defaultStore: default
      visibilityStore: visibility
      datastores:
        default:
          sql:
            pluginName: "mysql8"
            driverName: "mysql8"
            databaseName: "temporal"
            connectAddr: "temporal-mysql:3306"
            connectProtocol: "tcp"
            user: root
            password: {{ .Env.TEMPORAL_STORE_PASSWORD | quote }}
        visibility:
          elasticsearch:
            version: "v7"
            url:
                scheme: "http"
                host: "elasticsearch-master-headless:9200"
            username: ""
            password: {{ .Env.TEMPORAL_VISIBILITY_STORE_PASSWORD  | quote }}
            logLevel: "error"
            indices:
                visibility: "temporal_visibility_v1_dev"

Testing

Testing was performed using the Temporal OS omes repo. All test scenarios were ran against both variants of the configuration created.

Test Results for MySQL for persistence & visibility

fixed_resource_consumption

% go run ./cmd run-scenario-with-worker --scenario fixed_resource_consumption --language go;
2025-06-06T09:01:32.292-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-1065769535
2025-06-06T09:01:33.710-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue fixed_resource_consumption:pxqf2azq --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T09:01:34.110-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:01:34.518-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:01:34.972-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:pxqf2azq", "WorkerID": "[email protected]@"}
2025-06-06T09:02:42.128-0400	INFO	loadgen/generic_executor.go:178	Run complete in 1m7.949776042s
2025-06-06T09:02:42.128-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 9872
2025-06-06T09:02:42.128-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:pxqf2azq", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T09:02:42.188-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:pxqf2azq", "WorkerID": "[email protected]@"}

state_transitions_steady

% go run ./cmd run-scenario-with-worker --scenario state_transitions_steady --language go --duration 5m --option state-transitions-per-second=3;
2025-06-06T09:16:04.701-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-3031603792
2025-06-06T09:16:06.074-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue state_transitions_steady:vgk2mp4a --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T09:16:06.449-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:16:06.449-0400	INFO	scenarios/state_transitions_steady.go:45	State transitions per second is 3, which means 333.333333ms between every state transition
2025-06-06T09:16:06.673-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:16:06.876-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "state_transitions_steady:vgk2mp4a", "WorkerID": "[email protected]@"}
2025-06-06T09:16:07.147-0400	INFO	scenarios/state_transitions_steady.go:74	Simple workflow takes 7 state transitions, which means we need to start a workflow every 2.333333331s. Running for 5m0s now...
2025-06-06T09:21:08.149-0400	INFO	scenarios/state_transitions_steady.go:128	Run complete, ran 258 iterations, waiting on all workflows to complete
2025-06-06T09:21:09.343-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 13642
2025-06-06T09:21:09.344-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "state_transitions_steady:vgk2mp4a", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T09:21:09.404-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "state_transitions_steady:vgk2mp4a", "WorkerID": "[email protected]@"}

throughput_stress

% echo '{"patterns_dist": {"type":"discrete", "weights": {"1":1, "5":9}}, "pattern_durations_dist": {"1": {"type":"discrete", "weights": {"1s": 1}}, "5": {"type":"discrete", "weights": {"1s": 1, "5s": 4}}}}' > sleep.json
% go run ./cmd run-scenario-with-worker --scenario throughput_stress --language go --option [email protected] --run-id default-run-id
2025-06-06T09:31:33.477-0400	INFO	loadgen/generic_executor.go:178	Run complete in 3m33.475868458s
2025-06-06T09:31:33.477-0400	INFO	scenarios/throughput_stress.go:170	Total workflows executed: 280
2025-06-06T09:31:33.537-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 14643
2025-06-06T09:31:33.537-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "throughput_stress:default-run-id", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T09:31:33.608-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "throughput_stress:default-run-id", "WorkerID": "[email protected]@"}

workflow_with_many_actions

% go run ./cmd run-scenario-with-worker --scenario workflow_with_many_actions --language go;
2025-06-06T09:37:55.638-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-2047460678
2025-06-06T09:37:57.122-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue workflow_with_many_actions:qdwp5phs --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T09:37:57.594-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:37:57.594-0400	INFO	scenarios/workflow_with_many_actions.go:36	Preparing to run with 30 child workflow(s) and 30 activity execution(s)
2025-06-06T09:37:58.252-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:37:58.536-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:qdwp5phs", "WorkerID": "[email protected]@"}
2025-06-06T09:38:49.043-0400	INFO	loadgen/generic_executor.go:178	Run complete in 51.380558625s
2025-06-06T09:38:49.043-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 15760
2025-06-06T09:38:49.043-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:qdwp5phs", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T09:38:49.113-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:qdwp5phs", "WorkerID": "[email protected]@"}

workflow_with_single_noop_activity

% go run ./cmd run-scenario-with-worker --scenario workflow_with_single_noop_activity --language go
2025-06-06T08:48:12.730-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-3686544606
2025-06-06T08:48:14.219-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue workflow_with_single_noop_activity:as6jnmqj --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T08:48:14.450-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T08:48:14.829-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T08:48:15.031-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:as6jnmqj", "WorkerID": "[email protected]@"}
2025-06-06T08:48:17.559-0400	INFO	loadgen/generic_executor.go:178	Run complete in 3.042990125s
2025-06-06T08:48:17.559-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 8270
2025-06-06T08:48:17.560-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:as6jnmqj", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T08:48:17.625-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:as6jnmqj", "WorkerID": "[email protected]@"}

Test Results for MySQL for persistence & ES for visibility

fixed_resource_consumption

% go run ./cmd run-scenario-with-worker --scenario fixed_resource_consumption --language go;
2025-06-06T09:54:55.621-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-2286845438
2025-06-06T09:54:57.099-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue fixed_resource_consumption:avszkq2x --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T09:54:57.381-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:54:58.239-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T09:54:58.476-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:avszkq2x", "WorkerID": "[email protected]@"}
2025-06-06T09:55:58.058-0400	INFO	loadgen/generic_executor.go:178	Run complete in 1m0.291084333s
2025-06-06T09:55:58.058-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 17923
2025-06-06T09:55:58.058-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:avszkq2x", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T09:55:58.118-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "fixed_resource_consumption:avszkq2x", "WorkerID": "[email protected]@"}

state_transitions_steady

% go run ./cmd run-scenario-with-worker --scenario state_transitions_steady --language go --duration 5m --option state-transitions-per-second=3;
2025-06-06T10:02:21.220-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-1507628765
2025-06-06T10:02:22.626-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue state_transitions_steady:hm2i6rzk --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T10:02:22.909-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:02:22.910-0400	INFO	scenarios/state_transitions_steady.go:45	State transitions per second is 3, which means 333.333333ms between every state transition
2025-06-06T10:02:23.246-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:02:23.461-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "state_transitions_steady:hm2i6rzk", "WorkerID": "[email protected]@"}
2025-06-06T10:02:23.739-0400	INFO	scenarios/state_transitions_steady.go:74	Simple workflow takes 7 state transitions, which means we need to start a workflow every 2.333333331s. Running for 5m0s now...
2025-06-06T10:07:24.767-0400	INFO	scenarios/state_transitions_steady.go:128	Run complete, ran 258 iterations, waiting on all workflows to complete
2025-06-06T10:07:24.888-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 18804
2025-06-06T10:07:24.888-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "state_transitions_steady:hm2i6rzk", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T10:07:24.944-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "state_transitions_steady:hm2i6rzk", "WorkerID": "[email protected]@"}

throughput_stress

% echo '{"patterns_dist": {"type":"discrete", "weights": {"1":1, "5":9}}, "pattern_durations_dist": {"1": {"type":"discrete", "weights": {"1s": 1}}, "5": {"type":"discrete", "weights": {"1s": 1, "5s": 4}}}}' > sleep.json
% go run ./cmd run-scenario-with-worker --scenario throughput_stress --language go --option [email protected] --run-id default-run-id
2025-06-06T10:01:52.922-0400	INFO	loadgen/generic_executor.go:178	Run complete in 3m36.73631425s
2025-06-06T10:01:52.923-0400	INFO	scenarios/throughput_stress.go:170	Total workflows executed: 280
2025-06-06T10:01:52.982-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 18442
2025-06-06T10:01:52.982-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "throughput_stress:default-run-id", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T10:01:53.040-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "throughput_stress:default-run-id", "WorkerID": "[email protected]@"}

workflow_with_many_actions

% go run ./cmd run-scenario-with-worker --scenario workflow_with_many_actions --language go;
2025-06-06T10:09:07.778-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-2193741474
2025-06-06T10:09:09.344-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue workflow_with_many_actions:65s7rrky --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T10:09:09.706-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:09:09.706-0400	INFO	scenarios/workflow_with_many_actions.go:36	Preparing to run with 30 child workflow(s) and 30 activity execution(s)
2025-06-06T10:09:10.074-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:09:10.274-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:65s7rrky", "WorkerID": "[email protected]@"}
2025-06-06T10:09:52.689-0400	INFO	loadgen/generic_executor.go:178	Run complete in 42.934978209s
2025-06-06T10:09:52.689-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 19480
2025-06-06T10:09:52.689-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:65s7rrky", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T10:09:52.752-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "workflow_with_many_actions:65s7rrky", "WorkerID": "[email protected]@"}

workflow_with_single_noop_activity

% go run ./cmd run-scenario-with-worker --scenario workflow_with_single_noop_activity --language go
2025-06-06T10:10:04.513-0400	INFO	cmd/prepare_worker.go:67	Building go program at /Users/philhenning/Documents/temporal/omes/workers/go/omes-temp-362415346
2025-06-06T10:10:06.074-0400	INFO	cmd/run_worker.go:184	Starting worker with command: [./program --task-queue workflow_with_single_noop_activity:h4ea2ghc --server-address localhost:7233 --namespace default --prom-handler-path /metrics --log-level info --log-encoding console]
2025-06-06T10:10:06.355-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:10:06.751-0400	INFO	cmdoptions/client.go:125	Client connected to localhost:7233, namespace: default
2025-06-06T10:10:06.947-0400	INFO	internal/internal_worker.go:1176	Started Worker	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:h4ea2ghc", "WorkerID": "[email protected]@"}
2025-06-06T10:10:09.447-0400	INFO	loadgen/generic_executor.go:178	Run complete in 3.037481958s
2025-06-06T10:10:09.448-0400	INFO	cmd/run_worker.go:203	Sending interrupt to worker, PID: 19616
2025-06-06T10:10:09.448-0400	INFO	internal/internal_worker.go:1243	Worker has been stopped.	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:h4ea2ghc", "WorkerID": "[email protected]@", "Signal": "interrupt"}
2025-06-06T10:10:09.508-0400	INFO	internal/internal_worker.go:1277	Stopped Worker	{"Namespace": "default", "TaskQueue": "workflow_with_single_noop_activity:h4ea2ghc", "WorkerID": "[email protected]@"}

PhillypHenning avatar Jun 06 '25 18:06 PhillypHenning

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 06 '25 18:06 CLAassistant

It shouldn't be required to use custom values beyond mysql.enabled=true. The helpers should make use of the MySQL chart's helpers in order to derive the correct hostname and so forth. The same way that cassandra.enabled currently works. The intent is to allow users to easily bring up a Temporal Service without having to supply a values file.

robholland avatar Jun 10 '25 16:06 robholland

Just for clarity, the intention is to have a user supply mysql.enabled=true from the command-line and have the MySQL instance deploy and connect. Meaning that if they supply

Commands Supplied Result
mysql.enabled=true MySQL for persistence and ES for visibility
mysql.enabled=true && elasticsearch.enabled=false MySQL for persistence and for visibility

Is this interpretation correct?

PhillypHenning avatar Jun 10 '25 18:06 PhillypHenning

Yes, with our current defaults. Specifically, elasticsearch.enabled should take priority for visibility. If that is not true, whatever is used for persistence should be used for visibility.

We will be changing our defaults to have cassandra.enabled=false and elasticsearch.enabled=false soon, and one of the SQL engines will then be used for persistence and visibility by default (which one is not yet decided).

robholland avatar Jun 10 '25 20:06 robholland

I should add, I'm sorry this was not clear enough from the original issue.

robholland avatar Jun 10 '25 20:06 robholland

Updated the _helper to enable command-line control of the MySQL usage.

MySQL for persistence && ElasticSearch for Visibility

helm template temporal ./charts/temporal \
    --set cassandra.enabled=false \
    --set mysql.enabled=true \
    --debug > final.yaml

MySQL for persistence && Visibility

helm template temporal ./charts/temporal \
    --set cassandra.enabled=false \
    --set mysql.enabled=true \
    --set elasticsearch.enabled=false \
    --debug > final.yaml

PhillypHenning avatar Jun 12 '25 14:06 PhillypHenning

helm install temporal ./charts/temporal \
    --set cassandra.enabled=false \
    --set mysql.enabled=true \
    --set elasticsearch.enabled=false

The Temporal Service won't come up because the MySQL configuration in the Temporal configmap doesn't match what the MySQL chart installs. The persistence database hostname is set as "mysql" for example, but the actual servicename the MySQL chart installed as was temporal-mysql.

Helpers like https://github.com/temporalio/helm-charts/blob/main/charts/temporal/templates/_helpers.tpl#L257 need fixing so that these values are set correctly.

robholland avatar Jun 12 '25 16:06 robholland

Added the missing bit in the helpers for mysql and adjusted the values.yaml file as needed.

Got the same results running the omes tests.

LeoDiazL avatar Jun 16 '25 21:06 LeoDiazL

Merged with some adjustments to the README. Thanks!

robholland avatar Aug 04 '25 12:08 robholland