Skip to content

Commit 79e2242

Browse files
use authorization.credentials instead of bearerToekn
Signed-off-by: greg pereira <grpereir@redhat.com>
1 parent 2a57b29 commit 79e2242

4 files changed

Lines changed: 38 additions & 15 deletions

File tree

config/default/kustomization.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,6 @@ patches:
4141
target:
4242
kind: Deployment
4343

44-
45-
replacements:
46-
- source:
47-
kind: Deployment
48-
name: controller-manager
49-
fieldPath: metadata.namespace
50-
targets:
51-
- select:
52-
kind: ServiceMonitor
53-
group: monitoring.coreos.com
54-
version: v1
55-
name: controller-manager-metrics-monitor
56-
fieldPaths:
57-
- spec.namespaceSelector.matchNames.0
58-
5944
# Uncomment the patches line if you enable Metrics and CertManager
6045
# [METRICS-WITH-CERTS] To enable metrics protected with certManager, uncomment the following line.
6146
# This patch will protect the metrics with certManager self-signed certs.

config/openshift/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ kind: Kustomization
44
resources:
55
- ../default
66
- cluster-monitoring-view-binding.yaml
7+
- metrics-reader-token.yaml
78

89
patches:
910
- path: configmap-patch.yaml
@@ -22,5 +23,9 @@ patches:
2223
target:
2324
kind: Deployment
2425
name: controller-manager
26+
- path: monitor-auth-patch.yaml
27+
target:
28+
kind: ServiceMonitor
29+
name: controller-manager-metrics-monitor
2530

2631
namespace: workload-variant-autoscaler-system
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Long-lived SA token for Prometheus to authenticate to the WVA metrics endpoint.
2+
# Required on OpenShift because user-workload-monitoring Prometheus rejects
3+
# bearerTokenFile for security. The ServiceMonitor is patched (via
4+
# monitor-auth-patch.yaml) to reference this Secret instead.
5+
apiVersion: v1
6+
kind: Secret
7+
metadata:
8+
name: workload-variant-autoscaler-metrics-reader-token
9+
namespace: system
10+
annotations:
11+
kubernetes.io/service-account.name: workload-variant-autoscaler-controller-manager
12+
type: kubernetes.io/service-account-token
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Replace bearerTokenFile with authorization.credentials for OpenShift
2+
# user-workload-monitoring compatibility. The user-workload Prometheus Operator
3+
# rejects bearerTokenFile ("it accesses file system via bearer token file which
4+
# Prometheus specification prohibits").
5+
apiVersion: monitoring.coreos.com/v1
6+
kind: ServiceMonitor
7+
metadata:
8+
name: controller-manager-metrics-monitor
9+
namespace: system
10+
spec:
11+
endpoints:
12+
- port: https
13+
path: /metrics
14+
interval: 10s
15+
scheme: https
16+
tlsConfig:
17+
insecureSkipVerify: true
18+
authorization:
19+
credentials:
20+
name: workload-variant-autoscaler-metrics-reader-token
21+
key: token

0 commit comments

Comments
 (0)