Skip to content

Commit

Permalink
Merge pull request #90 from vshn/adjust-metrics-endpoints
Browse files Browse the repository at this point in the history
Adjust metrics endpoints
  • Loading branch information
zugao authored Jul 19, 2023
2 parents 0ff8363 + 3daf4a4 commit fc73d27
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
28 changes: 16 additions & 12 deletions pkg/brokerapi/brokerapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,9 +904,10 @@ func (ts *EnvTestSuite) TestBrokerAPI_Bind() {
},
},
"metricsEndpoints": []string{
"http://1-1-1-redis-0.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-2.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/0",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/1",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/2",
},
},
},
Expand Down Expand Up @@ -995,9 +996,10 @@ func (ts *EnvTestSuite) TestBrokerAPI_Bind() {
},
},
"metricsEndpoints": []string{
"http://1-1-1-redis-0.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-2.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/0",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/1",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/2",
},
},
},
Expand Down Expand Up @@ -1086,9 +1088,10 @@ func (ts *EnvTestSuite) TestBrokerAPI_Bind() {
"jdbcUrl": "***",
"jdbcUrlMariaDb": "***",
"metricsEndpoints": []string{
"http://1-1-1-mariadb-0.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-mariadb-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-mariadb-2.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/mariadb/0",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/mariadb/1",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/mariadb/2",
},
},
},
Expand Down Expand Up @@ -1296,9 +1299,10 @@ func (ts *EnvTestSuite) TestBrokerAPI_GetBinding() {
},
},
"metricsEndpoints": []string{
"http://1-1-1-redis-0.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1-redis-2.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/0",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/1",
"http://1-1-1.dbaas-test-cluster.metrics.example.tld/redis/2",
},
},
},
Expand Down
7 changes: 4 additions & 3 deletions pkg/crossplane/service_mariadb_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ func createCredentials(endpoint *Endpoint, username, password, database, databas
}
if metricsEnabled {
creds["metricsEndpoints"] = []string{
fmt.Sprintf("http://%s-mariadb-0.%s.%s", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s-mariadb-1.%s.%s", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s-mariadb-2.%s.%s", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s.%s.%s", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s.%s.%s/mariadb/0", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s.%s.%s/mariadb/1", databaseParent, clusterName, metricsDomain),
fmt.Sprintf("http://%s.%s.%s/mariadb/2", databaseParent, clusterName, metricsDomain),
}
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/crossplane/service_redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ func (rsb RedisServiceBinder) GetBinding(ctx context.Context, bindingID string)
}
if rsb.cp.config.EnableMetrics {
creds["metricsEndpoints"] = []string{
fmt.Sprintf("http://%s-redis-0.%s.%s", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s-redis-1.%s.%s", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s-redis-2.%s.%s", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s.%s.%s", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s.%s.%s/redis/0", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s.%s.%s/redis/1", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
fmt.Sprintf("http://%s.%s.%s/redis/2", rsb.instance.ID(), cn, rsb.cp.config.MetricsDomain),
}
}

Expand Down

0 comments on commit fc73d27

Please sign in to comment.