-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add Windows HostProcess Support #5131
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
package server | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/containerd/containerd/oci" | ||
imagespec "github.com/opencontainers/image-spec/specs-go/v1" | ||
runtimespec "github.com/opencontainers/runtime-spec/specs-go" | ||
|
@@ -118,6 +120,7 @@ func (c *criService) containerSpec( | |
customopts.WithAnnotation(annotations.SandboxName, sandboxConfig.GetMetadata().GetName()), | ||
customopts.WithAnnotation(annotations.ContainerName, containerName), | ||
customopts.WithAnnotation(annotations.ImageName, imageName), | ||
customopts.WithAnnotation(annotations.WindowsHostProcess, strconv.FormatBool(sandboxConfig.GetWindows().GetSecurityContext().GetHostProcess())), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we also need a check like this to disallow creating a HostProcess container in a non-HostProcess pod? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well I saw it was merged already :) Might be worth addressing in a follow-up PR though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually handle this in the shim right now, but wouldnt hurt here also if we remove that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the right place for it |
||
) | ||
return c.runtimeSpec(id, ociRuntime.BaseRuntimeSpec, specOpts...) | ||
} | ||
|
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.
Should it be
com.microsoft.xxx
as like other annotations?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.
This annotation was following the Kubernetes guidelines https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/#syntax-and-character-set. This is what it's set to/k8s checks against so there's not much we could do here at the moment in terms of changing it. As of right now in 1.22, Kubernetes is setting this annotation explicitly if the HostProcess field is filled in so that containerd doesn't need to be aware of the cri fields (even though that's what this PR is adding now that the 1.22 deps are vendored in 😆). In 1.23 of k8s I believe they're removing this explicit addition of the annotation if this feature goes to beta so we can change the annotation name then, as the only other change would just be renaming it in our windows containerd-shim to match once k8s no longer needs to care how it's named.
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, I didn't know that.
https://github.com/kubernetes/kubernetes/blob/7705b300e2085c3864bb1e49a7302bf17f080219/pkg/kubelet/kuberuntime/labels.go#L46-L50
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 situation is actually a bit weird right now. k8s states annotations should be in the form
foo.com/bar-baz
, while OCI states they should be in the formcom.foo.bar-baz
.Probably the most technically correct thing to do would be for the CRI plugin to translate from the k8s form to the OCI form, but it doesn't do that today.