Repository navigation
Description
Summary
The operator hard-depends on the Kubernetes ImageVolume feature — the DocumentDB extension is mounted into the PostgreSQL pod via corev1.ImageVolumeSource (operator/src/internal/cnpg/cnpg_cluster.go). When a cluster does not have ImageVolume available, the CNPG pods can never mount the extension and the cluster silently fails to become ready, with no clear signal to the user.
We should fail fast at DocumentDB creation time with an actionable error instead of letting pods hang.
Background: ImageVolume availability
| K8s version | ImageVolume stage | Default |
|---|---|---|
| 1.31-1.32 | Alpha | disabled |
| 1.33-1.34 | Beta | disabled (opt-in via feature gate) |
| 1.35+ | GA | enabled |
- Enabling on <1.35 requires the
ImageVolumefeature gate on both kube-apiserver and every kubelet, plus a runtime that supports it (containerd >= 2.1 / CRI-O >= 1.33). - Managed offerings (AKS/EKS/GKE standard) generally cannot enable the apiserver gate before it ships on-by-default. Ref: [Feature]: Enable ImageVolume feature gate Azure/AKS#5448.
- Docs already pin Kubernetes 1.35+ as the minimum (
docs/operator-public-documentation/preview/getting-started/before-you-start.md), but there is no runtime enforcement today.
Proposal
Add a create-time block in the validating webhook (operator/src/internal/webhook/) that rejects DocumentDB creation when the cluster does not support ImageVolume.
Detection: capability-based, not version-based. Perform a differential server-side dry-run:
- Dry-run a baseline probe Pod with an
emptyDirvolume. - Dry-run an identical Pod whose only difference is an
ImageVolumeSourcevolume. - Interpret:
- baseline rejected -> inconclusive (PSA/quota/other webhook) -> fail-open (allow)
- baseline ok + image ok -> supported (allow)
- baseline ok + image rejected -> unsupported (block with clear error)
Rationale for capability- over version-detection:
- Automatically admits 1.33/1.34 clusters that have the gate enabled (functionally identical to 1.35 - same API), without officially "supporting" them.
- Also catches 1.35 clusters with a broken/old runtime.
- Fail-open keeps us from blocking legitimate clusters when the probe is inconclusive.
Details:
- Cache only positive results (
atomic.Bool) so steady-state create latency is ~0; never cache negatives so enabling the gate later works without an operator restart. - No new RBAC needed - the operator ClusterRole already grants
createon pods (operator/documentdb-helm-chart/templates/05_clusterrole.yaml). - Error message should tell the user exactly what to do (enable gate on apiserver + kubelet, runtime requirements, note managed-cluster limitation, link to k8s docs).
Scope / decisions
- Supported baseline stays Kubernetes 1.35+ (documented). <1.35 + gate enabled is "works, best-effort/unsupported" - allowed by the capability probe, not promised in CI.
- Do not build a non-ImageVolume fallback (e.g. initContainer copying the extension) - doubles mount code paths and is untested; out of scope.
Tasks
- Add capability probe helper (differential dry-run) in
internal/webhook/ - Wire into
ValidateCreate(and skip on update paths that don't change this) - Unit tests covering supported / unsupported / inconclusive cases
- Docs note: advanced/unsupported path for <1.35 with the gate enabled
Acceptance criteria
- Creating a
DocumentDBon a cluster without ImageVolume is rejected immediately with an actionable error. - Creating on a 1.35+ (or gate-enabled) cluster succeeds unchanged.
- Inconclusive probe environments do not block creation.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
documentdb-triage-tool commentedon Jul 24, 2026
🤖 Auto-triaged by documentdb-triage-tool.
Applied:
go,performanceProject fields suggested: Component
controllers· PriorityP2· EffortL· StatusIn ProgressConfidence: 0.82 (llm)
Reasoning
LLM: Adding a capability-based dry-run probe and fail-fast validating webhook for ImageVolume availability touches the webhook internals and CNPG cluster logic across multiple files, improving UX but not fixing a data-loss or security issue.
If a label is wrong, remove it manually and ping
@patty-chowso the rules can be tuned. The bot will not re-label items that already have component labels.feat: block DocumentDB creation when ImageVolume is unavailable (#431) (