← Back to Pull requests

feat: support request-aware registry configuration #160

Closed
unknown closed this pull request without merging on Oct 16, 2026 02:50 UTC
View on GitHub
unknown unknown commented on Oct 15, 2026 04:43 UTC
Author

Consumers that apply request-specific registry checks currently need to rebuild the SDK credential chain or copy registry client code. This change lets them keep those operations in the SDK while supplying a transport and a wrapper around the completed credential chain.

WithKeychainWrapper runs after Secret/provider/custom-keychain composition and preserves contextual resolution. NewRemoteOptions supplies reusable options without capturing a request context or puller/pusher; image loaders bind each evaluation context when making a request.

Secret keychains now implement authn.ContextKeychain and forward the request context when the caller-supplied namespace lister implements the optional ContextSecretNamespaceLister.GetWithContext method. Ordinary informer listers keep using their in-memory Get. The existing refresh behavior is preserved: the reusable outer keychain stores lister/reference configuration, and each resolution rereads the current Secrets and builds its inner credential keychain. Informer-backed credentials reflect updates after the cache receives them. Missing Secrets are skipped; other lookup failures stop resolution. Cancellation is checked before each read and before returning credentials or allowing fallback.

Existing constructor defaults, the Client interface, credential precedence, tracing and provider selection are preserved. Cloud-provider HTTP-client configuration remains a separate concern.

Included transport changes

This PR includes both commits from #142 as cherry-picks:

  • 81a982b: adds WithTransport for custom registry HTTP transports.

  • 03e4868: adds the transport wiring test.
  • Nishant JS's original authorship and DCO signoffs are preserved. This PR adds completed-keychain wrapping, request-aware Secret resolution and reusable remote options on top; those additional changes are available as a separate comparison.

    This PR is self-contained and can merge without merging #142 separately. If this PR is merged, #142 can be closed as superseded because its implementation and test are already included here.

    Kyverno consumers

  • The dependent drafts kyverno/kyverno#17917 and #17922 already use the transport, completed-keychain wrapper and reusable options. Kyverno retains its registry destination checks while the SDK owns registry fetching and credential composition. Their current setupRegistryClient paths still supply informer listers.

  • The separate credential-scope PRs #17919 and #17923 explicitly scope the supplied lister to a policy namespace. Their namespace getter checks the cache, then performs a live Secret GET on NotFound using the evaluation context. Those branches currently use a local context-aware keychain bridge; this SDK hook lets us remove that duplication when integrating them. The live getter is not yet wired into the migration drafts. The SDK does not select live access from a namespace string or implement namespace authorization.

  • Azure/Flux provider behavior is unchanged. SDK follow-ups #156 and #157 are deferred and are not prerequisites for this PR.
  • Validation

  • GOTOOLCHAIN=go1.26.9 go test -race -count=1 -p 2 ./extensions/regcreds ./extensions/registryclient passed.

  • Regressions cover cancellation before/between reads, cancellation during a final cache read (success, NotFound or another error), empty Secret lists, and no credential fallback after cancellation. A real client-go informer lister/indexer verifies credential rotation with the same outer keychain and all supported reference formats.

  • Existing focused tests also cover registry/token/redirect transport, rejection before credential resolution, wrapper order, request context propagation, missing backends, and lookup-error handling.

  • Repository-wide golangci-lint with the SDK's default configuration passed with zero findings. SDK make fmt, changed-file import formatting and whitespace checks passed.
  • No live cloud exchange or deployed conformance run is claimed.

    Assisted by OpenAI Codex.

    Diff: 562 lines (+421 / -141) across 7 files Reviewer: JimBugwadia Review duration: 1327m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.73) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 562 lines diff across 7 files
    0.73
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    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.379
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.073
    Real PR Conversation Timeline
    1 comments
    "Review active on #160"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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: 72.9% (HIGH) · Higher = larger blast radius
    72.9%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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: 31.5% · Safe to merge
    31.5%
    Repository