From 275a0f974764406c7dd36a10588ade8da0fc7cb7 Mon Sep 17 00:00:00 2001 From: Damir Nugmanov Date: Sun, 29 Oct 2023 12:25:17 +0600 Subject: [PATCH] Propagate cluster_name to cassandra.yaml --- pkg/config/builder.go | 1 + pkg/config/builder_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/pkg/config/builder.go b/pkg/config/builder.go index b74bbc1..e3c3228 100644 --- a/pkg/config/builder.go +++ b/pkg/config/builder.go @@ -471,6 +471,7 @@ func k8ssandraOverrides(merged map[string]interface{}, configInput *ConfigInput, delete(merged, "broadcast_address") // Sets it to the same as listen_address merged["broadcast_rpc_address"] = nodeInfo.BroadcastIP merged["endpoint_snitch"] = "GossipingPropertyFileSnitch" + merged["cluster_name"] = configInput.ClusterInfo.Name return merged } diff --git a/pkg/config/builder_test.go b/pkg/config/builder_test.go index abcdea6..ee51466 100644 --- a/pkg/config/builder_test.go +++ b/pkg/config/builder_test.go @@ -210,6 +210,9 @@ func TestCassandraYamlWriting(t *testing.T) { } // Verify our k8ssandra overrides are set + clusterName := configInput.ClusterInfo.Name + require.Equal(clusterName, cassandraYaml["cluster_name"]) + seedProviders := cassandraYaml["seed_provider"].([]interface{}) seedProvider := seedProviders[0].(map[string]interface{}) require.Equal("org.apache.cassandra.locator.K8SeedProvider", seedProvider["class_name"])