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

oci: allow to define multiple OCI runtimes #2079

Merged
merged 3 commits into from
Jan 16, 2019

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jan 4, 2019

we can define multiple OCI runtimes that can be chosen with --runtime.

in libpod.conf is possible to specify them with:

 [runtimes]
    foo = [
                 "/usr/bin/foo",
                 "/usr/sbin/foo",
    ]
    bar = [
                 "/usr/bin/foo",
                 "/usr/sbin/foo",
    ]

If the argument to --runtime is an absolute path then it is used directly without any lookup in the configuration.

Closes: #1750

Signed-off-by: Giuseppe Scrivano [email protected]

@giuseppe giuseppe mentioned this pull request Jan 4, 2019
@giuseppe giuseppe force-pushed the multiple-runtimes branch 2 times, most recently from 56a29fb to 47ef665 Compare January 4, 2019 12:27
"/sbin/runc",
"/bin/runc",
"/usr/lib/cri-o-runc/sbin/runc"
]
Copy link
Member

Choose a reason for hiding this comment

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

Is there an extra space before the first entry /usr/bin/runc/?

@rhatdan
Copy link
Member

rhatdan commented Jan 4, 2019

Should we add paths for kata? gVisor?

@@ -64,7 +64,7 @@ Default state dir is configured in /etc/containers/storage.conf.

**--runtime**=**value**

Path to the OCI compatible binary used to run containers
Name of the OCI runtime as specified in libpod.conf or absolute path to the OCI compatible binary used to run containers.
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd not add the new bit, or maybe just "Absolute path" and the ending period. The names in the conf file are absolute paths anyway. When I first read this, I was looking for some kind of key value, i.e. "runc" vs "/usr/bin/runc"

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, you can specify an absolute path instead of a runtime name. if it is an absolute path like "/foo/bar" then it is not looked up in the config file but used directly.

"/sbin/runc",
"/bin/runc",
"/usr/lib/cri-o-runc/sbin/runc",
},
Copy link
Member

Choose a reason for hiding this comment

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

Anyway to use the values from libpod.conf here?

Copy link
Member Author

Choose a reason for hiding this comment

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

how? This is used only if libpod.conf doesn't override the default specified here

@mheon
Copy link
Member

mheon commented Jan 4, 2019

@giuseppe Can you add the name of the runtime a container was created with to its config? We don't have to do anything with it yet, but once we flesh this out more I'd like to be able to let containers decide what runtime to use based on that.

@mheon
Copy link
Member

mheon commented Jan 4, 2019

(If we don't have a name, I think "" is fine - we'll just let the container use whatever the default is)

@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L labels Jan 4, 2019
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #2090) made this pull request unmergeable. Please resolve the merge conflicts.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 7, 2019
@openshift-ci-robot openshift-ci-robot added size/L and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 7, 2019
@giuseppe
Copy link
Member Author

giuseppe commented Jan 7, 2019

@giuseppe Can you add the name of the runtime a container was created with to its config? We don't have to do anything with it yet, but once we flesh this out more I'd like to be able to let containers decide what runtime to use based on that.

added a patch to store it to the container configuration.

@giuseppe
Copy link
Member Author

giuseppe commented Jan 7, 2019

Should we add paths for kata? gVisor?

I don't see them in Fedora yet

@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2019

I think @lsm5 started looking at packaging them. But not sure if it went forward.

@lsm5
Copy link
Member

lsm5 commented Jan 7, 2019

most of the packages have been added (in rawhide, and built for others but not submitted yet) but there's still some kernel config changes that we need to get resolved.

@giuseppe
Copy link
Member Author

giuseppe commented Jan 8, 2019

I think @lsm5 started looking at packaging them. But not sure if it went forward.

If you are fine with it, let's add them once we have on Fedora and we can test them

@mheon
Copy link
Member

mheon commented Jan 10, 2019

/approve
Not including in 1.0 branch

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 10, 2019
libpod/runtime.go Outdated Show resolved Hide resolved
pkg/spec/createconfig.go Outdated Show resolved Hide resolved
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #2105) made this pull request unmergeable. Please resolve the merge conflicts.

@rhatdan
Copy link
Member

rhatdan commented Jan 11, 2019

Needs rebase.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2019
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just a minor potential issue regarding absolute paths and keys in the map.

@vrothberg
Copy link
Member

Overall LGTM, just a minor potential issue regarding absolute paths and keys in the map.

Looks like I missed creating the comment. My concern was that a user could specify an absolute path as a key in the libpod.conf but apparently, keys cannot contain a '/' in toml.

vbatts and others added 3 commits January 14, 2019 10:03
This deprecates the libpod.conf variable of `runtime_path=`, and now has
`runtimes=`, like a map for naming the runtime, preparing for a
`--runtime` flag to `podman run` (i.e. runc, kata, etc.)

Reference: containers#1750

Signed-off-by: Vincent Batts <[email protected]>
we can define multiple OCI runtimes that can be chosen with
--runtime.

in libpod.conf is possible to specify them with:

[runtimes]
foo = [
             "/usr/bin/foo",
	     "/usr/sbin/foo",
]
bar = [
             "/usr/bin/foo",
	     "/usr/sbin/foo",
]

If the argument to --runtime is an absolute path then it is used
directly without any lookup in the configuration.

Closes: containers#1750

Signed-off-by: Giuseppe Scrivano <[email protected]>
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 14, 2019
@giuseppe
Copy link
Member Author

Overall LGTM, just a minor potential issue regarding absolute paths and keys in the map.

the config map should not contain any '/'.

When the specified runtime starts with '/' then it is treated differently and no lookup is done

foundRuntime = true
runtime.ociRuntimePath = path
break
runtime.ociRuntimePath = OCIRuntimePath{Name: filepath.Base(runtime.config.OCIRuntime), Paths: []string{runtime.config.OCIRuntime}}
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 check here if the path exists and return an error?

Copy link
Member Author

Choose a reason for hiding this comment

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

we check for it later, if I try:

$ podman --runtime /foo/bar run alpine echo hi
error creating libpod runtime: could not find a working binary (configured options: [/foo/bar]): invalid argument

@rhatdan
Copy link
Member

rhatdan commented Jan 16, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 16, 2019
@openshift-merge-robot openshift-merge-robot merged commit d868321 into containers:master Jan 16, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants