Skip to content

Adds runtime v2 support for Windows shim's#2495

Merged
dmcgowan merged 7 commits intocontainerd:masterfrom
jterry75:runtime_v2_windows
Jul 27, 2018
Merged

Adds runtime v2 support for Windows shim's#2495
dmcgowan merged 7 commits intocontainerd:masterfrom
jterry75:runtime_v2_windows

Conversation

@jterry75
Copy link
Copy Markdown
Contributor

Implements the various requirements for the runtime v2 code to abstract
away the unix/linux code into the appropriate platform level
abstractions to use the runtime v2 on Windows as well.

Adds support in the Makefile.windows to actually build the runtime v2
code for Windows by setting a shell environment BUILD_WINDOWS_V2=1
before calling make. (Note this disables the compilation of the Windows
runtime v1)

Signed-off-by: Justin Terry (VM) [email protected]

@jterry75
Copy link
Copy Markdown
Contributor Author

@crosbymichael @jhowardmsft - PTAL

@jterry75 jterry75 force-pushed the runtime_v2_windows branch from ce6cbb6 to 5a5b3f8 Compare July 25, 2018 17:21
@jterry75
Copy link
Copy Markdown
Contributor Author

Not sure why ltag was so angry but removed the headers. Applied via the template and pushed updates. Hopefully will pass the build this time.

@crosbymichael
Copy link
Copy Markdown
Member

I'll take a look. It looks like there are other vet and linting errors

@jterry75 jterry75 force-pushed the runtime_v2_windows branch from 5a5b3f8 to fb665c4 Compare July 25, 2018 17:45
@jterry75
Copy link
Copy Markdown
Contributor Author

@crosbymichael - I think this was due to a core.autocrlf = input issue switching between code in linux/windows. Will verify with this latest push

@jterry75 jterry75 force-pushed the runtime_v2_windows branch from fb665c4 to beef57f Compare July 25, 2018 20:54
Implements the various requirements for the runtime v2 code to abstract
away the unix/linux code into the appropriate platform level
abstractions to use the runtime v2 on Windows as well.

Adds support in the Makefile.windows to actually build the runtime v2
code for Windows by setting a shell environment BUILD_WINDOWS_V2=1
before calling make. (Note this disables the compilation of the Windows
runtime v1)

Signed-off-by: Justin Terry (VM) <[email protected]>
@jterry75 jterry75 force-pushed the runtime_v2_windows branch from beef57f to d3e0c16 Compare July 25, 2018 21:09
crosbymichael and others added 3 commits July 26, 2018 11:21
Signed-off-by: Michael Crosby <[email protected]>
Since windows does not require a signal handler, we just block on the
channel forever so that it does not exit.

Signed-off-by: Michael Crosby <[email protected]>
Add Windows Publisher and Signal Handler
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 26, 2018

Codecov Report

Merging #2495 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2495   +/-   ##
=======================================
  Coverage   44.76%   44.76%           
=======================================
  Files          93       93           
  Lines        9555     9555           
=======================================
  Hits         4277     4277           
  Misses       4585     4585           
  Partials      693      693
Flag Coverage Δ
#linux 48.98% <ø> (ø) ⬆️
#windows 41.04% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 26e2dd6...af1b6a0. Read the comment docs.

@crosbymichael
Copy link
Copy Markdown
Member

@jterry75 it's green!

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@jterry75
Copy link
Copy Markdown
Contributor Author

Nice! Thanks for the help

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

Looks good; I think we can use the _unix.go file ending for the two files currently ending in nix and drop the build directive to make it simpler via Go's natural architecture/os support on filenames.

Comment thread runtime/v2/shim/shim_nix.go Outdated
@@ -0,0 +1,102 @@
// +build !windows
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think renaming this file shim_unix.go without the build directive would work?

Comment thread runtime/v2/shim/util_nix.go Outdated
@@ -0,0 +1,57 @@
// +build !windows
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

similarly, util_unix.go without the build directive would work here

@estesp
Copy link
Copy Markdown
Member

estesp commented Jul 26, 2018

And...ignore me; _unix.go is not a special directive for Go; only valid GOOS entries are; so I guess the use of _unix.go elsewhere is slightly idiomatic, but not generally useful as you still need a +build directive

Comment thread runtime/v2/shim/shim.go Outdated
return err
}
logrus.WithField("socket", path).Debug("serving api on unix socket")
logrus.WithField("socket", path).Debug("serving api on abstract socket")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be in shim_unix.go

Comment thread runtime/v2/shim/shim_windows.go Outdated
}

func handleSignals(logger *logrus.Entry, signals chan os.Signal) error {
<-signals
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should at least handle os.Interrupt (i.e. ^C) here so the program exits as expected

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually shim's don't exit on signals so we really just need this method to block. They exit on the Shutdown rpc

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But I like my ^C!

But again, the shim isn't supposed to be started manually so I won't push on this.

Comment thread runtime/v2/shim/util_windows.go Outdated
}

// AbstractAddress returns an abstract npipe address
func AbstractAddress(ctx context.Context, id string) (string, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that name doesn't make sense on windows.

Could we rename to just SocketAddress or AddressPath ? Or anything without Abstract in it :)

@mlaventure
Copy link
Copy Markdown
Contributor

@estesp I think I would still prefer for the consistency of using _unix.go everywhere though :)

crosbymichael and others added 3 commits July 27, 2018 12:39
This updates some methods for cross platform use as well as unifying
_unix files.

Signed-off-by: Michael Crosby <[email protected]>
1. Moves the log message for each socket to the appropriate _unix and
_windows.go
2. Replaces all reference to Abstract Socket for Windows.
3. Adds support for ctrl+c on Windows to exit a shim.

Signed-off-by: Justin Terry (VM) <[email protected]>
@crosbymichael
Copy link
Copy Markdown
Member

LGTM

1 similar comment
@dmcgowan
Copy link
Copy Markdown
Member

LGTM

@dmcgowan dmcgowan merged commit 362405f into containerd:master Jul 27, 2018
@jterry75 jterry75 deleted the runtime_v2_windows branch July 30, 2018 22:04
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.

6 participants