Skip to content

Instantly share code, notes, and snippets.

@evevseev
Created July 28, 2025 12:51
Show Gist options
  • Select an option

  • Save evevseev/9ce6701c676cf844c8b3118db94da221 to your computer and use it in GitHub Desktop.

Select an option

Save evevseev/9ce6701c676cf844c8b3118db94da221 to your computer and use it in GitHub Desktop.
# Temp fix for https://github.com/cloudnative-pg/cloudnative-pg/issues/7812
kube-state-metrics:
customResourceState:
enabled: true
config:
kind: CustomResourceStateMetrics
spec:
resources:
- groupVersionKind:
group: barmancloud.cnpg.io
version: v1
kind: ObjectStore
labelsFromPath:
namespace: ["metadata", "namespace"]
objectStore: ["metadata", "name"]
metrics:
- name: cnpg_barman_objectstore_first_recoverable_point_timestamp
help: "First recoverable point timestamp (seconds since epoch) per instance"
each:
type: Gauge
gauge:
path: ["status", "serverRecoveryWindow"]
labelsFromPath:
instance: ["__name__"]
valueFrom: ["firstRecoverabilityPoint"]
# Add nilIsZero to handle missing values gracefully
nilIsZero: true
- name: cnpg_barman_objectstore_last_successful_backup_timestamp
help: "Last successful backup timestamp (seconds since epoch) per instance"
each:
type: Gauge
gauge:
path: ["status", "serverRecoveryWindow"]
labelsFromPath:
instance: ["__name__"]
valueFrom: ["lastSuccussfulBackupTime"] # Note: keeping the typo as it exists in your CRD
# Add nilIsZero to handle missing values gracefully
nilIsZero: true
rbac:
extraRules:
# Allow kube-state-metrics to see your ObjectStore CRD
- apiGroups: ["barmancloud.cnpg.io"]
resources: ["objectstores"]
verbs: ["list", "watch"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment