@@ -56,18 +56,35 @@ func ServiceMonitor(caInjectType CAInjectType) *v1.ServiceMonitor {
5656// endpointFor provides a standard endpoint for the given URL path.
5757func endpointFor (path string , caInjectType CAInjectType ) v1.Endpoint {
5858 serverName := fmt .Sprintf ("metrics.%s.svc" , config .GetOperatorNamespace ())
59+ scheme := v1 .Scheme ("https" )
60+
5961 ep := v1.Endpoint {
6062 Path : path ,
6163 Interval : "10s" ,
6264 Port : "https" ,
63- Scheme : "https" ,
64- BearerTokenSecret : & corev1.SecretKeySelector {
65+ Scheme : & scheme ,
66+ }
67+
68+ ep .Authorization = & v1.SafeAuthorization {
69+ Credentials : & corev1.SecretKeySelector {
6570 LocalObjectReference : corev1.LocalObjectReference {
6671 Name : "metrics-token" ,
6772 },
6873 Key : "token" ,
6974 },
70- TLSConfig : & v1.TLSConfig {
75+ }
76+
77+ if isOpenShiftSystemInstalled (caInjectType ) {
78+ ep .TLSConfig = & v1.TLSConfig {
79+ TLSFilesConfig : v1.TLSFilesConfig {
80+ CAFile : "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt" ,
81+ },
82+ SafeTLSConfig : v1.SafeTLSConfig {
83+ ServerName : & serverName ,
84+ },
85+ }
86+ } else {
87+ ep .TLSConfig = & v1.TLSConfig {
7188 SafeTLSConfig : v1.SafeTLSConfig {
7289 ServerName : & serverName ,
7390 CA : v1.SecretOrConfigMap {
@@ -79,15 +96,6 @@ func endpointFor(path string, caInjectType CAInjectType) v1.Endpoint {
7996 },
8097 },
8198 },
82- },
83- }
84-
85- if isOpenShiftSystemInstalled (caInjectType ) {
86- ep .TLSConfig = & v1.TLSConfig {
87- CAFile : "/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt" ,
88- SafeTLSConfig : v1.SafeTLSConfig {
89- ServerName : & serverName ,
90- },
9199 }
92100 }
93101
0 commit comments