fix: add monitoring ingress to Keycloak NetworkPolicy + use internal probe URL #116
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!116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "111-fix-keycloak-probe"
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
The Keycloak blackbox probe was failing because (1) the Keycloak NetworkPolicy blocked traffic from the monitoring namespace where the blackbox exporter runs, and (2) the probe target used the external Tailscale URL instead of the internal cluster service URL.
Changes
terraform/network-policies.tf: Addedmonitoringnamespace ingress rule tonetpol_keycloak, matching the pattern used by every other platform service (forgejo, woodpecker, harbor, minio, etc.)terraform/main.tf: Changed Keycloak blackbox probe target fromhttps://keycloak.tail5b443a.ts.nettohttp://keycloak.keycloak.svc.cluster.local:80, consistent with all other platform service probesTest Plan
tofu fmtpasses (verified)tofu validatepasses (verified)tofu planshows NetworkPolicy update adding monitoring ingress (verified)kubectl get networkpolicy -n keycloak -o yamlReview Checklist
Related
plan-pal-e-platformtofu plan Output
Note: The probe URL change is inside Helm values for kube_prometheus_stack and will show as a Helm release update during full apply.
QA Review -- PR #116
Diff Summary
2 files changed, +2 / -1. Minimal, surgical fix.
Review Findings
terraform/network-policies.tf
monitoringnamespace ingress rule tonetpol_keycloak. This matches the exact pattern used by every other platform service NetworkPolicy (forgejo, woodpecker, harbor, minio, postgres, cnpg-system). Keycloak was the only one missing it. Correct.terraform/main.tf
https://keycloak.tail5b443a.ts.net(external Tailscale URL) tohttp://keycloak.keycloak.svc.cluster.local:80(internal cluster URL). This is consistent with all other platform probes (forgejo, harbor, argocd, minio). The service namekeycloakin namespacekeycloakon port 80 matches thekubernetes_service_v1.keycloakresource definition. Correct.Checks
tofu fmt-- cleantofu validate-- passestofu plan-- shows expected NetworkPolicy update (1 change)Closes #111Nits
None.
VERDICT: APPROVE
PR #116 Review
DOMAIN REVIEW
Tech stack: Terraform (OpenTofu) / Kubernetes NetworkPolicies / Helm values
NetworkPolicy change (
network-policies.tf):namespaceSelectorwithkubernetes.io/metadata.name = "monitoring".tailscalerule is consistent with other policies that have monitoring ingress.depends_onreference tokubernetes_namespace_v1.keycloakis unchanged and correct.Probe URL change (
main.tf):https://keycloak.tail5b443a.ts.net(external Tailscale funnel) tohttp://keycloak.keycloak.svc.cluster.local:80(cluster-internal).main.tf: service name iskeycloak, namespace iskeycloak, port is 80. The URLhttp://keycloak.keycloak.svc.cluster.local:80is correct.svc.cluster.localURLs. The external URLs are reserved for app-tier probes (pal-e-docs, pal-e-app) which intentionally validate the full funnel path.httpstohttpis correct: internal cluster traffic does not go through Tailscale TLS termination.Terraform hygiene:
tofu planoutput in the PR body confirms: 0 to add, 1 to change, 0 to destroy. Clean in-place update.tofu fmtandtofu validatereported as passing.kubernetes_manifestresource is updated in-place.BLOCKERS
None.
This is a 2-line infrastructure fix with no new functionality requiring tests. The changes are pure configuration -- NetworkPolicy ingress rules and a probe URL. The test plan appropriately includes post-apply verification steps (Prometheus target status, kubectl NetworkPolicy inspection).
NITS
None.
SOP COMPLIANCE
111-fix-keycloak-probereferences issue #111plan-pal-e-platformreferenced, closes #111fix: ...)tofu planoutput included in PR body per repo conventionsPROCESS OBSERVATIONS
VERDICT: APPROVED
PR #116 Stale PR Audit
FINDINGS
Both changes proposed by this PR are already present in main via other paths:
1. Keycloak NetworkPolicy monitoring ingress -- Already on main at
terraform/network-policies.tfline 135:Main also has a
basketball-apiingress rule (line 134) that this branch lacks, confirming the branch is based on a stale version of main.2. Keycloak blackbox probe URL -- The PR changes from
https://keycloak.tail5b443a.ts.nettohttp://keycloak.keycloak.svc.cluster.local:80. Main already uses an even more specific internal URL:http://keycloak.keycloak.svc.cluster.local:80/realms/master(line 440).The PR is marked
mergeable: false(conflicts with main), which corroborates that these changes landed through a different path.RECOMMENDATION
CLOSE this PR. All proposed changes are already in main. Issue #111 is correctly marked done on the board. This PR is stale and would only introduce merge conflicts.
VERDICT: NOT APPROVED
Reason: PR is stale -- all changes already landed in main via other work. Recommend closing without merge.
Closing — both changes in this PR already landed in main via other PRs:
network-policies.tf:135main.tf:440(uses/realms/masterpath)PR has merge conflicts confirming the work was done another way. Related issue #111 is done on the board.
Pull request closed