---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: kube-proxy
  annotations:
    networkoperator.openshift.io/ignore-errors: ""
  name: monitor-kube-proxy
  namespace: openshift-kube-proxy
spec:
  endpoints:
  - interval: 30s
    port: metrics
    bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
    scheme: https
    tlsConfig:
      caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
      serverName: openshift-kube-proxy.openshift-kube-proxy.svc
  jobLabel: app
  namespaceSelector:
    matchNames:
    - openshift-kube-proxy
  selector:
    matchLabels:
      app: kube-proxy
---
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.openshift.io/serving-cert-secret-name: kube-proxy-metrics-certs
  labels:
    app: kube-proxy
  name: openshift-kube-proxy
  namespace: openshift-kube-proxy
spec:
  selector:
    app: kube-proxy
  clusterIP: None
  publishNotReadyAddresses: true
  ports:
  - name: metrics
    port: {{.MetricsPort}}
    protocol: TCP
    targetPort: {{.MetricsPort}}
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: prometheus-k8s
  namespace: openshift-kube-proxy
rules:
- apiGroups:
  - ""
  resources:
  - services
  - endpoints
  - pods
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: prometheus-k8s
  namespace: openshift-kube-proxy
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: prometheus-k8s
subjects:
- kind: ServiceAccount
  name: prometheus-k8s
  namespace: openshift-monitoring
