← Back to Pull requests

fix(cache): propagate runtime-level podMetadata and imagePullSecrets to component pods #6188

Closed
unknown closed this pull request without merging on Sep 29, 2026 03:30 UTC
View on GitHub
unknown unknown commented on Sep 06, 2026 05:53 UTC
Author

Ⅰ. Describe what this PR does

CacheRuntimeSpec has two runtime-level fields whose doc comments say they apply to every
component:

// api/v1alpha1/cacheruntime_types.go:160
// PodMetadata contains labels and annotations that will be propagated to all component pods.
PodMetadata PodMetadata `json:"podMetadata,omitempty"`

// api/v1alpha1/cacheruntime_types.go:164
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`

They are in the CRD and the API server takes them, but the transform path does not read
either. transformComponentPodTemplate composes a component's pod template from the
CacheRuntimeClass template and the component-level RuntimeComponentCommonSpec; the
runtime-level layer is not one of its arguments, so it never enters. Setting both fields on a
CacheRuntime is accepted, and then nothing lands on the pod:

imagePullSecrets            = []
labels.from-runtime-level   = []     <- spec.podMetadata
labels.from-component-level = [yes]  <- spec.worker.podMetadata  (control)
annotations.owner           = []     <- spec.podMetadata

The component-level control landing is what narrows it: template rendering and the manifest
are fine, only the middle layer goes missing. imagePullSecrets is the one likely to hurt —
the kubelet gets no credentials for a component image behind a private registry, and the pull
failure names the image and the registry rather than the field that was dropped, so the runtime
spec is not an obvious place to look.

Approach. podMetadata has the same three-layer shape as spec.options, which already
composes all three layers (cm.go:146), so it is given the same order here: CacheRuntimeClass
template < runtime level < component level. UnionMapsWithOverride copies both operands and
tolerates nil, so the old != nil guards around the component layer are no longer needed.

imagePullSecrets has no component-level counterpart, so there is no precedence to settle.
The runtime-level list is appended onto whatever the template declares, skipping names that
are already there. The CRD marks the field +patchStrategy=merge +patchMergeKey=name, which
I read as a name declared at both layers being one entry rather than two. Replacing the
template's list outright would be defensible too, but that seemed more likely to surprise an
owner whose class template already pins a registry secret — happy to switch if maintainers
prefer the simpler rule.

Master, worker and client all go through transformComponentPodTemplate, so all three call
sites now pass runtime.Spec.

One thing this does not do: both fields are read on the transform path, which runs at setup,
so editing either on a live CacheRuntime still has no effect — syncRuntimeSpec handles
runtimeVersion, resources and replicas only. That looks like a separate change, and it
is part of what #6185 is about.

Ⅱ. Does this pull request fix one issue?

fixes #6184

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

transform_common_test.go covers transformComponentPodTemplate directly:

  • pod metadata — the template's labels and annotations survive when neither spec sets any;

  • the runtime level alone reaches the pod; the component level alone reaches the pod; all
    three layers union, and a key declared at more than one layer takes the value from the
    latest one.
  • image pull secrets — the template's secrets survive when the runtime names none; the

  • runtime-level list alone reaches the pod; both layers merge, and a name declared at both
    appears once.

    composition_matrix_test.go is the executable form of the composition table in #6185. Each
    row states what the three layers declare and what the component should end up with, and every
    row is replayed through both paths that compose them — the transform path on create and the
    sync path on update — since the two are written independently and are expected to agree.

    Rows tagged knownBug pin current behaviour rather than intended behaviour, so that a
    change to any of them shows up in review; each names the issue that will change it and what
    it should say afterwards (#6173 for resources, #6178 for runtimeVersion, and the
    env/nodeSelector mismatches under #6185). If #6177 merges first, the #6173 row is the
    one that will need updating.

    Rows for fields the sync path does not patch are restricted to the create path, which is
    stated per row rather than left implicit.

    Existing specs in the package are unchanged. The 12 failures in ufs_test.go and
    sync_test.go on this package are present on master as well and are unrelated to these
    changes.

    Diff: 592 lines (+444 / -148) across 7 files Reviewer: cheyang Review duration: 32976m
    All Vouch review confidence checks passed
    Residual risk 0.33 = Change Risk (0.73) × (1 − Review Confidence (0.54)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.73 · 592 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%
    54%
    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.382
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.073
    Real PR Conversation Timeline
    1 comments
    "Review active on #6188"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 54.2% 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: 73.2% (HIGH) · Higher = larger blast radius
    73.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: 54.2% · Lower = rushed or shallow review
    54.2%
    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: 33.5% · Safe to merge
    33.5%