|
| 1 | +{{ if .MonitoringAvailable }} |
| 2 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 3 | +kind: Role |
| 4 | +metadata: |
| 5 | + name: kubemacpool-prometheus |
| 6 | + namespace: '{{ .Namespace }}' |
| 7 | +rules: |
| 8 | +- apiGroups: |
| 9 | + - "" |
| 10 | + resources: |
| 11 | + - services |
| 12 | + - endpoints |
| 13 | + - pods |
| 14 | + verbs: |
| 15 | + - get |
| 16 | + - list |
| 17 | + - watch |
| 18 | +--- |
| 19 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 20 | +kind: RoleBinding |
| 21 | +metadata: |
| 22 | + name: kubemacpool-prometheus |
| 23 | + namespace: '{{ .Namespace }}' |
| 24 | +roleRef: |
| 25 | + apiGroup: rbac.authorization.k8s.io |
| 26 | + kind: Role |
| 27 | + name: kubemacpool-prometheus |
| 28 | +subjects: |
| 29 | +- kind: ServiceAccount |
| 30 | + name: '{{ .MonitoringServiceAccount }}' |
| 31 | + namespace: '{{ .MonitoringNamespace }}' |
| 32 | +--- |
| 33 | +apiVersion: v1 |
| 34 | +kind: Service |
| 35 | +metadata: |
| 36 | + labels: |
| 37 | + control-plane: mac-controller-manager |
| 38 | + prometheus.kubemacpool.io: "true" |
| 39 | + name: kubemacpool-metrics-service |
| 40 | + namespace: '{{ .Namespace }}' |
| 41 | +spec: |
| 42 | + ports: |
| 43 | + - name: metrics |
| 44 | + port: 8443 |
| 45 | + protocol: TCP |
| 46 | + targetPort: 8443 |
| 47 | + selector: |
| 48 | + control-plane: mac-controller-manager |
| 49 | +--- |
| 50 | +apiVersion: monitoring.coreos.com/v1 |
| 51 | +kind: PrometheusRule |
| 52 | +metadata: |
| 53 | + labels: |
| 54 | + openshift.io/prometheus-rule-evaluation-scope: leaf-prometheus |
| 55 | + prometheus.kubemacpool.io: "true" |
| 56 | + name: kubemacpool-prometheus-rule |
| 57 | + namespace: '{{ .Namespace }}' |
| 58 | +spec: |
| 59 | + groups: |
| 60 | + - name: alerts.rules |
| 61 | + rules: |
| 62 | + - alert: KubemacpoolMACCollisionDetected |
| 63 | + annotations: |
| 64 | + description: '{{ "{{" }} $value {{ "}}" }} MAC address(es) have collisions. Multiple running |
| 65 | + objects are using the same MAC address.' |
| 66 | + summary: MAC address collisions detected. |
| 67 | + expr: count(kmp_mac_collisions > 1) > 0 |
| 68 | + for: 30s |
| 69 | + labels: |
| 70 | + operator_health_impact: warning |
| 71 | + severity: warning |
| 72 | +--- |
| 73 | +apiVersion: monitoring.coreos.com/v1 |
| 74 | +kind: ServiceMonitor |
| 75 | +metadata: |
| 76 | + labels: |
| 77 | + openshift.io/cluster-monitoring: "true" |
| 78 | + prometheus.kubemacpool.io: "true" |
| 79 | + name: kubemacpool-metrics-monitor |
| 80 | + namespace: '{{ .Namespace }}' |
| 81 | +spec: |
| 82 | + endpoints: |
| 83 | + - bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token |
| 84 | + port: metrics |
| 85 | + scheme: https |
| 86 | + tlsConfig: |
| 87 | + insecureSkipVerify: true |
| 88 | + selector: |
| 89 | + matchLabels: |
| 90 | + control-plane: mac-controller-manager |
| 91 | +{{ end }} |
0 commit comments