Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions pkg/unikontainers/urunc_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ func LoadUruncConfig(path string) (*UruncConfig, error) {
}
cfg.Monitors[name] = mon
}
// Same issue for [extra_binaries.<name>] sections.
defaultBins := defaultExtraBinConfig()
Comment thread
magic-peach marked this conversation as resolved.
Outdated
for name, bin := range cfg.ExtraBins {
def, ok := defaultBins[name]
if !ok {
continue
}
if bin.Path == "" {
bin.Path = def.Path
}
if bin.Options == "" {
bin.Options = def.Options
}
cfg.ExtraBins[name] = bin
}

return cfg, nil
}
Expand Down
14 changes: 14 additions & 0 deletions pkg/unikontainers/urunc_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,20 @@ path = "/usr/bin/mon"
assert.Error(t, err)
assert.Equal(t, defaultMonitorsConfig(), config.Monitors)
})

t.Run("partial extra binary section keeps default options", func(t *testing.T) {
t.Parallel()
path := writeTestConfig(t, `
[extra_binaries.virtiofsd]
path = "/opt/urunc/bin/virtiofsd"
`)
config, err := LoadUruncConfig(path)
assert.NoError(t, err)

virtiofsd := config.ExtraBins["virtiofsd"]
assert.Equal(t, "/opt/urunc/bin/virtiofsd", virtiofsd.Path)
assert.Equal(t, defaultExtraBinConfig()["virtiofsd"].Options, virtiofsd.Options)
})
}

// Note: these tests use t.Setenv and therefore must not call t.Parallel().
Expand Down