← Back to Pull requests

OCPBUGS-83492: Auto-append :ref suffix to additionalLayerStores in storage.conf #5888

Closed
unknown closed this pull request without merging on Apr 30, 2026 12:09 UTC
View on GitHub
unknown unknown commented on Apr 28, 2026 07:35 UTC
Author

Description

Automatically append :ref suffix to additionalLayerStores paths when generating storage.conf.
This allows users to provide clean paths in ContainerRuntimeConfig while MCO automatically transforms them to include the :ref suffix in the generated /etc/containers/storage.conf on nodes.

Why

The :ref suffix is required by containers/storage for reference-based layer resolution. Previously, we attempted to add validation in the API layer (openshift/api#2806) to require users to include the
:ref suffix. However, this exposes an implementation detail in the user-facing API and makes it harder to use.

The correct approach is to handle this transformation transparently in the MCO controller.

Changes

pkg/controller/container-runtime-config/helpers.go:
- Modified updateStorageConfig() to append :ref suffix to all additionalLayerStores paths
- Applies to ALL layer stores (not specific to any storage type)

pkg/controller/container-runtime-config/helpers_test.go:
- Updated test expectations to include :ref suffix for all layer stores
- Renamed test to "path with :ref suffix is not doubled" for clarity

Example

User creates ContainerRuntimeConfig:

spec:
  containerRuntimeConfig:
    additionalLayerStores:
    - path: /var/lib/stargz-store/store
    - path: /mnt/nfs-layers

MCO generates storage.conf:

[storage.options]
additional_layer_stores = ["/var/lib/stargz-store/store:ref", "/mnt/nfs-layers:ref"]

Testing

All existing tests pass. Added new test case for :ref suffix idempotency.

$ go test ./pkg/controller/container-runtime-config/...
ok  	github.com/openshift/machine-config-operator/pkg/controller/container-runtime-config	87.196s

Verified manually:
Step 1: Create ContainerRuntimeConfig
Created a ContainerRuntimeConfig with a clean path (no :ref suffix):
$ cat layerstore.yaml
apiVersion: machineconfiguration.openshift.io/v1
kind: ContainerRuntimeConfig
metadata:
  name: test-layer-stores
spec:
  machineConfigPoolSelector:
    matchLabels:
      pools.operator.machineconfiguration.openshift.io/worker: ""
  containerRuntimeConfig:
    additionalLayerStores:
      - path: /var/lib/stargz-store/store

$ oc create -f layerstore.yaml
containerruntimeconfig.machineconfiguration.openshift.io/test-layer-stores created

$ oc get containerruntimeconfigs.machineconfiguration.openshift.io
NAME                AGE
test-layer-stores   6s

Step 2: Post-MCP Rollout Validation
After the MCP rollout completed, verified that :ref was automatically appended in storage.conf:
$ oc debug node/$WORKER-NODE -- chroot /host cat /etc/containers/storage.conf | grep layer
additionallayerstores = ["/var/lib/stargz-store/store:ref"]


Result: MCO automatically appended the :ref suffix to the configured path.
Step 3: Functional Verification
First Pod:
Created a pod using an eStargz-formatted image
Snapshot was created at: /var/lib/stargz-store/store

Second Pod:
Created another pod using the same eStargz image
Cached snapshot was reused from the first pod
No re-download observed (verified via stargz-store logs)

Result: Lazy image pulling with snapshot reuse is working as expected.

Related PRs

  • Reverts openshift/api#2806 (API validation approach)

  • Implements proper MCO controller-based solution
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Bug Fixes
    Additional layer store entries now automatically include the :ref suffix when missing; entries already containing :ref are preserved unchanged to ensure consistent storage path formatting.

    Tests
    Added/updated tests to verify :ref is appended only when absent and not duplicated.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 534 lines (+400 / -134) across 6 files Reviewer: BhargaviGudi Review duration: 3153m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 534 lines diff across 6 files
    0.48
    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%
    60%
    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.376
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5888"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 47.9% (MEDIUM) · Higher = larger blast radius
    47.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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 18.9% · Safe to merge
    18.9%