Skip to content

chore: updating the prometheus rules to remove errors#822

Open
drew-viles wants to merge 1 commit intocloudnative-pg:mainfrom
nscaledev:promrules-fix
Open

chore: updating the prometheus rules to remove errors#822
drew-viles wants to merge 1 commit intocloudnative-pg:mainfrom
nscaledev:promrules-fix

Conversation

@drew-viles
Copy link

The prometheus rules are causing validating errors when trying to apply them (in my case via GitOps tooling - ArgoCD).

one or more objects failed to apply, reason: admission webhook "prometheusrulemutate.monitoring.coreos.com" denied the request: Rules are not valid (retried 5 times).

To check what was going on, I've templated out the helm chart and grabbed the rules from the PrometheusRule. I've then fed this into promtool check rules to find out why it is erroring.

promtool check rules tmp.yaml
Checking tmp.yaml
  FAILED:
tmp.yaml: 180:15: group "cloudnative-pg/postgres-cluster", rule 7, "CNPGClusterLogicalReplicationErrorsCritical": could not parse expression: 1:147: parse error: ranges only allowed for vector selectors
tmp.yaml: 204:15: group "cloudnative-pg/postgres-cluster", rule 8, "CNPGClusterLogicalReplicationErrors": could not parse expression: 1:147: parse error: ranges only allowed for vector selectors
tmp.yaml: 291:15: group "cloudnative-pg/postgres-cluster", rule 11, "CNPGClusterLogicalReplicationStoppedCritical": could not parse expression: 5:125: parse error: binary expression must contain only scalar and instant vector types
tmp.yaml: 320:15: group "cloudnative-pg/postgres-cluster", rule 12, "CNPGClusterLogicalReplicationStopped": could not parse expression: 5:125: parse error: binary expression must contain only scalar and instant vector types

I've applied changes in the PR and now the rules are coming back clean.

promtool check rules tmp.yaml
Checking tmp.yaml
  SUCCESS: 18 rules found

Argo now syncs the rules correctly and the PrometheusRule is valid.

@drew-viles drew-viles requested a review from itay-grudev as a code owner March 3, 2026 08:37
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working chart( cluster ) Related to the cluster chart labels Mar 3, 2026
Signed-off-by: Drew Hudson-Viles <drew@hudson-viles.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chart( cluster ) Related to the cluster chart size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant