drivenets: create empty ConfigMap when config mount is defaulted#25
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cdnosDefaultspopulatespb.Config.ConfigPath(/config_load) andpb.Config.ConfigFile(default) on every node, butCreateConfigshort-circuits and creates no ConfigMap when no startup data (Config_File/Config_Data) is supplied.The cdnos-controller still mounts the
<node>-configConfigMap into the pod wheneverConfigPath+ConfigFileare populated on the CR. With the ConfigMap missing, every pod sits forever inPodInitializingwith: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+ConfigFileare 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 clearConfigPath/ConfigFilein the proto, and the existing "no mount" path is preserved.Test plan
TestCreateConfig_NoDataButPathDefaulted— defaulted CR creates the ConfigMap.TestCreateConfig_NoDataAndNoPath— explicit opt-out still skips ConfigMap creation.go vet ./topo/node/drivenets/clean.knetopology — without this fix every pod hangs inPodInitializing; with it, pods come up cleanly.Made with Cursor