diff --git a/pkg/medusa/reconcile.go b/pkg/medusa/reconcile.go index ebae372f6..bdf17aa2b 100644 --- a/pkg/medusa/reconcile.go +++ b/pkg/medusa/reconcile.go @@ -122,7 +122,6 @@ func CreateMedusaIni(kc *k8ss.K8ssandraCluster, dcConfig *cassandra.DatacenterCo level = DEBUG [kubernetes] - cassandra_url = http://127.0.0.1:8080/api/v0/ops/node/snapshots use_mgmt_api = 1 enabled = 1` @@ -141,9 +140,13 @@ func CreateMedusaIni(kc *k8ss.K8ssandraCluster, dcConfig *cassandra.DatacenterCo // Create Kubernetes config here and append it if dcConfig.ManagementApiAuth != nil && dcConfig.ManagementApiAuth.Manual != nil { medusaConfiig += ` - ca_cert = /etc/encryption/mgmt/ca.crt - tls_cert = /etc/encryption/mgmt/tls.crt - tls_key = /etc/encryption/mgmt/tls.key` + cassandra_url = https://127.0.0.1:8080/api/v0/ops/node/snapshots + ca_cert = /etc/encryption/mgmt/ca.crt + tls_cert = /etc/encryption/mgmt/tls.crt + tls_key = /etc/encryption/mgmt/tls.key` + } else { + medusaConfiig += ` + cassandra_url = http://127.0.0.1:8080/api/v0/ops/node/snapshots` } return medusaConfiig diff --git a/pkg/medusa/reconcile_test.go b/pkg/medusa/reconcile_test.go index 372555791..e55f2abd7 100644 --- a/pkg/medusa/reconcile_test.go +++ b/pkg/medusa/reconcile_test.go @@ -155,6 +155,7 @@ func testMedusaIniNoPrefix(t *testing.T) { assert.Contains(t, medusaIni, "port = 9001") assert.Contains(t, medusaIni, "secure = False") assert.Contains(t, medusaIni, "backup_grace_period_in_days = 7") + assert.Contains(t, medusaIni, "cassandra_url = http://127.0.0.1:8080/api/v0/ops/node/snapshots") } func testMedusaIniSecured(t *testing.T) { @@ -234,6 +235,9 @@ func testMedusaIniSecured(t *testing.T) { assert.Contains(medusaIni, "ca_cert = /etc/encryption/mgmt/ca.crt") assert.Contains(medusaIni, "tls_cert = /etc/encryption/mgmt/tls.crt") assert.Contains(medusaIni, "tls_key = /etc/encryption/mgmt/tls.key") + assert.Contains(medusaIni, "cassandra_url = https://127.0.0.1:8080/api/v0/ops/node/snapshots") + + assert.NotContains(medusaIni, "\t") } func testMedusaIniSecuredDcLevelSetting(t *testing.T) { @@ -296,6 +300,7 @@ func testMedusaIniSecuredDcLevelSetting(t *testing.T) { assert.Contains(medusaIni, "ca_cert = /etc/encryption/mgmt/ca.crt") assert.Contains(medusaIni, "tls_cert = /etc/encryption/mgmt/tls.crt") assert.Contains(medusaIni, "tls_key = /etc/encryption/mgmt/tls.key") + assert.Contains(medusaIni, "cassandra_url = https://127.0.0.1:8080/api/v0/ops/node/snapshots") } func testMedusaIniUnsecured(t *testing.T) {