Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,8 @@ func (f *Factory) PrometheusK8s(grpcTLS *v1.Secret, telemetrySecret *v1.Secret)
for i, container := range p.Spec.Containers {
switch container.Name {
case "prometheus":
// Inject the proxy env vars into the Prometheus container for configuring external Alertmanagers
// Inject the proxy env vars into the Prometheus container
// Mainly intended for all configs that support proxyConfig.proxyFromEnvironment
f.injectProxyVariables(&p.Spec.Containers[i])
case "kube-rbac-proxy", "kube-rbac-proxy-web", "kube-rbac-proxy-thanos":
p.Spec.Containers[i].Image = f.config.Images.KubeRbacProxy
Expand Down Expand Up @@ -1801,7 +1802,8 @@ func (f *Factory) PrometheusUserWorkload(grpcTLS *v1.Secret) (*monv1.Prometheus,
PeriodSeconds: 15,
FailureThreshold: 240,
}
// Inject the proxy env vars into the Prometheus container for configuring external Alertmanagers
// Inject the proxy env vars into the Prometheus container
// Mainly intended for all configs that support proxyConfig.proxyFromEnvironment
f.injectProxyVariables(&p.Spec.Containers[i])
case "kube-rbac-proxy-metrics", "kube-rbac-proxy-federate", "kube-rbac-proxy-thanos":
p.Spec.Containers[i].Image = f.config.Images.KubeRbacProxy
Expand Down
17 changes: 5 additions & 12 deletions pkg/manifests/manifests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,7 @@ func TestPrometheusK8sRemoteWriteOauth2(t *testing.T) {
"param2": "value2",
},
}
expectedOauth2Config.ProxyFromEnvironment = ptr.To(true)
c, err := NewConfigFromString(`prometheusK8s:
remoteWrite:
- url: https://test.remotewrite.com/api/write
Expand All @@ -1254,6 +1255,7 @@ func TestPrometheusK8sRemoteWriteOauth2(t *testing.T) {
endpointParams:
param1: value1
param2: value2
proxyFromEnvironment: true
`, false)
if err != nil {
t.Fatal(err)
Expand All @@ -1264,18 +1266,9 @@ func TestPrometheusK8sRemoteWriteOauth2(t *testing.T) {
&v1.Secret{ObjectMeta: metav1.ObjectMeta{Name: "foo"}},
nil,
)
if err != nil {
t.Fatal(err)
}

if p.Spec.RemoteWrite[0].URL != "https://test.remotewrite.com/api/write" {
t.Errorf("want remote write URL https://test.remotewrite.com/api/write, got %v", p.Spec.RemoteWrite[0].URL)
}

if !reflect.DeepEqual(p.Spec.RemoteWrite[0].OAuth2, &expectedOauth2Config) {
t.Errorf("want OAuth2 config %v, got %v", expectedOauth2Config, p.Spec.RemoteWrite[0].OAuth2)
}

require.NoError(t, err)
require.Equal(t, p.Spec.RemoteWrite[0].URL, "https://test.remotewrite.com/api/write")
require.Equal(t, p.Spec.RemoteWrite[0].OAuth2, &expectedOauth2Config)
}
func TestRemoteWriteAuthorizationConfig(t *testing.T) {
for _, tc := range []struct {
Expand Down