-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Handle CRI Device.HostPath on Windows #6618
Handle CRI Device.HostPath on Windows #6618
Conversation
Hi @TBBle. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This comment was marked as resolved.
This comment was marked as resolved.
Build succeeded.
|
fe810fe
to
f1ea5de
Compare
Okay. CRI Integration test passed in https://github.com/containerd/containerd/actions/runs/1934414068. Even the symlink tests which have been failing before now... 😳 https://github.com/containerd/containerd/actions/runs/1934549500 is without the actual code change, so I'm happy the test is effective.
|
1515c24
to
a5cf682
Compare
0851ce8
to
92ecec8
Compare
Build succeeded.
|
c2d8a1e
to
85cc85a
Compare
Build succeeded.
|
85cc85a
to
0e1815e
Compare
Build succeeded.
|
Another stray thought: Since there isn't actually a spec for interpreting CRI Devices on Windows, perhaps we should limit it to only However, that would mean that Kubernetes users would have to use a different path for CRI-based runtimes compared to dockershim. I assume if there's a Docker-based CRI implementation, they've solved this in some way too (probably just passthrough host_path into I'm not aware of any other CRI implementations that would run on Windows, but would definitely welcome advice that such exists, particularly if they manage this already. Edit: cri-dockerd just passes the CRI |
0e1815e
to
9a6e3df
Compare
Build succeeded.
|
9a6e3df
to
50a4ecb
Compare
Build succeeded.
|
There's two mappings of hostpath to IDType and ID in the wild: - dockershim and dockerd-cri (implicitly via docker) use class/ID -- The only supported IDType in Docker is 'class'. -- https://github.com/aarnaud/k8s-directx-device-plugin generates this form - https://github.com/jterry75/cri (windows_port branch) uses IDType://ID `://` is much more easily distinguishable, so I've gone with that one as the generic separator, with `class/` as a special-case. This also includes support for setting OCI LinuxDevices on LCOW OCI specs, but does not expose a mapping for that from CRI. While https://github.com/jterry75/cri supports a syntax for this, discussion on PR containerd#6618 indicates that this feature may be better-implemented as an OCI WindowsDevice IDType recognised at a lower level, so this syntax is being left unimplemented. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
50a4ecb
to
777a77c
Compare
There's two mappings of hostpath to IDType and ID in the wild: - dockershim and dockerd-cri (implicitly via docker) use class/ID -- The only supported IDType in Docker is 'class'. -- https://github.com/aarnaud/k8s-directx-device-plugin generates this form - https://github.com/jterry75/cri (windows_port branch) uses IDType://ID `://` is much more easily distinguishable, so I've gone with that one as the generic separator, with `class/` as a special-case. This also includes support for setting OCI LinuxDevices on LCOW OCI specs, but does not expose a mapping for that from CRI. While https://github.com/jterry75/cri supports a syntax for this, discussion on PR containerd#6618 indicates that this feature may be better-implemented as an OCI WindowsDevice IDType recognised at a lower level, so this syntax is being left unimplemented. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
1414cf6
to
2a43af5
Compare
Not sure why CI failed. |
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! Let me re-run the tests just in case.
We've observed this on some other PRs as well. I have no idea how something like staticcheck can be inconsistent on the same piece of code. |
My best guess is that there's a cached pass for that code in the cache, and for some reason it's getting a cache-miss here and hence reanalysing it. That would suggest that running it on the code without any cache would always fail, and it needs some markup to except it.
Edit 2: Oops, re-read the FAQ. Edit 3: But I still think it's faulty, in that we're not returning an interface with non-nil-T and nil-V as described in the issue, we're returning an interface with non-nil-T and non-nil-V, so it's the wrong check to fail. |
Build succeeded.
|
I was wondering if it could be cache related as well. I'll poke around a little and see what I can find out. |
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]>
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]>
This test takes advantage of the fact that when you tell Windows to mount the GUID_DEVINTERFACE_DISPLAY_ADAPTER class, it will also mount the host's device store into the container, even if there is no real GPU on the host. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
There's two mappings of hostpath to IDType and ID in the wild: - dockershim and dockerd-cri (implicitly via docker) use class/ID -- The only supported IDType in Docker is 'class'. -- https://github.com/aarnaud/k8s-directx-device-plugin generates this form - https://github.com/jterry75/cri (windows_port branch) uses IDType://ID -- hcsshim's CRI test suite generates this form `://` is much more easily distinguishable, so I've gone with that one as the generic separator, with `class/` as a special-case. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
Also fixes the issue that `ctr run` on Windows offered help for the non-Windows implementation, but was silently ignored. Signed-off-by: Paul "TBBle" Hampson <[email protected]>
2a43af5
to
2a42599
Compare
Well, it passed the linter after rebasing on #6666 so either the issue was fixed in a new release, the flakiness has flaked in my favour this time, or it only fails if the commit hash has an odd number of 7's in it or something equally obscure. |
Build succeeded.
|
The only test failure is a know issue.
|
I say ship it! |
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit 622a35a)
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit 622a35a) (cherry picked from commit 06985e7) Signed-off-by: Derek McGowan <[email protected]>
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit 622a35a) Signed-off-by: Derek McGowan <[email protected]>
The GitHub Action is unstable especially on Windows (see containerd#6618). This change may not address the issue itself, but using the latest version makes reporting the upstream the issue easier. Signed-off-by: Kazuyoshi Kato <[email protected]> (cherry picked from commit 622a35a) Signed-off-by: Derek McGowan <[email protected]>
Fixes: #4878
This implements a mapping from CRI's
Device.HostPath
into OCI'sWindows.Devices
, per discussion in #4878 and kubernetes/kubernetes#97739.The HostPath is interpreted as
IDType://ID
and those fields are mapped into the same-named fields inWindowsDevice
.class/X
is special-cased toIDType: class, ID: X
as there is existing code in the wild that both generates and consumes that particular format.oci.WithWindowsDevice
helper is added for adding Window Device mounts into OCI container specs for direct users of theoci
API; on Windowsoci.WithDevices
is not implemented as its behaviour depends on Unix host-specific details.And as a bonus,
ctr run --device idType://id
now works on Windows.ctr run --device class/GUID
does not work though.