Skip to content

Commit

Permalink
pkg/manifests: Correctly default telemeter URL
Browse files Browse the repository at this point in the history
  • Loading branch information
brancz committed Jan 24, 2020
1 parent 9f6d7ee commit d744cf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion pkg/manifests/config.go
Expand Up @@ -219,7 +219,7 @@ func (c *Config) applyDefaults() {
}
if c.TelemeterClientConfig == nil {
c.TelemeterClientConfig = &TelemeterClientConfig{
TelemeterServerURL: "https://infogw.api.openshift.com/metrics/v1/receive",
TelemeterServerURL: "https://infogw.api.openshift.com/",
}
}
if c.K8sPrometheusAdapter == nil {
Expand Down Expand Up @@ -257,6 +257,9 @@ func (c *Config) SetTelemetryMatches(matches []string) {

func (c *Config) SetRemoteWrite(rw bool) {
c.RemoteWrite = rw
if c.RemoteWrite && c.TelemeterClientConfig.TelemeterServerURL == "https://infogw.api.openshift.com/" {
c.TelemeterClientConfig.TelemeterServerURL = "https://infogw.api.openshift.com/metrics/v1/receive"
}
}

func (c *Config) LoadClusterID(load func() (*configv1.ClusterVersion, error)) error {
Expand Down
6 changes: 3 additions & 3 deletions pkg/manifests/manifests_test.go
Expand Up @@ -760,7 +760,7 @@ func TestPrometheusK8sRemoteWrite(t *testing.T) {
t.Fatal(err)
}

c.RemoteWrite = true
c.SetRemoteWrite(true)
c.TelemeterClientConfig.ClusterID = "123"
c.TelemeterClientConfig.Token = "secret"

Expand All @@ -780,7 +780,7 @@ func TestPrometheusK8sRemoteWrite(t *testing.T) {
t.Fatal(err)
}

c.RemoteWrite = true
c.SetRemoteWrite(true)
c.TelemeterClientConfig.ClusterID = "123"
c.TelemeterClientConfig.Token = "secret"
c.PrometheusK8sConfig.RemoteWrite = []monv1.RemoteWriteSpec{{URL: "http://custom"}}
Expand All @@ -802,7 +802,7 @@ func TestPrometheusK8sRemoteWrite(t *testing.T) {
t.Fatal(err)
}

c.RemoteWrite = true
c.SetRemoteWrite(true)
c.TelemeterClientConfig.TelemeterServerURL = "http://custom-telemeter"
c.TelemeterClientConfig.ClusterID = "123"
c.TelemeterClientConfig.Token = "secret"
Expand Down

0 comments on commit d744cf2

Please sign in to comment.