Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing fields to be used with podman #29

Merged
merged 2 commits into from
Dec 29, 2019
Merged

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Dec 16, 2019

We also want to be able to default namespaces to host, so that HPC
machines can default to not using most of the namespaces by default.

Signed-off-by: Daniel J Walsh [email protected]

@rhatdan
Copy link
Member Author

rhatdan commented Dec 23, 2019

Fixes: #31

@rhatdan
Copy link
Member Author

rhatdan commented Dec 23, 2019

@mheon
Copy link
Member

mheon commented Dec 23, 2019

General comment, but I think we need to define formats for all the []string fields. Stuff like AdditionalVolumes. We need to make sure that it will be consistently parsed by Buildah, Podman, etc. I would almost rather we do structures here (Source, Destination, Options) to remove the ambiguity of how Buildah, Podman, CRI-O could parse them.

@vrothberg
Copy link
Member

vrothberg commented Dec 23, 2019

General comment, but I think we need to define formats for all the []string fields. Stuff like AdditionalVolumes. We need to make sure that it will be consistently parsed by Buildah, Podman, etc. I would almost rather we do structures here (Source, Destination, Options) to remove the ambiguity of how Buildah, Podman, CRI-O could parse them.

That's a very valid concern and I think it's smart to prevent any boilerplate code from consumers of this library. If we have fields that must be post-processed by consumers, we should do it for them.

// DNS Set default DNS servers.
DNS string `toml:"default_ulimits"`

// DNSOptions Set default DNS options.
Copy link
Member

Choose a reason for hiding this comment

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

extra space after set.

Should the various "Set" used in the comments be lower case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

// HTTPProxy is the proxy environment variable list to apply to container process
HTTPProxy []string `toml:"http_proxy"`

// Init tells containre runtimes wither to run init inside the
Copy link
Member

Choose a reason for hiding this comment

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

typo in containre and wither

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

// InitPath is the path for init to run if the Init bool is enabled
InitPath string `toml:"init_path"`

// IPCNS way to to create a ipc namespace for the container
Copy link
Member

Choose a reason for hiding this comment

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

double "to"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

// NetNS indicates how to create a network namespace for the container
NetNS string `toml:"netns"`

// NoHost tells container engine wheter to create its own /etc/hosts
Copy link
Member

Choose a reason for hiding this comment

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

typo in "wheter"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@@ -179,7 +221,7 @@ type LibpodConfig struct {
// containers and pods will be visible. The default namespace is "".
Namespace string `toml:"namespace,omitempty"`

// NetworkCmdPath is the path to the slirp4netns binary.
// NewtorkCmdPath is the path to the slirp4netns binary.
Copy link
Member

Choose a reason for hiding this comment

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

typo in "NewtorkCmdPath"

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

# 2. /etc/containers/containers.conf
# 3. $HOME/.config/containers/containers.conf (Rootless containers ONLY)
# Items specified in the latter containers.conf, if they exist, override the
# previous containers.conf # settings, or the default settings.
Copy link
Member

Choose a reason for hiding this comment

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

I'm still not clear on the ordering for rootless. If a variable is defined in all three files with different values, what does it get set to in a rootless environment? Does the processing really go through all three files and the value from 1 would be overridden by the 2nd, and then finally by the 3rd file's value? If so, then this is good, if not and we instead read just file 3 in a rootless environment, I think this needs to be adjusted.

Copy link
Member Author

Choose a reason for hiding this comment

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

Goes through all three, and LAST one with a field get's used.

So if ~/.config/containers/containers.conf has a field in a rootless container, it wins. If it does not, then the precedence goes
/etc/containers/containers.conf
/usr/share/containers/containers.conf
Defaults.

All of these are checked even in the case of rootless.

I look at these 4 configuration settings as being controlled by different entities.
Defaults -> Upstream
/usr/share -> distros
/etc -> administrators
$HOME-> Users
Each able to override the other.

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

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

One question, then other than @giuseppe 's comments, LGTM

@TomSweeneyRedHat
Copy link
Member

@rhatdan glint is barking at you:

$ make validate
golangci-lint run
pkg/config/config.go:717:2: ineffectual assignment to `rootlessStorage` (ineffassign)
	rootlessStorage := strings.Replace(c.Libpod.RootlessStoragePath, "$HOME", home, -1)
	^
pkg/config/config.go:719:2: ineffectual assignment to `rootlessStorage` (ineffassign)
	rootlessStorage = strings.Replace(c.Libpod.RootlessStoragePath, "$UID", string(uid), -1)

	^
Makefile:37: recipe for target 'validate' failed
make: *** [validate] Error 1

The command "make validate" exited with 2.

We also want to be able to default namespaces to host, so that HPC
machines can default to not using most of the namespaces by default.

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan
Copy link
Member Author

rhatdan commented Dec 29, 2019

I have fixed comments and tests pass, merging.

@rhatdan rhatdan merged commit 695eb89 into containers:master Dec 29, 2019
M1cha pushed a commit to M1cha/common that referenced this pull request Dec 20, 2022
Add network information to setupopts
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.

5 participants