Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[metrics 4/x] Metrics exporter rules #732

Merged

Commits on Sep 17, 2024

  1. metrics: Add PrometheusRule for namespaced metrics

    PrometheusRules allow recording pre-defined queries. Use
    `sriov_kubepoddevice` metric to add `pod|namespace` pair
    to the sriov metrics.
    
    Feature is enabled via the `METRICS_EXPORTER_PROMETHEUS_DEPLOY_RULE`
    environment variable.
    
    Signed-off-by: Andrea Panattoni <[email protected]>
    zeeke committed Sep 17, 2024
    Configuration menu
    Copy the full SHA
    91e04f6 View commit details
    Browse the repository at this point in the history
  2. metrics: Add permissions to remove monitor objects

    When the `metricsExporter` feature is turned off, deployed resources
    should be removed. These changes fix the error:
    
    ```
    │ 2024-08-28T14:07:57.699760017Z    ERROR    controller/controller.go:266    Reconciler error    {"controller": "sriovoperatorconfig", "controllerGroup": "sriovnetwork.openshift.io", "controllerKind": "SriovOperatorConfig", "SriovOperatorConfig": {"name":"default","namespace":"openshift-sriov-network-operator"},  │
    │ "namespace": "openshift-sriov-network-operator", "name": "default", "reconcileID": "fa841c50-dbb8-4c4c-9ddd-b98624fd2a24", "error": "failed to delete object &{map[apiVersion:monitoring.coreos.com/v1 kind:ServiceMonitor metadata:map[name:sriov-network-metrics-exporter namespace:openshift-sriov-network-operator]  │
    │ spec:map[endpoints:[map[bearerTokenFile:/var/run/secrets/kubernetes.io/serviceaccount/token honorLabels:true interval:30s port:sriov-network-metrics scheme:https tlsConfig:map[caFile:/etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt insecureSkipVerify:false serverName:sriov-network-metrics-expor │
    │ ter-service.openshift-sriov-network-operator.svc]]] namespaceSelector:map[matchNames:[openshift-sriov-network-operator]] selector:map[matchLabels:map[name:sriov-network-metrics-exporter-service]]]]} with err: could not delete object (monitoring.coreos.com/v1, Kind=ServiceMonitor) openshift-sriov-network-operato │
    │ r/sriov-network-metrics-exporter: servicemonitors.monitoring.coreos.com \"sriov-network-metrics-exporter\" is forbidden: User \"system:serviceaccount:openshift-sriov-network-operator:sriov-network-operator\" cannot delete resource \"servicemonitors\" in API group \"monitoring.coreos.com\" in the namespace \"ope │
    │ nshift-sriov-network-operator\""}
    ```
    
    Signed-off-by: Andrea Panattoni <[email protected]>
    zeeke committed Sep 17, 2024
    Configuration menu
    Copy the full SHA
    b49cf15 View commit details
    Browse the repository at this point in the history