fix: add monitoring ingress to Keycloak NetworkPolicy + use internal probe URL #117
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-platform!117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "111-keycloak-probe-networkpolicy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the Keycloak blackbox probe alert by adding monitoring namespace ingress to the Keycloak NetworkPolicy and switching the probe URL from the external HTTPS endpoint to the cluster-internal HTTP endpoint with a
/realms/masterhealth path.Changes
terraform/network-policies.tf: Addedmonitoringnamespace tonetpol_keycloakingress rules, matching the pattern used by every other service NetworkPolicy in the fileterraform/main.tf: Changed Keycloak blackbox probe URL fromhttps://keycloak.tail5b443a.ts.nettohttp://keycloak.keycloak.svc.cluster.local:80/realms/mastertofu plan Output
Plan shows the two expected changes from this PR (plus 4 unrelated state drift items from #113):
The 4 additional changes are state drift from previously merged PRs (tracked in #113), not introduced by this PR.
Test Plan
tofu plan -lock=falseshows only expected keycloak-related changes from this PRBlackboxProbeFailedalert for keycloak clears within 2 minutesprobe_success{instance="keycloak"}returns 1 in PrometheusReview Checklist
tofu fmt-- no formatting changes neededtofu validate-- passestofu plan -lock=false-- only expected changes, 0 to add, 0 to destroyRelated
plan-pal-e-platformCloses #111
Self-review: LGTM
Two-line change, both following established patterns:
NetworkPolicy (
network-policies.tf): Addedmonitoringnamespace ingress tonetpol_keycloak. Every other service in this file (forgejo, woodpecker, harbor, minio, cnpg-system) already has this rule -- keycloak was the only one missing it.Probe URL (
main.tf): Changed from externalhttps://keycloak.tail5b443a.ts.netto internalhttp://keycloak.keycloak.svc.cluster.local:80/realms/master. The/realms/masterpath validates Keycloak is actually serving its realm, not just that the HTTP port is open.tofu planconfirmed only these two resources change (plus 4 unrelated state drift items from #113). No issues found.PR #117 Review
DOMAIN REVIEW
Tech stack: Terraform (OpenTofu) / Kubernetes NetworkPolicies / Helm (blackbox exporter)
NetworkPolicy change (
terraform/network-policies.tf):monitoringnamespace ingress tonetpol_keycloak. This exactly matches the pattern used by every other platform service NetworkPolicy in the file (forgejo L45, woodpecker L66, harbor L88, minio L111, postgres L153, cnpg-system L192). Keycloak was the only service missing it. Correct fix.Blackbox probe URL change (
terraform/main.tf):https://keycloak.tail5b443a.ts.net(external, Tailscale funnel) tohttp://keycloak.keycloak.svc.cluster.local:80/realms/master(cluster-internal).svc.cluster.localURLs./realms/masterpath is a valid Keycloak health endpoint that returns 200 when the service is ready. Good choice over the bare root URL which would 302 redirect.Scope: Both changes are tightly scoped to the issue. No drift, no unrelated modifications.
BLOCKERS
None.
NITS
Merge conflict: PR shows
mergeable: false. This is likely caused by PR #120 (basketball-api ingress to keycloak) which merged into the same region ofnetwork-policies.tfafter this PR was created. The branch needs a rebase againstmainbefore merge.Duplicate PR #116: PR #116 has the identical title. If it is a stale duplicate, it should be closed to keep the PR list clean.
SOP COMPLIANCE
111-keycloak-probe-networkpolicyreferences issue #111)plan-pal-e-platformplan slugtofu fmtandtofu validateconfirmed passingtofu plan -lock=falseoutput included with explanation of unrelated drift (#113)PROCESS OBSERVATIONS
BlackboxProbeFailedalert for keycloak. Fast fix, minimal risk. Good MTTR contribution.VERDICT: APPROVED
Clean, minimal fix. Both changes follow established patterns in the codebase. No blockers. Rebase against
mainrequired to resolve the merge conflict from PR #120 before merge.8c947597e9d595bd94c7