Skip to content

Commit a4eb4d2

Browse files
committed
chore: use release name as etcd namespace
🔒 Scanned for secrets using gitleaks 8.30.0
1 parent 395a4fb commit a4eb4d2

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

cluster/migrator/etcdkeys/etcdkeys.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import (
66

77
// MigrationRequestKeyPrefix returns the etcd key prefix for migration requests
88
func MigrationRequestKeyPrefix(config *config.Config) string {
9-
return "/" + getNamespace(config) + "/migration/request/"
9+
return "/" + getEtcdNamespace(config) + "/migration/request/"
1010
}
1111

1212
// MigrationJobKeyPrefix returns the etcd key prefix for migration jobs
1313
func MigrationJobKeyPrefix(config *config.Config) string {
14-
return "/" + getNamespace(config) + "/migration/job/"
14+
return "/" + getEtcdNamespace(config) + "/migration/job/"
1515
}
1616

1717
// ReloadGatewayRequestKeyPrefix returns the etcd key prefix for gateway reload requests
1818
func ReloadGatewayRequestKeyPrefix(config *config.Config) string {
19-
return "/" + getNamespace(config) + "/reload/gateway/request/"
19+
return "/" + getEtcdNamespace(config) + "/reload/gateway/request/"
2020
}
2121

22-
// getNamespace retrieves the workspace namespace from the configuration
23-
func getNamespace(config *config.Config) string {
24-
return config.GetString("WORKSPACE_NAMESPACE", "default")
22+
// getEtcdNamespace retrieves the key namespace from the configuration
23+
func getEtcdNamespace(config *config.Config) string {
24+
return config.GetStringVar("", "RELEASE_NAME")
2525
}

cluster/migrator/gateway/gateway_partition_migrator_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
4545
// Setup unique namespace for this test
4646
namespace := rand.String(10)
4747
conf := config.New()
48-
conf.Set("WORKSPACE_NAMESPACE", namespace)
48+
conf.Set("RELEASE_NAME", namespace)
4949

5050
nodeIndex := 0
5151
nodeName := "test-gw-node-0"
@@ -141,7 +141,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
141141

142142
namespace := rand.String(10)
143143
conf := config.New()
144-
conf.Set("WORKSPACE_NAMESPACE", namespace)
144+
conf.Set("RELEASE_NAME", namespace)
145145

146146
nodeIndex := 0
147147
nodeName := "test-gw-node-0"
@@ -195,7 +195,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
195195

196196
namespace := rand.String(10)
197197
conf := config.New()
198-
conf.Set("WORKSPACE_NAMESPACE", namespace)
198+
conf.Set("RELEASE_NAME", namespace)
199199

200200
nodeIndex := 1
201201
nodeName := "test-gw-node-1"
@@ -258,7 +258,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
258258

259259
namespace := rand.String(10)
260260
conf := config.New()
261-
conf.Set("WORKSPACE_NAMESPACE", namespace)
261+
conf.Set("RELEASE_NAME", namespace)
262262

263263
nodeIndex := 0
264264
nodeName := "test-gw-node-0"
@@ -350,7 +350,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
350350

351351
namespace := rand.String(10)
352352
conf := config.New()
353-
conf.Set("WORKSPACE_NAMESPACE", namespace)
353+
conf.Set("RELEASE_NAME", namespace)
354354
conf.Set("Migrator.retryInitialInterval", "100ms")
355355
conf.Set("Migrator.retryMaxInterval", "500ms")
356356

@@ -426,7 +426,7 @@ func TestGatewayPartitionMigrator(t *testing.T) {
426426

427427
namespace := rand.String(10)
428428
conf := config.New()
429-
conf.Set("WORKSPACE_NAMESPACE", namespace)
429+
conf.Set("RELEASE_NAME", namespace)
430430
conf.Set("Migrator.retryInitialInterval", "100ms")
431431
conf.Set("Migrator.retryMaxInterval", "500ms")
432432

cluster/migrator/processor/processor_partition_migrator_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
3434
// Setup unique namespace for this test
3535
namespace := rand.String(10)
3636
conf := config.New()
37-
conf.Set("WORKSPACE_NAMESPACE", namespace)
37+
conf.Set("RELEASE_NAME", namespace)
3838

3939
nodeIndex := 0
4040
nodeName := "test-node-0"
@@ -121,7 +121,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
121121
t.Run("source migrator failing", func(t *testing.T) {
122122
namespace := rand.String(10)
123123
conf := config.New()
124-
conf.Set("WORKSPACE_NAMESPACE", namespace)
124+
conf.Set("RELEASE_NAME", namespace)
125125

126126
nodeIndex := 0
127127
nodeName := "test-node-0"
@@ -155,7 +155,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
155155
t.Run("target migrator failing", func(t *testing.T) {
156156
namespace := rand.String(10)
157157
conf := config.New()
158-
conf.Set("WORKSPACE_NAMESPACE", namespace)
158+
conf.Set("RELEASE_NAME", namespace)
159159

160160
nodeIndex := 0
161161
nodeName := "test-node-0"
@@ -193,7 +193,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
193193

194194
namespace := rand.String(10)
195195
conf := config.New()
196-
conf.Set("WORKSPACE_NAMESPACE", namespace)
196+
conf.Set("RELEASE_NAME", namespace)
197197

198198
nodeIndex := 0
199199
nodeName := "test-node-0"
@@ -319,7 +319,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
319319

320320
namespace := rand.String(10)
321321
conf := config.New()
322-
conf.Set("WORKSPACE_NAMESPACE", namespace)
322+
conf.Set("RELEASE_NAME", namespace)
323323

324324
nodeIndex := 0
325325
nodeName := "test-node-0"
@@ -412,7 +412,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
412412

413413
namespace := rand.String(10)
414414
conf := config.New()
415-
conf.Set("WORKSPACE_NAMESPACE", namespace)
415+
conf.Set("RELEASE_NAME", namespace)
416416

417417
nodeIndex := 0
418418
nodeName := "test-node-0"
@@ -505,7 +505,7 @@ func TestProcessorPartitionMigrator(t *testing.T) {
505505

506506
namespace := rand.String(10)
507507
conf := config.New()
508-
conf.Set("WORKSPACE_NAMESPACE", namespace)
508+
conf.Set("RELEASE_NAME", namespace)
509509
conf.Set("Migrator.retryInitialInterval", "100ms")
510510
conf.Set("Migrator.retryMaxInterval", "500ms")
511511

cluster/migrator/processor/sourcenode/sourcenode_migrator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestMigrator(t *testing.T) {
5353

5454
namespace := rand.String(10)
5555
conf := config.New()
56-
conf.Set("WORKSPACE_NAMESPACE", namespace)
56+
conf.Set("RELEASE_NAME", namespace)
5757
conf.Set("PartitionMigration.Processor.SourceNode.readExcludeSleep", "10ms")
5858
conf.Set("PartitionMigration.Processor.SourceNode.waitForInProgressTimeout", "10s")
5959

@@ -499,7 +499,7 @@ func TestMigrator(t *testing.T) {
499499

500500
namespace := rand.String(10)
501501
conf := config.New()
502-
conf.Set("WORKSPACE_NAMESPACE", namespace)
502+
conf.Set("RELEASE_NAME", namespace)
503503
conf.Set("PartitionMigration.Processor.SourceNode.readExcludeSleep", "10ms")
504504
conf.Set("PartitionMigration.Processor.SourceNode.waitForInProgressTimeout", "10s")
505505
conf.Set("LOG_LEVEL", "DEBUG")

cluster/migrator/processor/targetnode/targetnode_migrator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestMigrator(t *testing.T) {
6262

6363
namespace := rand.String(10)
6464
conf := config.New()
65-
conf.Set("WORKSPACE_NAMESPACE", namespace)
65+
conf.Set("RELEASE_NAME", namespace)
6666

6767
// Create primary gw jobsdb
6868
gwJobsDB := jobsdb.NewForReadWrite("gw",

integration_test/partitionmigration/partitionmigration_embedded_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestPartitionMigrationEmbeddedMode(t *testing.T) {
139139

140140
"ETCD_HOSTS": etcdResource.Hosts[0],
141141
"DEST_TRANSFORM_URL": tr.TransformerURL,
142-
"WORKSPACE_NAMESPACE": namespace,
142+
"RELEASE_NAME": namespace,
143143
"RELEASE_NAME": namespace,
144144
"CONFIG_BACKEND_URL": bc.URL,
145145
"HOSTED_SERVICE_SECRET": "123", // random one

integration_test/partitionmigration/partitionmigration_gwproc_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestPartitionMigrationGatewayProcessorMode(t *testing.T) {
139139

140140
"ETCD_HOSTS": etcdResource.Hosts[0],
141141
"DEST_TRANSFORM_URL": tr.TransformerURL,
142-
"WORKSPACE_NAMESPACE": namespace,
142+
"RELEASE_NAME": namespace,
143143
"RELEASE_NAME": namespace,
144144
"CONFIG_BACKEND_URL": bc.URL,
145145
"HOSTED_SERVICE_SECRET": "123", // random one
@@ -174,7 +174,7 @@ func TestPartitionMigrationGatewayProcessorMode(t *testing.T) {
174174

175175
"ETCD_HOSTS": etcdResource.Hosts[0],
176176
"DEST_TRANSFORM_URL": tr.TransformerURL,
177-
"WORKSPACE_NAMESPACE": namespace,
177+
"RELEASE_NAME": namespace,
178178
"RELEASE_NAME": namespace,
179179
"CONFIG_BACKEND_URL": bc.URL,
180180
"HOSTED_SERVICE_SECRET": "123", // random one

0 commit comments

Comments
 (0)