Skip to content

fix: honour optional on ConfigMap and Secret volumes - #590

Open
NopeCharon wants to merge 1 commit into
interlink-hq:mainfrom
NopeCharon:fix/optional-configmap-secret-volumes
Open

NopeCharon wants to merge 1 commit into
interlink-hq:mainfrom
NopeCharon:fix/optional-configmap-secret-volumes

Conversation

@NopeCharon

Copy link
Copy Markdown

Summary

On a virtual node, a pod that mounts a ConfigMap or Secret volume marked optional: true can't start when that object doesn't exist. The virtual kubelet treats the volume as required. It keeps the pod in Initializing, polls for the object every 2s, and after 5 minutes fails the pod with CFGMaps/Secrets not found. A configMap source of a projected volume fails the pod right away, also when the source is optional or only one of its listed items is missing. On a regular node the kubelet mounts an empty volume and the pod runs, so workloads that rely on optional config (common in Helm charts) break only when they are offloaded.

This PR handles optional the way the kubelet does. Only a NotFound error counts, so any other error, and any non-optional object, keeps the current wait-and-retry behaviour:

  • configMap / secret volumes: when an optional object is missing, the plugin gets an empty ConfigMap/Secret with the same name instead of nothing. Plugins look up retrieved objects by name. For example, the Slurm plugin's prepareMounts errors out when the object is absent, but it mounts an empty object as an empty volume without error.
  • projected configMap sources: an optional ConfigMap that is missing adds no keys, and missing keys listed in items are skipped.

Tests:

  • TestRemoteExecutionHandleVolumesOptionalMissing: missing optional ConfigMap and Secret volumes give empty objects with the right name and namespace, and the pod moves to Pending. Without the fix this test sits in the 5-minute wait.
  • TestRemoteExecutionHandleProjectedSourceConfigMap: new cases for a missing optional ConfigMap, a missing key of an optional ConfigMap, and (for contrast) a missing required ConfigMap, which still returns an error.

go test -race ./pkg/... and golangci-lint run (v2.14.0, as in CI) pass.


Related issue : #589

A configMap or secret volume marked optional whose object does not exist
was treated like a required one: remoteExecutionHandleVolumes kept the
pod in Initializing, polled for the object every 2s and, after 5 minutes,
failed the pod with "CFGMaps/Secrets not found". A configMap source of a
projected volume failed the pod right away, also when it was optional or
only one of its listed items was missing.

The kubelet mounts an empty volume for a missing optional object, and
skips the missing keys of an optional projected source. Do the same:

- configMap / secret volumes: on NotFound for an optional object, send
  the plugin an empty ConfigMap/Secret with that name instead of waiting.
  Plugins look retrieved objects up by name (the Slurm plugin fails the
  mount when one is absent), so an empty object is what yields an empty
  mount there.
- projected configMap sources: an optional ConfigMap that is missing
  projects no keys, and missing keys listed in items are skipped.

Other errors, and objects that are not optional, keep the existing
behaviour.

Fixes interlink-hq#589

Signed-off-by: NopeCharon <[email protected]>
@netlify

netlify Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for interlink-dev canceled.

Name Link
🔨 Latest commit b9da3e8
🔍 Latest deploy log https://app.netlify.com/projects/interlink-dev/deploys/6addde5a2f6d0a2081a7b97c

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant