openebs / monitoring

OpenEBS Monitoring add-on. A set of Grafana, Prometheus, and alert manager plugins.
Apache License 2.0
26 stars 20 forks source link

Prometheus rules imported as json instead of yaml #94

Closed survivant closed 2 years ago

survivant commented 2 years ago

I think I found a issue with the monitoring stack when importing Prometheus rules. here what I found. I did a helm install --dry-run > all.yaml if I check the content of that file for

kind: PrometheusRule
I found this for prometheus rules
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: monitoring-kube-prometheus-prometheus
  namespace: default
  labels:
    app: kube-prometheus-stack

    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/instance: monitoring
    app.kubernetes.io/version: "18.0.5"
    app.kubernetes.io/part-of: kube-prometheus-stack
    chart: kube-prometheus-stack-18.0.5
    release: "monitoring"
    heritage: "Helm"
spec:
  groups:
  - name: prometheus
    rules:
    - alert: PrometheusBadConfig
      annotations:

but for openebs rules

# Source: monitoring-stack/charts/openebs-monitoring/templates/prometheusRules.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: openebs-monitoring-cstor-rules
  namespace: default
  labels:
    app: openebs-monitoring
    helm.sh/chart: openebs-monitoring-0.4.8
    app.kubernetes.io/name: openebs-monitoring
    app.kubernetes.io/instance: monitoring
    release: "monitoring"
    app.kubernetes.io/version: "2.12.0"
    app.kubernetes.io/managed-by: Helm
spec:
  {
     "groups": [
        {
           "name": "openebs-cStor-pool",
           "rules": [
              {
                 "alert": "PoolCapacityLow",
                 "annotations": {
                    "componentType": "pool",

FOr openebs rules they are imported as json format not yaml.

Ab-hishek commented 2 years ago

This is not an issue @survivant. Actually the alert rules are also generated by jsonnet and added in the rules directory inside helm chart dir automatically. Earlier it used to be in yaml format but when we started supporting mixin, the rules then changed into json format. You can look into the contributors guide how we generate rules. The rules works completely this way also. Prometheus works for both yaml as well as jsons.

survivant commented 2 years ago

this doesn't look like a valid yaml file. but PrometheusRule accept it, so it's not a issue. Closing this issue