Skip to content

drivenets: create empty ConfigMap when config mount is defaulted#25

Merged
msupinodn merged 1 commit into
mainfrom
fix/cdnos-empty-configmap
May 28, 2026
Merged

drivenets: create empty ConfigMap when config mount is defaulted#25
msupinodn merged 1 commit into
mainfrom
fix/cdnos-empty-configmap

Conversation

@msupinodn

Copy link
Copy Markdown
Collaborator

Summary

cdnosDefaults populates pb.Config.ConfigPath (/config_load) and pb.Config.ConfigFile (default) on every node, but CreateConfig short-circuits and creates no ConfigMap when no startup data (Config_File/Config_Data) is supplied.

The cdnos-controller still mounts the <node>-config ConfigMap into the pod whenever ConfigPath + ConfigFile are populated on the CR. With the ConfigMap missing, every pod sits forever in PodInitializing with:

MountVolume.SetUp failed for volume "config":
  configmap "<node>-config" not found

This shows up immediately on any topology whose nodes don't ship a startup configuration — for example lightweight scale tests using an Alpine image where data:/file: is omitted from the proto.

Fix

When ConfigPath + ConfigFile are populated but no data was provided, create an empty ConfigMap (single empty key) instead of returning nil. Users who explicitly want to opt out of the config mount can still clear ConfigPath/ConfigFile in the proto, and the existing "no mount" path is preserved.

Test plan

  • New unit test TestCreateConfig_NoDataButPathDefaulted — defaulted CR creates the ConfigMap.
  • New unit test TestCreateConfig_NoDataAndNoPath — explicit opt-out still skips ConfigMap creation.
  • go vet ./topo/node/drivenets/ clean.
  • Reproduced end-to-end against a 200-node Alpine kne topology — without this fix every pod hangs in PodInitializing; with it, pods come up cleanly.

Made with Cursor

cdnosDefaults populates pb.Config.ConfigPath ("/config_load") and
pb.Config.ConfigFile ("default") on every node, but CreateConfig
short-circuits and creates no ConfigMap when no startup data
(Config_File / Config_Data) is supplied.

The cdnos-controller still mounts the controller-expected
"<node>-config" ConfigMap into the pod whenever ConfigPath +
ConfigFile are populated on the CR. With the ConfigMap missing,
every pod sits forever in PodInitializing with:

  MountVolume.SetUp failed for volume "config" :
    configmap "<node>-config" not found

This shows up immediately on any topology whose nodes don't ship a
startup configuration - e.g. lightweight scale tests using an
alpine image where data:/file: is omitted from the proto.

Fix: when ConfigPath + ConfigFile are populated but no data was
provided, create an empty ConfigMap (single empty key) instead of
returning nil. Users who explicitly want to opt out of the config
mount can still clear ConfigPath/ConfigFile in the proto, and the
existing "no mount" path is preserved.

Adds unit tests covering both branches (defaulted-but-empty and
fully-cleared).
@msupinodn msupinodn merged commit 6ba3f08 into main May 28, 2026
4 checks passed
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