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

Adjust runc to new opencontainers/specs version #242

Merged
merged 1 commit into from
Sep 15, 2015

Conversation

LK4D4
Copy link
Contributor

@LK4D4 LK4D4 commented Sep 1, 2015

I deleted possibility to specify config file from commands for now.
Until we decide how it'll be done. Also I changed runc spec interface to
write config files instead of output them.

How does `runc` integrate with the Open Container Initiative Specification?
`runc` depends on the types specified in the
[specs](https://github.com/opencontainers/specs) repository. Whenever the
specification is updated and ready to be versioned `runc` will update it's dependency
Copy link
Contributor

Choose a reason for hiding this comment

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

s/it's/its

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 1, 2015

@mrunalp fixed

@@ -280,8 +352,8 @@ To test using Docker's `busybox` image follow these steps:
mkdir rootfs
tar -C rootfs -xf busybox.tar
```
* Create a file called `config.json` using the example from above. You can also
generate a spec using `runc spec`, redirecting the output into `config.json`
* Create a files `config.json` and `runtime.json` using the example from above. You can also
Copy link
Contributor

Choose a reason for hiding this comment

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

s/a files//
or s/a/the/

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 1, 2015

@mrunalp fixed

### OCF Container JSON Format:

Below is a sample `config.json` configuration file. It assumes that
Below are sample `config.json` and `runtime.json` configuration files. It assumes that
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to move this generic OCS documentation into opencontainers/specs. Then you can link to that overview from opencontainers/runc, and not worry about keeping your OCS docs in sync with the upstream spec. Folks suggesting changes to the spec would just update the docs when PRing their changes, and the OCS maintainers would review the whole change as a cohesive unit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, let's do this in another PR though. It was supposed to be mostly code PR to get runc working.

Copy link
Contributor

Choose a reason for hiding this comment

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

On Tue, Sep 01, 2015 at 04:29:17PM -0700, Alexander Morozov wrote:

-### OCF Container JSON Format:

-Below is a sample config.json configuration file. It assumes that
+Below are sample config.json and runtime.json configuration files. It assumes that

Agree, let's do this in another PR though. It was supposed to be
mostly code PR to get runc working.

Sounds good.

@crosbymichael
Copy link
Member

After looking at the configs in this PR I don't see how mounts in the config.json with Name are related to mounts in the RuntimeSpec?

@mrunalp
Copy link
Contributor

mrunalp commented Sep 1, 2015

Yeah, need a check to make sure that all the mounts in config.json are satisfied in runtime.json.

@crosbymichael
Copy link
Member

@mrunalp i think it's a problem in the spec. The Name is not used and I don't see how they can even relate to eachother

@wking
Copy link
Contributor

wking commented Sep 2, 2015

On Tue, Sep 01, 2015 at 04:58:23PM -0700, Michael Crosby wrote:

@mrunalp i think it's a problem in the spec. The Name is not used
and I don't see how they can even relate to eachother

I agree that it's a spec problem. See discussion yesterday on IRC
between @mrunalp, @LK4D4, and myself.

@crosbymichael
Copy link
Member

I just think the Mount struct is missing Name string and that should fix the issues.

@mrunalp
Copy link
Contributor

mrunalp commented Sep 2, 2015

@crosbymichael I agree.

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 2, 2015

They related Path <-> Destination. If we'll have name in mounts, then Path is redundant. And then mounts probably should be a map.

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 2, 2015

@crosbymichael 338 line in spec.go

@mrunalp
Copy link
Contributor

mrunalp commented Sep 2, 2015

I think that it makes sense to add Name and take out destination.

Sent from my iPhone

On Sep 1, 2015, at 6:25 PM, Alexander Morozov notifications@github.com wrote:

They related Path <-> Destination. If we'll have name in mounts, then Path is redundant. And then mounts probably should be a map.


Reply to this email directly or view it on GitHub.

@wking
Copy link
Contributor

wking commented Sep 2, 2015

On Tue, Sep 01, 2015 at 06:25:10PM -0700, Alexander Morozov wrote:

They related Path <-> Destination. If we'll have name in mounts,
then Path is redundant. And then mounts probably should be a map.

I agree that we should use maps on both ends, and the current
Mount.Destination and MountPoint.Name should become keys to those
maps. Shall I make an opencontainers/specs PR to that effect, or does
someone else want to handle it?

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 2, 2015

@wking I'll do it tomorrow. I'm working on docker integration and probably will notice more rough edges in implementation.

@wking
Copy link
Contributor

wking commented Sep 2, 2015

On Tue, Sep 01, 2015 at 08:26:12PM -0700, Alexander Morozov wrote:

I'll do it tomorrow…

Ok. If we went with two maps, we'd need logic in the runtime to order
the mounts, so it's probably easier to keep the MountPoints entry as
an array (because they know about the destinations) and turn the
Mounts entry into a map (so you can't duplicate keys). In fact, it
might make sense to allow duplicate Names in the MountPoints array (in
which case the same entry from the Mounts map would be mounted at both
destinations.

}
],
}
"mounts": [
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 this example needs to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. update in a second

@LK4D4 LK4D4 force-pushed the adjust_spec branch 3 times, most recently from 85119c3 to 149c67b Compare September 3, 2015 19:07
@mrunalp
Copy link
Contributor

mrunalp commented Sep 14, 2015

@LK4D4 Hmmm

@wking
Copy link
Contributor

wking commented Sep 14, 2015

On Mon, Sep 14, 2015 at 12:38:16PM -0700, Alexander Morozov wrote:

@mrunalp It sorta hurts me that runc is alias to runc start. How
about to remove this alias?

Previous discussion about this alias in #210 (after 1). Maybe a
deprecation phase where you keep the alias but warn to stderr if folks
use it? Then remove the alias after a few months of that?

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 14, 2015

@mrunalp I made -config-file and -runtime-file global flags, now runc should work.

@crosbymichael
Copy link
Member

@LK4D4 we can remove the alias now since this is a big update with the multiple spec files so it's breaking anyways

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 14, 2015

@crosbymichael I already made flags global, so alias works. Not sure if you still want to remove it.

@crosbymichael
Copy link
Member

@LK4D4 i would probably do it now since we are making large breaking changes anyways

@mrunalp
Copy link
Contributor

mrunalp commented Sep 14, 2015

Sounds good to me. 👍

@wking
Copy link
Contributor

wking commented Sep 14, 2015

On Mon, Sep 14, 2015 at 01:22:35PM -0700, Michael Crosby wrote:

@LK4D4 we can remove the alias now since this is a big update with
the multiple spec files so it's breaking anyways

Updating the spec breaks the bundle-author API (which runC does
frequently). Dropping the ‘runc’ → ‘runc start’ alias breaks the
runC-caller API (which runC hasn't done yet, at least for the bare
‘runc’ invocation). Still, I don't foresee much trouble with breaking
the runC-caller API, I just think it would be gentler to give folks a
window to adjust. But we can sort out things like that once we start
versioning runC ;).

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 14, 2015

@crosbymichael I dropped alias. Now it's only runc start.

@crosbymichael
Copy link
Member

@LK4D4 ok but i don't think u pushed the commit

@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 14, 2015

@crosbymichael Pushed. Sorry for that.

@LK4D4 LK4D4 force-pushed the adjust_spec branch 2 times, most recently from ea63e74 to 607c9d8 Compare September 14, 2015 22:22
@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 14, 2015

@crosbymichael I think now I pushed something.

@mrunalp
Copy link
Contributor

mrunalp commented Sep 14, 2015

Looks fine to me but janky isn't working

},
Action: func(context *cli.Context) {
imagePath := context.String("image-path")
if imagePath == "" {
imagePath = getDefaultImagePath(context)
}
spec, err := loadSpec(context.Args().First())
spec, rspec, err := loadSpec(context.GlobalString("config-file"), context.GlobalString("runtime-file"))
Copy link
Member

Choose a reason for hiding this comment

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

This should not be GlobalString here and just be String

@crosbymichael
Copy link
Member

I think maybe these changes are needed:

diff --git a/main.go b/main.go
index 5f59783..33a86fc 100644
--- a/main.go
+++ b/main.go
@@ -5,10 +5,11 @@ import (

    "github.com/Sirupsen/logrus"
    "github.com/codegangsta/cli"
+   "github.com/opencontainers/specs"
 )

 const (
-   version = "0.2"
+   version = "0.3"
    usage   = `Open Container Initiative runtime

 runc is a command line client for running applications packaged according to
@@ -54,7 +55,7 @@ func main() {
        },
        cli.StringFlag{
            Name:  "root",
-           Value: "/run/oci",
+           Value: specs.LinuxStateDirectory,
            Usage: "root directory for storage of container state (this should be located in tmpfs)",
        },
        cli.StringFlag{
diff --git a/restore.go b/restore.go
index 094a4d3..bf12cb4 100644
--- a/restore.go
+++ b/restore.go
@@ -60,7 +60,7 @@ var restoreCommand = cli.Command{
        if imagePath == "" {
            imagePath = getDefaultImagePath(context)
        }
-       spec, rspec, err := loadSpec(context.GlobalString("config-file"), context.GlobalString("runtime-file"))
+       spec, rspec, err := loadSpec(context.String("config-file"), context.String("runtime-file"))
        if err != nil {
            fatal(err)
        }

I deleted possibility to specify config file from commands for now.
Until we decide how it'll be done. Also I changed runc spec interface to
write config files instead of output them.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
@LK4D4
Copy link
Contributor Author

LK4D4 commented Sep 15, 2015

@crosbymichael Incorporated your changes.

@crosbymichael
Copy link
Member

LGTM

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented Sep 15, 2015

LGTM

mrunalp pushed a commit that referenced this pull request Sep 15, 2015
Adjust runc to new opencontainers/specs version
@mrunalp mrunalp merged commit 4ab1324 into opencontainers:master Sep 15, 2015
@LK4D4 LK4D4 deleted the adjust_spec branch September 15, 2015 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants