Skip to content

Conversation

@cdesiniotis
Copy link
Contributor

…p behavior


// Unconfigure removes the options from the specified config
func (o Options) Unconfigure(cfg engine.Interface) error {
err := o.RevertConfig(cfg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about checking the mode here instead of adding another top-level function to the Options. This should mean that we don't need to make changes for each runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that should be possible...

*c.Tree = config
}

func (c *Config) UnsetDefaultRuntime(name string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we invoke this from RemoveRuntime?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was a copy-paste from the code currently in RemoveRuntime. I can look to reuse this new function there.

}

func (c *ConfigWithDropIn) UnsetDefaultRuntime(name string) {
c.Interface.UnsetDefaultRuntime(name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this unsets it in the drop-in file and not in the top-level config.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was intentional. When using drop-ins, we set the default_runtime_name field only in the drop-in file. The purpose of UnsetDefaultRuntime is to revert that setting (in cases where nvidia is set as the default runtime).

}
if runtimePath != "" && defaultRuntimePath != "" && runtimePath == defaultRuntimePath {
config.DeletePath([]string{"plugins", "cri", "containerd", "default_runtime"})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other implementations we have *c.Tree = config at the end of modifying functions. Do we not need those?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably missed this...

@cdesiniotis
Copy link
Contributor Author

Closing in favor of #1360

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.

2 participants