Skip to content

Commit

Permalink
Merge pull request #677 from simonpasquier/rename-shared-config-fields
Browse files Browse the repository at this point in the history
Bug 1807100: pkg/manifests: rename shared config's keys to include 'Public'
  • Loading branch information
openshift-merge-robot committed Feb 27, 2020
2 parents b14e1a4 + 8a08a54 commit f3d3766
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
29 changes: 19 additions & 10 deletions pkg/manifests/manifests.go
Expand Up @@ -1050,18 +1050,10 @@ func (f *Factory) ThanosQuerierRoute() (*routev1.Route, error) {
}

func (f *Factory) SharingConfigDeprecated(promHost, amHost, grafanaHost, thanosHost *url.URL) *v1.ConfigMap {
return sharingConfig("sharing-config", f.namespace, promHost, amHost, grafanaHost, thanosHost)
}

func (f *Factory) SharingConfig(promHost, amHost, grafanaHost, thanosHost *url.URL) *v1.ConfigMap {
return sharingConfig(sharedConfigMap, configManagedNamespace, promHost, amHost, grafanaHost, thanosHost)
}

func sharingConfig(name string, namespace string, promHost, amHost, grafanaHost, thanosHost *url.URL) *v1.ConfigMap {
return &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Name: "sharing-config",
Namespace: f.namespace,
},
Data: map[string]string{
"grafanaURL": grafanaHost.String(),
Expand All @@ -1072,6 +1064,23 @@ func sharingConfig(name string, namespace string, promHost, amHost, grafanaHost,
}
}

func (f *Factory) SharingConfig(promHost, amHost, grafanaHost, thanosHost *url.URL) *v1.ConfigMap {
return &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: sharedConfigMap,
Namespace: configManagedNamespace,
},
Data: map[string]string{
// Configmap keys need to include "public" to indicate that they are public values.
// See https://bugzilla.redhat.com/show_bug.cgi?id=1807100.
"grafanaPublicURL": grafanaHost.String(),
"prometheusPublicURL": promHost.String(),
"alertmanagerPublicURL": amHost.String(),
"thanosPublicURL": thanosHost.String(),
},
}
}

func (f *Factory) PrometheusK8sTrustedCABundle() (*v1.ConfigMap, error) {
cm, err := f.NewConfigMap(MustAssetReader(PrometheusK8sTrustedCABundle))
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/manifests/manifests_test.go
Expand Up @@ -644,6 +644,11 @@ func TestSharingConfig(t *testing.T) {
if cm.Namespace == "openshift-monitoring" {
t.Fatalf("expecting namespace other than %q", "openshift-monitoring")
}
for k := range cm.Data {
if !strings.Contains(k, "Public") {
t.Fatalf("expecting key %q to contain 'Public'", k)
}
}
}

func TestPrometheusOperatorConfiguration(t *testing.T) {
Expand Down

0 comments on commit f3d3766

Please sign in to comment.