Build CRI Plugin on Windows and Add Presubmit #1258
Conversation
ab036cc
to
60f460d
Compare
11ccfa2
to
a604e24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how to review, it looks from this one (main) commit that we're forking most of the tree for things that might have some differences and setting the windows version of the fork to ... not implemented for now. Concerned that having two mostly different versions of the tree will make it harder to support the product. For example, you'll need to read both container_create_windows and container_create_unix before knowing how to modify either, and will have to test both independently, vs being able to just ignore simple path differences or sections of the code that say something like unix only or windows only.
PATH: C:\go\bin;C:\tools\mingw64\bin;$(PATH) | ||
CGO_ENABLED: 1 | ||
matrix: | ||
- GO_VERSION: 1.12.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
has to be hard coded to 1.12.9? this appveyor test is going to be a pain isn't it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other than the hard coding of the go version this presubmit test LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard coded because of this containerd/containerd#3541
|
||
// DefaultConfig returns default configurations of cri plugin. | ||
func DefaultConfig() PluginConfig { | ||
return PluginConfig{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was only expecting the paths to be different for the most part in things like configs... which would require a two different sets of paths approach based on windows/linux ... not two copies of config. For example, StreamServerAddress: "127.0.0.1", local host the same on windows? As another example, sandbox image, is it multi arch? If so should be the same image. Still another, docker registry should be the same right?
Put another way... are we just forking entire sets of functions if there might be a difference of one path or one feature in a function, or are we forking because we know it will be very unique and no simple separation of paths and tools used could be determined. What's the plan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works in place :). Mostly haha. @Random-Liu - Should you fill this out with the defaults that matter from our fork for the checkin or do you want to do that as a followup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikebrow Here is the diff:
< // +build !windows
---
> // +build windows
30,32c30,32
< NetworkPluginBinDir: "/opt/cni/bin",
< NetworkPluginConfDir: "/etc/cni/net.d",
< NetworkPluginMaxConfNum: 1, // only one CNI plugin config file will be loaded
---
> NetworkPluginBinDir: "C:\\Program Files\\containerd\\cni\\bin",
> NetworkPluginConfDir: "C:\\Program Files\\containerd\\cni\\conf",
> NetworkPluginMaxConfNum: 1,
37c37
< DefaultRuntimeName: "runc",
---
> DefaultRuntimeName: "runhcs",
40,41c40,41
< "runc": {
< Type: "io.containerd.runc.v1",
---
> "runhcs": {
> Type: "io.containerd.runhcs.v1",
49d48
< EnableSelinux: false,
55c54
< SandboxImage: "k8s.gcr.io/pause:3.1",
---
> SandboxImage: "mcr.microsoft.com/k8s/core/pause:1.0.0",
57d55
< SystemdCgroup: false,
67d64
< DisableProcMount: false,
Let's see whether we can further clean this up as part of #1245.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added #1245 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Random-Liu - Knowing there is a future here can we not add "runhcs" and use "runhcs-wcow-process". It makes more sense and is more descriptive once the other two: "runhcs-wcow-hypervisor" and "runhcs-lcow" are added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Will do in the next PR when actually adding the default config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vendor commit LGTM
package main | ||
|
||
import ( | ||
_ "github.com/containerd/containerd/diff/lcow" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this but since you are only doing WCOW process for the first round we dont need any lcow/ stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that the lcow
differ is required here. https://github.com/containerd/containerd/blob/4e6e61c44e83ba1f69aa37ea603a9f23383821fb/services/diff/service_windows.go#L22
Can we add a no_windows-lcow
build tag in containerd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh funny. No problem just leave it. I dont think its worth the tag it wont work here anyways
@@ -25,6 +25,8 @@ import ( | |||
|
|||
// ContainerStats returns stats of the container. If the container does not | |||
// exist, the call returns an error. | |||
// TODO(windows): hcsshim Stats is not implemented, add windows support after |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. I have a PR for you. Will link you in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll file an issue after my next PR, and will add the support once the hcsshim side is ready. :)
@@ -51,46 +49,24 @@ const ( | |||
errorStartReason = "StartError" | |||
// errorStartExitCode is the exit code when fails to start container. | |||
// 128 is the same with Docker's behavior. | |||
// TODO(windows): Figure out what should be used for windows. | |||
errorStartExitCode = 128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for "command not exist"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually this is caused by command not found.
See this https://github.com/moby/moby/blob/master/daemon/start.go#L127
pkg/server/helpers.go
Outdated
@@ -443,6 +340,7 @@ func getRuntimeOptions(c containers.Container) (interface{}, error) { | |||
|
|||
const ( | |||
// unknownExitCode is the exit code when exit reason is unknown. | |||
// TODO(windows): Figure out unknown exit status for windows. | |||
unknownExitCode = 255 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime V2 defined this as 255 so we return that for Windows as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Sound good.
Removed the TODO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Minor questions
@mikebrow I share the same concern. Actually I've done a round of de-duplication. I think we've reduced to a reasonable amount of duplication. :) I'll send out the actual windows implementation soon. If we still think that some part can be de-duplicated, we can cleanup after that is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
619c35f
to
6b3c705
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Apply LGTM based on #1258 (review) and #1258 (review) |
Signed-off-by: Lantao Liu <lantaol@google.com>
Signed-off-by: Lantao Liu <lantaol@google.com>
Signed-off-by: Lantao Liu <lantaol@google.com>
6b3c705
to
0122e90
Compare
New changes are detected. LGTM label has been removed. |
Did a rebase. Apply LGTM based on #1258 (review) and #1258 (review) |
Late to the party, but lgtm :-) |
For #1257.
This PR moves linux specific logic into
_unix.go
files, and make this buildable on windows.This PR also adds appveyor presubmit test. We don't use travis windows support because travis only supports windows 1803 (https://docs.travis-ci.com/user/reference/windows/#windows-version), but we need RS5 (17655+ build) for the containerd integration to work. appveyor supports it https://www.appveyor.com/docs/windows-images-software/#visual-studio-2019.
Note that this PR leaves all windows implementation empty. I have a local version which makes it work, I'll send out it one by one for easy reviewing and testing.
The first commit includes #1259.