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

feat(kube-prometheus-stack): add kube-state-metrics configmap #78

Merged
merged 1 commit into from
Apr 27, 2024
Merged

Conversation

jfroy
Copy link
Owner

@jfroy jfroy commented Apr 27, 2024

The configmap cleans up the main helmrelease file, and includes the
changes in fluxcd/flux2-monitoring-example#33.

The configmap cleans up the main helmrelease file, and includes the
changes in fluxcd/flux2-monitoring-example#33.
Copy link

--- kubernetes/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/kube-prometheus-stack HelmRelease: observability/kube-prometheus-stack

+++ kubernetes/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/kube-prometheus-stack HelmRelease: observability/kube-prometheus-stack

@@ -18,12 +18,17 @@

         namespace: flux-system
       version: 57.2.1
   dependsOn:
   - name: openebs
     namespace: openebs-system
   driftDetection:
+    ignore:
+    - paths:
+      - /metadata/annotations/prometheus-operator-validated
+      target:
+        kind: PrometheusRule
     mode: enabled
   install:
     crds: CreateReplace
     remediation:
       retries: 3
   interval: 5m
@@ -72,461 +77,12 @@

         dashboards:
           annotations:
             grafana_folder: Kubernetes
           multicluster:
             etcd:
               enabled: true
-    kube-state-metrics:
-      customResourceState:
-        config:
-          spec:
-            resources:
-            - groupVersionKind:
-                group: kustomize.toolkit.fluxcd.io
-                kind: Kustomization
-                version: v1
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - lastAppliedRevision
-                  source_name:
-                  - spec
-                  - sourceRef
-                  - name
-                  suspended:
-                  - spec
-                  - suspend
-                name: resource_info
-            - groupVersionKind:
-                group: helm.toolkit.fluxcd.io
-                kind: HelmRelease
-                version: v2beta2
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  chart_name:
-                  - spec
-                  - chart
-                  - spec
-                  - chart
-                  chart_source_name:
-                  - spec
-                  - chart
-                  - spec
-                  - sourceRef
-                  - name
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - lastAppliedRevision
-                  suspended:
-                  - spec
-                  - suspend
-                name: resource_info
-            - groupVersionKind:
-                group: source.toolkit.fluxcd.io
-                kind: GitRepository
-                version: v1
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - artifact
-                  - revision
-                  suspended:
-                  - spec
-                  - suspend
-                  url:
-                  - spec
-                  - url
-                name: resource_info
-            - groupVersionKind:
-                group: source.toolkit.fluxcd.io
-                kind: Bucket
-                version: v1beta2
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  bucket_name:
-                  - spec
-                  - bucketName
-                  endpoint:
-                  - spec
-                  - endpoint
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - artifact
-                  - revision
-                  suspended:
-                  - spec
-                  - suspend
-                name: resource_info
-            - groupVersionKind:
-                group: source.toolkit.fluxcd.io
-                kind: HelmRepository
-                version: v1beta2
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - artifact
-                  - revision
-                  suspended:
-                  - spec
-                  - suspend
-                  url:
-                  - spec
-                  - url
-                name: resource_info
-            - groupVersionKind:
-                group: source.toolkit.fluxcd.io
-                kind: HelmChart
-                version: v1beta2
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  chart_name:
-                  - spec
-                  - chart
-                  chart_version:
-                  - spec
-                  - version
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - artifact
-                  - revision
-                  suspended:
-                  - spec
-                  - suspend
-                name: resource_info
-            - groupVersionKind:
-                group: source.toolkit.fluxcd.io
-                kind: OCIRepository
-                version: v1beta2
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  ready:
-                  - status
-                  - conditions
-                  - '[type=Ready]'
-                  - status
-                  revision:
-                  - status
-                  - artifact
-                  - revision
-                  suspended:
-                  - spec
-                  - suspend
-                  url:
-                  - spec
-                  - url
-                name: resource_info
-            - groupVersionKind:
-                group: notification.toolkit.fluxcd.io
-                kind: Alert
-                version: v1beta3
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
-                labelsFromPath:
-                  exported_namespace:
-                  - metadata
-                  - namespace
-                  suspended:
-                  - spec
-                  - suspend
-                name: resource_info
-            - groupVersionKind:
-                group: notification.toolkit.fluxcd.io
-                kind: Provider
-                version: v1beta3
-              metricNamePrefix: gotk
-              metrics:
-              - each:
-                  info:
-                    labelsFromPath:
-                      name:
-                      - metadata
-                      - name
-                  type: Info
-                help: The current state of a GitOps Toolkit resource.
[Diff truncated by flux-local]
--- kubernetes/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-config

+++ kubernetes/apps/observability/kube-prometheus-stack/app Kustomization: flux-system/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-config

@@ -0,0 +1,283 @@

+---
+apiVersion: v1
+data:
+  kube-state-metrics-config.yaml: |
+    kube-state-metrics:
+      fullnameOverride: kube-state-metrics
+      rbac:
+        extraRules:
+          - apiGroups:
+              - source.toolkit.fluxcd.io
+              - kustomize.toolkit.fluxcd.io
+              - helm.toolkit.fluxcd.io
+              - notification.toolkit.fluxcd.io
+              - image.toolkit.fluxcd.io
+            resources:
+              - gitrepositories
+              - buckets
+              - helmrepositories
+              - helmcharts
+              - ocirepositories
+              - kustomizations
+              - helmreleases
+              - alerts
+              - providers
+              - receivers
+              - imagerepositories
+              - imagepolicies
+              - imageupdateautomations
+            verbs: [ "list", "watch" ]
+      customResourceState:
+        enabled: true
+        config:
+          spec:
+            resources:
+              - groupVersionKind:
+                  group: kustomize.toolkit.fluxcd.io
+                  version: v1
+                  kind: Kustomization
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux Kustomization resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, lastAppliedRevision ]
+                      source_name: [ spec, sourceRef, name ]
+              - groupVersionKind:
+                  group: helm.toolkit.fluxcd.io
+                  version: v2beta2
+                  kind: HelmRelease
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux HelmRelease resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, lastAppliedRevision ]
+                      chart_name: [ spec, chart, spec, chart ]
+                      chart_source_name: [ spec, chart, spec, sourceRef, name ]
+              - groupVersionKind:
+                  group: source.toolkit.fluxcd.io
+                  version: v1
+                  kind: GitRepository
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux GitRepository resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, artifact, revision ]
+                      url: [ spec, url ]
+              - groupVersionKind:
+                  group: source.toolkit.fluxcd.io
+                  version: v1beta2
+                  kind: Bucket
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux Bucket resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, artifact, revision ]
+                      endpoint: [ spec, endpoint ]
+                      bucket_name: [ spec, bucketName ]
+              - groupVersionKind:
+                  group: source.toolkit.fluxcd.io
+                  version: v1beta2
+                  kind: HelmRepository
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux HelmRepository resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, artifact, revision ]
+                      url: [ spec, url ]
+              - groupVersionKind:
+                  group: source.toolkit.fluxcd.io
+                  version: v1beta2
+                  kind: HelmChart
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux HelmChart resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, artifact, revision ]
+                      chart_name: [ spec, chart ]
+                      chart_version: [ spec, version ]
+              - groupVersionKind:
+                  group: source.toolkit.fluxcd.io
+                  version: v1beta2
+                  kind: OCIRepository
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux OCIRepository resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      revision: [ status, artifact, revision ]
+                      url: [ spec, url ]
+              - groupVersionKind:
+                  group: notification.toolkit.fluxcd.io
+                  version: v1beta3
+                  kind: Alert
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux Alert resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      suspended: [ spec, suspend ]
+              - groupVersionKind:
+                  group: notification.toolkit.fluxcd.io
+                  version: v1beta3
+                  kind: Provider
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux Provider resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      suspended: [ spec, suspend ]
+              - groupVersionKind:
+                  group: notification.toolkit.fluxcd.io
+                  version: v1
+                  kind: Receiver
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux Receiver resource."
+                    each:
+                      type: Info
+                      info:
+                        labelsFromPath:
+                          name: [ metadata, name ]
+                    labelsFromPath:
+                      exported_namespace: [ metadata, namespace ]
+                      ready: [ status, conditions, "[type=Ready]", status ]
+                      suspended: [ spec, suspend ]
+                      webhook_path: [ status, webhookPath ]
+              - groupVersionKind:
+                  group: image.toolkit.fluxcd.io
+                  version: v1beta2
+                  kind: ImageRepository
+                metricNamePrefix: gotk
+                metrics:
+                  - name: "resource_info"
+                    help: "The current state of a Flux ImageRepository resource."
+                    each:
[Diff truncated by flux-local]

Copy link

--- HelmRelease: observability/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-customresourcestate-config

+++ HelmRelease: observability/kube-prometheus-stack ConfigMap: observability/kube-state-metrics-customresourcestate-config

@@ -25,13 +25,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux Kustomization resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -59,13 +59,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux HelmRelease resource.
           labelsFromPath:
             chart_name:
             - spec
             - chart
             - spec
             - chart
@@ -100,13 +100,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux GitRepository resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -134,13 +134,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux Bucket resource.
           labelsFromPath:
             bucket_name:
             - spec
             - bucketName
             endpoint:
             - spec
@@ -171,13 +171,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux HelmRepository resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -205,13 +205,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux HelmChart resource.
           labelsFromPath:
             chart_name:
             - spec
             - chart
             chart_version:
             - spec
@@ -242,13 +242,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux OCIRepository resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -276,13 +276,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux Alert resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             suspended:
             - spec
@@ -298,13 +298,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux Provider resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             suspended:
             - spec
@@ -320,13 +320,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux Receiver resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -350,13 +350,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux ImageRepository resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             image:
             - spec
@@ -380,13 +380,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux ImagePolicy resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status
@@ -411,13 +411,13 @@

             info:
               labelsFromPath:
                 name:
                 - metadata
                 - name
             type: Info
-          help: The current state of a GitOps Toolkit resource.
+          help: The current state of a Flux ImageUpdateAutomation resource.
           labelsFromPath:
             exported_namespace:
             - metadata
             - namespace
             ready:
             - status

@jfroy jfroy merged commit 96c44f2 into main Apr 27, 2024
54 checks passed
@jfroy jfroy deleted the dev branch April 27, 2024 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant