File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ kind: Kustomization
44resources :
55- ../default
66- cluster-monitoring-view-binding.yaml
7+ - metrics-reader-token.yaml
8+ - prometheus-metrics-auth-binding.yaml
79
810patches :
911- path : configmap-patch.yaml
@@ -22,5 +24,9 @@ patches:
2224 target :
2325 kind : Deployment
2426 name : controller-manager
27+ - path : monitor-auth-patch.yaml
28+ target :
29+ kind : ServiceMonitor
30+ name : controller-manager-metrics-monitor
2531
2632namespace : workload-variant-autoscaler-system
Original file line number Diff line number Diff line change 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+ annotations :
10+ kubernetes.io/service-account.name : workload-variant-autoscaler-controller-manager
11+ type : kubernetes.io/service-account-token
Original file line number Diff line number Diff line change 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+ spec :
10+ endpoints :
11+ - port : https
12+ path : /metrics
13+ interval : 10s
14+ scheme : https
15+ tlsConfig :
16+ insecureSkipVerify : true
17+ authorization :
18+ credentials :
19+ name : workload-variant-autoscaler-metrics-reader-token
20+ key : token
Original file line number Diff line number Diff line change 1+ # Grant the OpenShift user-workload-monitoring Prometheus SA permission to
2+ # authenticate to the WVA metrics endpoint (tokenreviews + subjectaccessreviews).
3+ apiVersion : rbac.authorization.k8s.io/v1
4+ kind : ClusterRoleBinding
5+ metadata :
6+ name : workload-variant-autoscaler-ocp-prometheus-metrics-auth
7+ roleRef :
8+ apiGroup : rbac.authorization.k8s.io
9+ kind : ClusterRole
10+ name : workload-variant-autoscaler-metrics-auth-role
11+ subjects :
12+ - kind : ServiceAccount
13+ name : prometheus-k8s
14+ namespace : openshift-user-workload-monitoring
You can’t perform that action at this time.
0 commit comments