fix: add default-deny-ingress NetworkPolicy for basketball-api #269
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!269
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "268-add-default-deny-ingress-networkpolicy-f"
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
Adds a default-deny-ingress NetworkPolicy for the basketball-api namespace, closing the only security gap among service namespaces. Investigation of forgejo_admin/basketball-api#343 confirmed the Tailscale Funnel is correctly configured and routing public traffic — the webhook delivery failures correlate with pod downtime during
Recreatestrategy deployments, not a funnel misconfiguration.Changes
terraform/network-policies.tf— addednetpol_basketball_apiresource allowing ingress fromtailscaleandmonitoringnamespaces only, matching the pattern used by all other service namespacesInvestigation Findings
/webhooks/stripevia public IP returns 400 "Missing stripe-signature header" — proving full reachability.Recreatedeployments (7+ minutes of errors on 2026-04-04 22:40-22:47 UTC).nodeAttrsgrants funnel to alltag:k8snodes. The proxy pod hasAllowFunnel: trueand the serve config matches the ClusterIP.tofu plan Output
Discovered Scope
The root cause of Stripe webhook failures is pod downtime during
Recreatedeployments, not a funnel issue. Changing toRollingUpdatestrategy would eliminate webhook delivery gaps during deploys — this is a pal-e-deployments change (separate ticket).Test Plan
tofu fmt— passedtofu validate— passedtofu plan -lock=false— 1 to add, 0 to change, 0 to destroykubectl get networkpolicy -n basketball-apireturnsdefault-deny-ingressReview Checklist
tofu fmtruntofu validatepassestofu plan -lock=falseoutput includedRelated Notes
Related
QA Review
Verdict: APPROVED
Diff Review
kubernetes_manifest.netpol_basketball_apifield_manager { force_conflicts = true }-- consistenttailscale(funnel proxy) andmonitoring(Prometheus) -- minimum requirednetpol_ollamaandnetpol_stagingis logicalValidation
tofu fmt-- clean (no formatting changes needed)tofu validate-- passedtofu plan -lock=false-- 1 to add, 0 to change, 0 to destroyInvestigation Quality
The PR body documents thorough investigation of basketball-api#343:
No issues found.
PR #269 Review
DOMAIN REVIEW
Tech stack: Terraform (OpenTofu) / Kubernetes NetworkPolicy
Pattern compliance: The new
netpol_basketball_apiresource exactly matches the established pattern used by all 10 existing netpol resources interraform/network-policies.tf:field_manager { force_conflicts = true }-- presentkubernetes_manifestresource type -- correctpodSelector = {}(all pods in namespace) -- correctpolicyTypes = ["Ingress"]-- correct (egress unrestricted per file header comment)tailscale+monitoringnamespaces onlyNamespace reference: Uses hardcoded string
"basketball-api"rather than a module output. This is correct -- basketball-api is deployed via pal-e-deployments/ArgoCD, not by this bootstrap repo, so no module output exists for it. Same pattern would apply to any externally-managed namespace.Ingress rule correctness: The two allowed namespaces are correct and sufficient:
tailscale-- required for funnel-routed public traffic (Stripe webhooks, client requests)monitoring-- required for Prometheus scrapingArgoCD does not need direct pod ingress (it works via the k8s API server). Woodpecker CI does not need to reach running basketball-api pods. No other namespace-to-namespace traffic is needed.
Terraform quality:
tofu planoutput in PR body shows clean1 to add, 0 to change, 0 to destroytofu fmtandtofu validateboth passed per PR body-lock=falseused in plan (per convention)BLOCKERS
None.
NITS
netpol_ollama(line 200) andnetpol_staging(line 203). The file does not follow strict alphabetical order (monitoring, forgejo, woodpecker, harbor, minio, keycloak, postgres, ollama, basketball_api, staging, cnpg_system), so this placement is fine, but a future cleanup could alphabetize. Non-blocking.SOP COMPLIANCE
268-add-default-deny-ingress-networkpolicy-freferences issue #268)tofu fmtruntofu validatepassestofu plan -lock=falseoutput includedPROCESS OBSERVATIONS
tofu applywith no dependencies.VERDICT: APPROVED