From 85398acd521cdd29f15406b4d93b20f3b58cbccb Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Tue, 7 Jul 2026 15:39:16 +0200 Subject: [PATCH 1/4] kuberesource: add missing volume mount to mysql-client --- internal/kuberesource/sets.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/kuberesource/sets.go b/internal/kuberesource/sets.go index a064c98bd6..5a8df43577 100644 --- a/internal/kuberesource/sets.go +++ b/internal/kuberesource/sets.go @@ -791,7 +791,17 @@ done WithResources( ResourceRequirements(). WithMemoryLimitAndRequest(2000), + ). + WithVolumeMounts( + VolumeMount(). + WithName("dummy"). + WithMountPath("/var/lib/mysql"), ), + ). + WithVolumes( + applycorev1.Volume(). + WithName("dummy"). + WithEmptyDir(applycorev1.EmptyDirVolumeSource().WithMedium(corev1.StorageMediumMemory)), ), ), ), From d3894bfdfacabae4af5f13ef08714656caa221cd Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Tue, 7 Jul 2026 17:35:05 +0200 Subject: [PATCH 2/4] kuberesource: update mysql version The version we're using right now does not support remote access without additional GRANT statements. Updating it fixes the issue, but requires significantly more pull space. --- internal/kuberesource/sets.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/kuberesource/sets.go b/internal/kuberesource/sets.go index 5a8df43577..c98465c208 100644 --- a/internal/kuberesource/sets.go +++ b/internal/kuberesource/sets.go @@ -713,7 +713,7 @@ func MySQL() []any { WithContainers( Container(). WithName("mysql-backend"). - WithImage("docker.io/library/mysql:9.1.0@sha256:0255b469f0135a0236d672d60e3154ae2f4538b146744966d96440318cc822c6"). + WithImage("docker.io/library/mysql:9.7.1@sha256:ad88e1c86cbf12ef52d0a0360cd4b774d22956c5ee9c565645fb019d7aacb6c3"). WithEnv(NewEnvVar("MYSQL_ALLOW_EMPTY_PASSWORD", "1")). WithPorts( ContainerPort(). @@ -728,7 +728,7 @@ func MySQL() []any { ). WithResources( ResourceRequirements(). - WithMemoryLimitAndRequest(2000), + WithMemoryLimitAndRequest(3000), ), ). WithVolumes( @@ -785,12 +785,12 @@ done WithContainers( Container(). WithName("mysql-client"). - WithImage("docker.io/library/mysql:9.1.0@sha256:0255b469f0135a0236d672d60e3154ae2f4538b146744966d96440318cc822c6"). + WithImage("docker.io/library/mysql:9.7.1@sha256:ad88e1c86cbf12ef52d0a0360cd4b774d22956c5ee9c565645fb019d7aacb6c3"). WithEnv(NewEnvVar("MYSQL_ALLOW_EMPTY_PASSWORD", "1")). WithCommand("/bin/sh", "-c", clientCmd). WithResources( ResourceRequirements(). - WithMemoryLimitAndRequest(2000), + WithMemoryLimitAndRequest(3000), ). WithVolumeMounts( VolumeMount(). From ff7085919ff55478f64d5a6276333e962109e3be Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Tue, 7 Jul 2026 20:51:00 +0200 Subject: [PATCH 3/4] kuberesource: add readiness probes for mysql --- internal/kuberesource/sets.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/internal/kuberesource/sets.go b/internal/kuberesource/sets.go index c98465c208..84a910a01d 100644 --- a/internal/kuberesource/sets.go +++ b/internal/kuberesource/sets.go @@ -729,6 +729,16 @@ func MySQL() []any { WithResources( ResourceRequirements(). WithMemoryLimitAndRequest(3000), + ). + WithReadinessProbe( + applycorev1.Probe(). + WithExec( + applycorev1.ExecAction().WithCommand( + "sh", "-c", "mysqladmin ping -h 127.0.0.1 -u root --silent", + ), + ). + WithInitialDelaySeconds(5). + WithPeriodSeconds(5), ), ). WithVolumes( @@ -764,6 +774,7 @@ mysql -h 127.137.0.1 -u root -D my_db -e "CREATE TABLE my_table (id INT NOT NULL while true; do mysql -h 127.137.0.1 -u root -D my_db -e "INSERT INTO my_table (uuid) VALUES (UUID());" mysql -h 127.137.0.1 -u root -D my_db -e "SELECT * FROM my_table;" + touch /done sleep 5; done ` @@ -796,6 +807,16 @@ done VolumeMount(). WithName("dummy"). WithMountPath("/var/lib/mysql"), + ). + WithReadinessProbe( + applycorev1.Probe(). + WithExec( + applycorev1.ExecAction().WithCommand( + "sh", "-c", "test -f /done", + ), + ). + WithInitialDelaySeconds(5). + WithPeriodSeconds(5), ), ). WithVolumes( From 15724fa3c5bfecf4cfbba2d9efbc85bf35d87056 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Tue, 7 Jul 2026 17:36:47 +0200 Subject: [PATCH 4/4] e2e: test mysql --- .../volumestatefulset_test.go | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/e2e/volumestatefulset/volumestatefulset_test.go b/e2e/volumestatefulset/volumestatefulset_test.go index 571ca9fa9c..c95fd2935c 100644 --- a/e2e/volumestatefulset/volumestatefulset_test.go +++ b/e2e/volumestatefulset/volumestatefulset_test.go @@ -30,7 +30,12 @@ func TestVolumeStatefulSet(t *testing.T) { runtimeHandler, err := manifest.RuntimeHandler(platform) require.NoError(t, err) + // We have two resource sets for testing volumes: VolumeStatefulSet and MySQL. The former is + // designed for testing, while the latter is a demo artifact we include in releases. The + // functional tests below mostly use the VolumeStatefulSet, but we include MySQL and some basic + // checks as a smoke test. resources := kuberesource.VolumeStatefulSet() + resources = append(resources, kuberesource.MySQL()...) coordinator := kuberesource.CoordinatorBundle() @@ -95,6 +100,32 @@ func TestVolumeStatefulSet(t *testing.T) { require.NoError(err, "stdout: %s, stderr: %s", stdOut, stdErr) require.Equal("test\n", stdOut) }) + + t.Run("MySQL demo works", func(t *testing.T) { + const ( + mysqlBackend = "mysql-backend" + mysqlClient = "mysql-client" + ) + + require := require.New(t) + + // The MySQL server runs initialization on first boot if the volume is empty, which takes + // a considerable amount of time. Combined with a medium sized image and docker hubs slow + // pull bandwidth, it can take quite some time until the server comes up. + ctx, cancel := context.WithTimeout(t.Context(), ct.FactorPlatformTimeout(5*time.Minute)) + defer cancel() + + require.NoError(ct.Kubeclient.WaitForStatefulSet(ctx, ct.Namespace, mysqlBackend)) + require.NoError(ct.Kubeclient.WaitForDeployment(ctx, ct.Namespace, mysqlClient)) + + pods, err := ct.Kubeclient.PodsFromDeployment(ctx, ct.Namespace, mysqlClient) + require.NoError(err) + require.Len(pods, 1) + command := []string{"/bin/sh", "-c", `mysql -h 127.137.0.1 -u root -D my_db -e "SELECT * FROM my_table;"`} + stdout, stderr, err := ct.Kubeclient.ExecRetry(ctx, ct.Namespace, pods[0].Name, mysqlClient, command, time.Second) + require.NoErrorf(err, "mysql command failed - stderr:\n%s", stderr) + require.Contains(stdout, "uuid") + }) } func TestMain(m *testing.M) {