← Back to Pull requests

k8s/dev: back registry-service-portal with PVC and protect service-portal caches from DinD eviction #861

Open
codebot-robot opened this pull request with 183 lines diff across 5 files
View on GitHub
codebot-robot codebot-robot commented on Dec 04, 2026 03:23 UTC
Author

Summary

  • Add eval-runner-service-portals namespace (PSA restricted) to k8s/00-namespaces.yaml.

  • Add k8s/registry-service-portal.yaml with:

  • - Shared eval-runner-service-portal PriorityClass (value: 1000000) so kubelet evicts default-priority sandbox pods before shared registries/caches.
    - 50Gi ReadWriteOnce PersistentVolumeClaim backing /var/lib/registry with strategy.type: Recreate (and rollingUpdate: null) instead of emptyDir.
    - Explicit CPU/memory requests and limits (100m/256Mi requests, 1/1Gi limits — avoiding BestEffort QoS), cluster-autoscaler.kubernetes.io/safe-to-evict: "false", restricted securityContext, and required nodeAffinity excluding eval-runner.gke-labs.dev/kind=true DinD worker nodes.
    - registry-service-portal Service on port 5000.
  • Add idempotent dev/tasks/configure-service-portals (with unit/CLI tests in dev/tasks/test-configure-service-portals) and invoke it from dev/tasks/deploy-to-kube to apply the same PriorityClass, safe-to-evict: "false", nodeAffinity off eval-runner.gke-labs.dev/kind=true, and non-BestEffort CPU/memory requests & limits to existing caching service-portal Deployments (registry-service-portal, ocicache-service-portal, goproxy-service-portal, httpcache-service-portal).

  • Add Go manifest verification tests in pkg/controller/service_portal_manifest_test.go.

  • Document k8s/registry-service-portal.yaml, caching service-portal protection, and the durability contract between prebuild done.json markers and EVAL_IMAGE_REGISTRY in docs/architecture.md, docs/development.md, and dev/tasks/README.md.
  • Fixes #858

    Verification

  • ./dev/ci/presubmits/ap-build passed

  • ./dev/ci/presubmits/ap-lint passed

  • ./dev/ci/presubmits/ap-verify-generate passed

  • ./dev/ci/presubmits/ap-test passed (including test-configure-service-portals, test-evals, and pkg/controller/service_portal_manifest_test.go)

  • IMAGE_PREFIX=images.local ./dev/tasks/deploy --dry-run passed
  • Diff: 183 lines (+181 / -2) across 5 files Reviewer: justinsb Review duration: 517m
    All Vouch review confidence checks passed
    Residual risk 0.09 = Change Risk (0.63) × (1 − Review Confidence (0.85)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 183 lines diff across 5 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.89 · 1 substantive comment(s)
    0.89
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    85%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.312
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    8 items
    kube-eval-runner[bot] kube-eval-runner[bot] commented on Dec 04, 2026 03:23 UTC
    Bot

    <!-- eval-runner:comparison:eval-runner/pr-861 -->

    INCONCLUSIVE · P(improvement) = 0.50

    INCONCLUSIVE: 6 task(s) inconclusive; more samples recommended; tasks not executed by both runs: terminal-bench/polyglot-c-py, terminal-bench/regex-log

    | eval | affinity | base | this PR | Δ (95% CI) | label | samples | tokens | W/L/T | P(imp) |
    | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
    | docs/readme\_comprehension | matched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | unchanged | 8 | 370999 (+R 2197) | 0/0/8 | 0.50 |
    | docs/readme\_comprehension\_blind | matched | 0.50 | 0.50 | +0.00 [+0.00, +0.00] | unchanged | 8 | 13230 (+R 11262) | 0/0/8 | 0.50 |
    | terminal-bench/fix-code-vulnerability | unmatched | 0.00 | 1.00 | +1.00 [+1.00, +1.00] | inconclusive | 1 | 2870338 | 1/0/0 | 0.75 |
    | terminal-bench/fix-code-vulnerability/oracle | unmatched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | inconclusive | 1 | — | 0/0/1 | 0.50 |
    | terminal-bench/log-summary-date-ranges | unmatched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | inconclusive | 1 | 1928273 | 0/0/1 | 0.50 |
    | terminal-bench/log-summary-date-ranges/oracle | unmatched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | inconclusive | 1 | — | 0/0/1 | 0.50 |
    | terminal-bench/polyglot-c-py/oracle | unmatched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | inconclusive | 1 | — | 0/0/1 | 0.50 |
    | terminal-bench/regex-log/oracle | unmatched | 1.00 | 1.00 | +0.00 [+0.00, +0.00] | inconclusive | 1 | — | 0/0/1 | 0.50 |

    22 of 44 possible samples · paired against base commit 9e12fb4 · 2 matched · trajectories · web view
    p50 latency −77%

    justinsb justinsb commented on Dec 04, 2026 03:32 UTC
    Reviewer

    (Automatic review) Clean design overall (PVC + Recreate with rollingUpdate: null, PriorityClass, kind-node anti-affinity, PSA restricted namespace, and idempotent configure-service-portals helper). Two items to fix before approval:

    1. Missing REGISTRY_HTTP_RELATIVEURLS: "true" in k8s/registry-service-portal.yaml: registry:2 behind the TLS-terminating service portal must set REGISTRY_HTTP_RELATIVEURLS: "true" so blob upload Location headers are relative rather than http://registry-service-portal...:5000/... (without it, HTTPS Docker/BuildKit pushes fail; this env var is set on the live cluster). Please add REGISTRY_HTTP_RELATIVEURLS: "true" to the registry container env in k8s/registry-service-portal.yaml and assert it in pkg/controller/service_portal_manifest_test.go.
    2. Gate registry-service-portal rollout wait on SKIP_SERVICE_PORTAL != "true" in dev/tasks/deploy-to-kube: Currently lines 471 and 479 unconditionally run kubectl -n eval-runner-service-portals rollout status deployment/registry-service-portal --timeout=300s even when --skip-service-portal is passed. Please gate that rollout wait on [[ "${SKIP_SERVICE_PORTAL}" != "true" ]] (matching the configure-service-portals block right below it).

    justinsb justinsb approved these changes on Dec 04, 2026 10:50 UTC
    Approved Reviewer

    (Automatic review) LGTM on 71e934ee (all 5/5 ap-* checks green). Both review items addressed (REGISTRY_HTTP_RELATIVEURLS: "true" + manifest test, and SKIP_SERVICE_PORTAL != "true" gate in deploy-to-kube). Ready for merge.

    justinsb justinsb requested changes on Dec 04, 2026 11:10 UTC
    Changes Requested Reviewer

    (Automatic review) Please remove dev/tasks/test-configure-service-portals — we do not want unit test scripts under dev/tasks/ testing helper scripts ("test for a test"). Everything else looks good.

    justinsb justinsb commented on Dec 04, 2026 11:12 UTC
    Reviewer

    (Automatic review) Please also remove pkg/controller/service_portal_manifest_test.go — it only mirrors the static YAML fields in k8s/00-namespaces.yaml and k8s/registry-service-portal.yaml rather than testing controller behavior.

    justinsb justinsb commented on Dec 04, 2026 11:25 UTC
    Reviewer

    (Automatic review) Thanks for removing the test scripts. Looking at the overall diff, we can simplify this PR dramatically further:

    dev/tasks/deploy-to-kube does not deploy ocicache-service-portal, goproxy-service-portal, or httpcache-service-portal (those live in gke-labs/service-portals), so adding a 419-line Python patching script (dev/tasks/configure-service-portals) is way more machinery than needed here.

    Please remove:

  • dev/tasks/configure-service-portals

  • Its invocation in dev/tasks/deploy-to-kube

  • Its section in dev/tasks/README.md
  • Keep this PR focused and small:
    1. k8s/00-namespaces.yaml (eval-runner-service-portals namespace)
    2. k8s/registry-service-portal.yaml (PriorityClass, 50Gi PVC, Deployment with Recreate, REGISTRY_HTTP_RELATIVEURLS=true, kind-node anti-affinity, requests/limits, safe-to-evict: false, and Service)
    3. The SKIP_SERVICE_PORTAL != "true" rollout status wait in dev/tasks/deploy-to-kube
    4. A short note in docs/development.md / docs/architecture.md mentioning that operators running optional gke-labs/service-portals caches can attach the same eval-runner-service-portal PriorityClass and kind-node anti-affinity.

    justinsb justinsb approved these changes on Dec 04, 2026 11:57 UTC
    Approved Reviewer

    (Automatic review) LGTM on 77202275 (5/5 ap-* checks green). Super clean (~180 lines across 5 files): eval-runner-service-portals namespace, PVC-backed registry-service-portal with REGISTRY_HTTP_RELATIVEURLS=true, PriorityClass, kind-node anti-affinity, gated rollout wait in deploy-to-kube, and concise docs. Ready for merge.

    Reviewers
    Assignees
    codebot-robot codebot-robot
    Labels
    risk: low confidence: 85.4% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 63.2% (MEDIUM) · Higher = larger blast radius
    63.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.4% · Lower = rushed or shallow review
    85.4%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 9.3% · Safe to merge
    9.3%