← Back to Pull requests

OCPBUGS-83492: Allow :ref suffix in additionalLayerStores controller validation #5858

Closed
unknown closed this pull request without merging on Apr 28, 2026 06:54 UTC
View on GitHub
unknown unknown commented on Apr 17, 2026 14:31 UTC
Author

Allow :ref suffix in additionalLayerStores controller validation

  • Add validateLayerStorePath function that accepts paths ending with the :ref suffix (e.g., /var/lib/stargz-store/store:ref) for reference-based layer organization with stargz-store.

  • This mirrors the API CRD validation change and allows MCO to accept ContainerRuntimeConfig with :ref suffix, enabling lazy pulling functionality.
  • Fixes: https://issues.redhat.com/browse/OCPBUGS-83492

    - What I did
    Added validateLayerStorePath() function to allow the :ref suffix for additionalLayerStores paths, mirroring the API validation introduced in https://github.com/openshift/api/pull/2806.

    Changes:

  • Added layerStorePathRegexp regex: ^/[a-zA-Z0-9/._-]+(:ref)?$

  • Created validateLayerStorePath() function for layer store path validation

  • Updated validateUserContainerRuntimeConfig() to call validateLayerStorePath() for additionalLayerStores

  • Kept validateStorePath() unchanged for additionalImageStores and additionalArtifactStores
  • Without this fix, MCO controller rejects paths with :ref suffix even after API CRD accepts them, preventing storage.conf generation and blocking lazy pulling.

    - How to verify it
    1. Apply ContainerRuntimeConfig with :ref suffix (requires API PR merged):
    yaml

      apiVersion: machineconfiguration.openshift.io/v1
      kind: ContainerRuntimeConfig
      metadata:
        name: additional-layer-stores
      spec:
        machineConfigPoolSelector:
          matchLabels:
            pools.operator.machineconfiguration.openshift.io/worker: ""
        containerRuntimeConfig:
          additionalLayerStores:
          - path: /var/lib/stargz-store/store:ref
    
    

    2. Verify MCO accepts it (no Failure condition):
    $ oc get containerruntimeconfig additional-layer-stores -o yaml | grep -A 5 "status:"
    status:
    conditions:
    - lastTransitionTime: "2026-04-17T14:30:00Z"
    status: "False"
    type: Failure

    3. Check generated storage.conf on worker node:
    $ oc debug node/<worker> -- chroot /host cat /etc/containers/storage.conf | grep additionallayerstores
    additionallayerstores = ["/var/lib/stargz-store/store:ref"]

    4. Verify lazy pulling works with stargz-store (requires stargz-store setup)

    Description for the changelog
    Allow :ref suffix in additionalLayerStores controller validation for stargz-store lazy pulling support

    Verified manually:
    Tested with stargz-store on OpenShift 5.0.0:

    ``bash
    # Applied ContainerRuntimeConfig with :ref suffix
    $ oc get containerruntimeconfig additional-layer-stores -o yaml | grep -A 2 additionalLayerStores
    additionalLayerStores:
    - path: /var/lib/stargz-store/store:ref

    # Success (both API and MCO accepted :ref)
    # Verified /etc/containers/storage.conf updated on all worker nodes
    $ oc debug node/$WORKER -- chroot /host cat /etc/containers/storage.conf | grep additionallayer
    additionallayerstores = ["/var/lib/stargz-store/store:ref"]

    # Tested lazy image pulling using estargz format image and verified snapshot created on the node
    $ oc debug node/$WORKER -- chroot /host ls /var/lib/stargz-store/store/
    cXVheS5pby9iZ3VkaS90ZXN0LXNtYWxsOmVzdGFyZ3o= # Snapshot created

    # Tested layer reuse - second pod pull completed in <1 second using cached layers
    $ oc debug node/$WORKER -- chroot /host journalctl -u stargz-store | grep refcounter
    {"level":"info","msg":"layer quay.io/bgudi/test-small:estargz / sha256:8b0e... is marked as USING","refcounter":2}
    `
    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Bug Fixes
    Improved container runtime configuration validation for layer store paths. Validator now properly handles paths with optional reference suffixes (
    :ref` format) while enforcing strict requirements for path structure and character sequences.
    Validation for image store and artifact store configurations remains unchanged, maintaining backward compatibility.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: BhargaviGudi Review duration: 15382m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    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.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #5858"
    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: 52% (MEDIUM) · Higher = larger blast radius
    52%
    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: 20.5% · Safe to merge
    20.5%