diff --git a/charts/cnpg-monitoring/.helmignore b/charts/cnpg-monitoring/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/cnpg-monitoring/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/cnpg-monitoring/Chart.lock b/charts/cnpg-monitoring/Chart.lock new file mode 100644 index 0000000..636bdca --- /dev/null +++ b/charts/cnpg-monitoring/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: kube-state-metrics + repository: https://prometheus-community.github.io/helm-charts + version: 5.25.1 +digest: sha256:44ef0e594a43e89ac37d87b317983705a7318e177bc1c97ce11e8bfcb9322e54 +generated: "2024-08-01T10:01:05.918725051+02:00" diff --git a/charts/cnpg-monitoring/Chart.yaml b/charts/cnpg-monitoring/Chart.yaml new file mode 100644 index 0000000..dfcd58a --- /dev/null +++ b/charts/cnpg-monitoring/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: cnpg-monitoring +description: A kube-state-metrics to generate and expose CNPG resources metrics +type: application +version: 0.1.0 +dependencies: + - name: kube-state-metrics + version: "5.25.*" + repository: https://prometheus-community.github.io/helm-charts diff --git a/charts/cnpg-monitoring/values.yaml b/charts/cnpg-monitoring/values.yaml new file mode 100644 index 0000000..0133722 --- /dev/null +++ b/charts/cnpg-monitoring/values.yaml @@ -0,0 +1,101 @@ +kube-state-metrics: + prometheus: + monitor: + enabled: true + jobLabel: "app.kubernetes.io/instance" + collectors: [ ] + extraArgs: + - --custom-resource-state-only=true + rbac: + extraRules: + - apiGroups: + - postgresql.cnpg.io + resources: + - clusters + - poolers + - scheduledbackups + verbs: [ "list", "watch" ] + + customResourceState: + enabled: true + config: + spec: + resources: + - groupVersionKind: + group: postgresql.cnpg.io + version: v1 + kind: Cluster + metricNamePrefix: cnpg_resource_cluster + metrics: + - name: info + help: Information about CNPG Cluster + each: + type: Info + info: + labelsFromPath: + cnpg_commit_hash: [status, cloudNativePGCommitHash] + primary_update_method: [spec, primaryUpdateMethod] + primary_update_strategy: [spec, primaryUpdateStrategy] + - name: condition + help: The condition of a CNPG Cluster + each: + type: Gauge + gauge: + path: [status, conditions] + labelsFromPath: + type: [type] + reason: [reason] + valueFrom: [status] + - name: spec_instances + help: Number of desired instances for a CNPG Cluster + each: + type: Gauge + gauge: + path: [spec, instances] + - name: status_instances + help: Number of instances per CNPG Cluster + each: + type: Gauge + gauge: + path: [status, instances] + - name: status_ready_instances + help: Number of ready instances per CNPG Cluster + each: + type: Gauge + gauge: + path: [status, readyInstances] + labelsFromPath: + name: [metadata, name] + namespace: [metadata, namespace] + cnpg_cluster: [metadata, name] + - groupVersionKind: + group: postgresql.cnpg.io + version: v1 + kind: Pooler + metricNamePrefix: cnpg_resource_pooler + metrics: + - name: info + help: Information about CNPG Pooler + each: + type: Info + info: + labelsFromPath: + type: [spec, type] + paused: [spec, pgbouncer, paused] + pool_mode: [spec, pgbouncer, poolMode] + - name: spec_instances + help: Number of desired instances for a CNPG Pooler + each: + type: Gauge + gauge: + path: [spec, instances] + - name: status_instances + help: Number of instances per CNPG Pooler + each: + type: Gauge + gauge: + path: [status, instances] + labelsFromPath: + name: [metadata, name] + namespace: [metadata, namespace] + cnpg_cluster: [spec, cluster, name]