From 38b4167f6139b8746ba28e7e28b61f2bd6783eac Mon Sep 17 00:00:00 2001 From: Miles-Garnsey Date: Mon, 30 Jan 2023 16:15:44 +1100 Subject: [PATCH] Fix mount path for config file. --- controllers/k8ssandra/cassandra_metrics_agent_test.go | 3 ++- pkg/telemetry/cassandra_agent/cassandra_agent_config.go | 3 ++- pkg/telemetry/cassandra_agent/cassandra_agent_config_test.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/controllers/k8ssandra/cassandra_metrics_agent_test.go b/controllers/k8ssandra/cassandra_metrics_agent_test.go index c59b0629d..aa6dd7e8e 100644 --- a/controllers/k8ssandra/cassandra_metrics_agent_test.go +++ b/controllers/k8ssandra/cassandra_metrics_agent_test.go @@ -2,9 +2,10 @@ package k8ssandra import ( "context" + "testing" + "github.com/k8ssandra/k8ssandra-operator/pkg/cassandra" "github.com/stretchr/testify/assert" - "testing" cassdcapi "github.com/k8ssandra/cass-operator/apis/cassandra/v1beta1" api "github.com/k8ssandra/k8ssandra-operator/apis/k8ssandra/v1alpha1" diff --git a/pkg/telemetry/cassandra_agent/cassandra_agent_config.go b/pkg/telemetry/cassandra_agent/cassandra_agent_config.go index e3580203d..230fafdc9 100644 --- a/pkg/telemetry/cassandra_agent/cassandra_agent_config.go +++ b/pkg/telemetry/cassandra_agent/cassandra_agent_config.go @@ -137,7 +137,8 @@ func (c Configurator) AddStsVolumes(dc *cassdcapi.CassandraDatacenter) error { func(c *corev1.Container) { vm := corev1.VolumeMount{ Name: "metrics-agent-config", - MountPath: filepath.Base(filepath.Dir(agentConfigLocation)), + MountPath: agentConfigLocation, + SubPath: filepath.Base(agentConfigLocation), } c.VolumeMounts = append(c.VolumeMounts, vm) }) diff --git a/pkg/telemetry/cassandra_agent/cassandra_agent_config_test.go b/pkg/telemetry/cassandra_agent/cassandra_agent_config_test.go index 43fcec3d9..be861eb63 100644 --- a/pkg/telemetry/cassandra_agent/cassandra_agent_config_test.go +++ b/pkg/telemetry/cassandra_agent/cassandra_agent_config_test.go @@ -104,7 +104,8 @@ func Test_AddStsVolumes(t *testing.T) { } expectedVm := corev1.VolumeMount{ Name: "metrics-agent-config", - MountPath: filepath.Base(filepath.Dir(agentConfigLocation)), + MountPath: agentConfigLocation, + SubPath: filepath.Base(agentConfigLocation), } assert.Contains(t, dc.Spec.PodTemplateSpec.Spec.Containers[cassContainer].VolumeMounts, expectedVm) }