Skip to content

feat(monitoring): add optional PodMonitor and metrics policy - #1

Draft
cooktheryan wants to merge 3 commits into
feat/issue-1302-rollout-operatorfrom
issue-23-monitoring
Draft

cooktheryan wants to merge 3 commits into
feat/issue-1302-rollout-operatorfrom
issue-23-monitoring

Conversation

@cooktheryan

Copy link
Copy Markdown
Owner

Summary

  • add opt-in PodMonitor generation for each managed Praxis data plane
  • add an owner-scoped NetworkPolicy that permits only the configured Prometheus pods to scrape port 9902
  • keep monitoring disabled by default so clusters without the Prometheus Operator CRD continue to reconcile normally
  • add RBAC, deployment configuration, documentation, and resource-builder coverage

Closes praxis-proxy#23

Configuration

Set PRAXIS_MONITORING_ENABLED=true to enable the resources. The monitoring namespace and Prometheus pod label selector are configurable with PRAXIS_MONITORING_NAMESPACE and PRAXIS_MONITORING_POD_SELECTOR.

This PR targets the rollout-contract branch from PR praxis-proxy#24 so the diff is limited to the monitoring follow-up; merge it after that branch lands or retarget it to main once the 9902 metrics contract is available there.

Validation

  • cargo +nightly fmt --check on changed Rust files
  • cargo clippy -p praxis-operator --all-targets -- -D warnings
  • cargo test -p praxis-operator --lib — 477 passed
  • git diff --check

The generated NetworkPolicy intentionally does not restrict the data listener. Clusters whose CNI applies policy to node-originated kubelet probes need a separate node-CIDR allowance.

@cooktheryan
cooktheryan force-pushed the feat/issue-1302-rollout-operator branch 3 times, most recently from 6a11771 to 0dd3490 Compare November 4, 2026 20:35
@cooktheryan
cooktheryan force-pushed the issue-23-monitoring branch 4 times, most recently from bc6bf87 to 68c479b Compare November 6, 2026 16:54
Opt-in PodMonitor and metrics-only NetworkPolicy for managed data
planes, with ownership-checked cleanup when monitoring is disabled or no
usable listeners remain. The reserved metrics port 9902 stays out of the
data-plane listeners and Service ports, and a listener requesting it is
rejected without blocking valid siblings.

The metrics contract moves the admin endpoint to a dedicated
admin.metrics_address, so health and metrics no longer need public admin
access. Only this monitoring work and its contract stay in this change;
the HA rollout, rollout-test, routing, hostname, route-status, and
deployment rollout-policy changes live in the rollout branch.

Signed-off-by: Ryan Cook <rcook@redhat.com>
Signed-off-by: Ryan Cook <rcook@redhat.com>
- Pass the borrowed usable listeners into route attachment and namespace
  filtering; both helpers now accept Borrow<GatewayListeners>, so a
  reconcile no longer clones every listener.
- Terminate a listener with no routes with a 404 static response, which
  Praxis 0.7.5 needs instead of an empty router chain, and update the
  generate tests accordingly.
- Compare the recreated NetworkPolicy and PodMonitor with their expected
  specs after the listener is restored, not only their existence.
- Run the monitoring test's enabled and disabled-cleanup phases in CI,
  installing the PodMonitor CRD and toggling the operator Deployment's
  PRAXIS_MONITORING_ENABLED between runs; the disabled no-CRD phase
  already runs with the integration suite.

Signed-off-by: Ryan Cook <rcook@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant