Skip to content
Merged
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: 6 additions & 0 deletions config/openshift/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ kind: Kustomization
resources:
- ../default
- cluster-monitoring-view-binding.yaml
- metrics-reader-token.yaml
- prometheus-metrics-auth-binding.yaml

patches:
- path: configmap-patch.yaml
Expand All @@ -22,5 +24,9 @@ patches:
target:
kind: Deployment
name: controller-manager
- path: monitor-auth-patch.yaml
target:
kind: ServiceMonitor
name: controller-manager-metrics-monitor

namespace: workload-variant-autoscaler-system
11 changes: 11 additions & 0 deletions config/openshift/metrics-reader-token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Long-lived SA token for Prometheus to authenticate to the WVA metrics endpoint.
# Required on OpenShift because user-workload-monitoring Prometheus rejects
# bearerTokenFile for security. The ServiceMonitor is patched (via
# monitor-auth-patch.yaml) to reference this Secret instead.
apiVersion: v1
kind: Secret
metadata:
name: workload-variant-autoscaler-metrics-reader-token
annotations:
kubernetes.io/service-account.name: workload-variant-autoscaler-controller-manager
type: kubernetes.io/service-account-token
20 changes: 20 additions & 0 deletions config/openshift/monitor-auth-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Replace bearerTokenFile with authorization.credentials for OpenShift
# user-workload-monitoring compatibility. The user-workload Prometheus Operator
# rejects bearerTokenFile ("it accesses file system via bearer token file which
# Prometheus specification prohibits").
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: controller-manager-metrics-monitor
spec:
endpoints:
- port: https
path: /metrics
interval: 10s
scheme: https
tlsConfig:
insecureSkipVerify: true
authorization:
credentials:
name: workload-variant-autoscaler-metrics-reader-token
key: token
14 changes: 14 additions & 0 deletions config/openshift/prometheus-metrics-auth-binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Grant the OpenShift user-workload-monitoring Prometheus SA permission to
# authenticate to the WVA metrics endpoint (tokenreviews + subjectaccessreviews).
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: workload-variant-autoscaler-ocp-prometheus-metrics-auth
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: workload-variant-autoscaler-metrics-auth-role
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-user-workload-monitoring
Loading