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

fix: modify streaming io url and add docs of sandboxer and io_type #10190

Merged
merged 3 commits into from May 16, 2024

Conversation

abel-von
Copy link
Contributor

@abel-von abel-von commented May 8, 2024

sandbox address should be in the form of
<ttrpc|grpc>+<unix|vsock|hvsock>://<uds-path|vsock-cid:vsock-port|uds-path:hvsock-port>
for example: ttrpc+hvsock:///run/test.hvsock:1024
or: grpc+vsock://1111111:1024
and the Stdin/Stdout/Stderr will add a streaming_id as a parameter of the url result form is:
<ttrpc|grpc>+<unix|vsock|hvsock>://<uds-path|vsock-cid:vsock-port|uds-path:hvsock-port>?streaming_id= for example ttrpc+hvsock:///run/test.hvsock:1024?streaming_id=111111 or grpc+vsock://1111111:1024?streaming_id=222222

Change the current logic of add a streaming in the path, because unix domain socket or hybrid vsock alread have the path field and add a streaming suffix makes the logic complecated.

@k8s-ci-robot
Copy link

Hi @abel-von. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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-sigs/prow repository.

@abel-von
Copy link
Contributor Author

abel-von commented May 8, 2024

/cc @fuweid @mxpv @dmcgowan

@abel-von abel-von changed the title fix: modify streaming io url form fix: modify streaming io url form and add docs of sandboxer and io_type May 8, 2024
@abel-von abel-von changed the title fix: modify streaming io url form and add docs of sandboxer and io_type fix: modify streaming io url and add docs of sandboxer and io_type May 8, 2024
@Burning1020
Copy link
Member

/ok-to-test

@abel-von
Copy link
Contributor Author

abel-von commented May 8, 2024

/retest

@abel-von
Copy link
Contributor Author

abel-von commented May 8, 2024

/test pull-containerd-k8s-e2e-ec2

@@ -55,6 +55,15 @@ func NewFifoExecIO(id, root string, tty, stdin bool) (*ExecIO, error) {
}

// NewStreamExecIO creates exec io with streaming.
// address should be in the form of
// <ttrpc|grpc>+<unix|vsock|hvsock>://<uds-path|vsock-cid:vsock-port|uds-path:hvsock-port>
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 we don't need to list all the combinations in here. Suggest to use protocol://address?streaming_id=xyz.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@abel-von
Copy link
Contributor Author

abel-von commented May 13, 2024

Kubernetes e2e suite: [It] [sig-network] DNS HostNetwork spec.Hostname field is silently ignored and the node hostname is used when hostNetwork is set to true for a Pod expand_less | 3s
-- | --
{ failed [FAILED] expected hostname: ip-172-31-91-82.ec2.internal, got: ip-172-31-91-82 In [It] at: k8s.io/kubernetes/test/e2e/network/dns.go:690 @ 05/13/24 02:17:47.278 }

pull-containerd-k8s-e2e-ec2 seems failed for all new PRs, It seems that some error from execution environment make this error. @fuweid

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

Left two comments and one question:

When containerd restarts, the streaming_id is the same. Is it possible to establish stream tunnel successfully with same ID? If not, we need to consider to how to recover this and please file issue to track this. Thanks

@@ -73,6 +73,14 @@ func WithNewFIFOs(root string, tty, stdin bool) ContainerIOOpts {
}

// WithStreams creates new streams for the container io.
// address should be in the form of protocol://address
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// address should be in the form of protocol://address
// The stream address is in format of `protocol://address`.
// It allocates ContainerID-stdin, ContainerID-stdout and ContainerID-stderr as streaming IDs.
// For example, that advertiser address of shim is `ttrpc+unix:///run/demo.sock` and container ID is `app`.
// There are three streaming IDs if stdin is enable and TTY is disable.
//
// * Stdin: app-stdin
// * Stdout: app-stdout
// * stderr: app-stderr
//
// These streaming IDs will be used as unique key to establish stream tunnel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

// the result form is: protocol://address?streaming_id=xyz
// for example ttrpc+hvsock:///run/test.hvsock:1024?streaming_id=xyz,
// grpc+vsock://1111111:1024?streaming_id=xyz,
// or ttrpc+unix:///run/test.sock?streaming_id=xyz
Copy link
Member

Choose a reason for hiding this comment

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

Please check last comment on WithStream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

sandbox address should be in the form of
<ttrpc|grpc>+<unix|vsock|hvsock>://<uds-path|vsock-cid:vsock-port|uds-path:hvsock-port>
for example: ttrpc+hvsock:///run/test.hvsock:1024
or: grpc+vsock://1111111:1024
and the Stdin/Stdout/Stderr will add a `streaming_id` as a parameter of the url
result form is:
<ttrpc|grpc>+<unix|vsock|hvsock>://<uds-path|vsock-cid:vsock-port|uds-path:hvsock-port>?streaming_id=<stream-id>
for example ttrpc+hvsock:///run/test.hvsock:1024?streaming_id=111111
or grpc+vsock://1111111:1024?streaming_id=222222

Signed-off-by: Abel Feng <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
@abel-von
Copy link
Contributor Author

Is it possible to establish stream tunnel successfully with same ID? If not, we need to consider to how to recover this and please file issue to track this.

I think streaming server should support reconnection of the same ID, and add this in the comment, please check. @fuweid

@abel-von
Copy link
Contributor Author

and add a fix of restart recovey of container io in restart.go https://github.com/containerd/containerd/pull/10190/files#diff-ad49a10c586e0f81890f9ee72f6dcc26ce03607c37b4c4856786f459e1e43a38 please take a look.

@abel-von
Copy link
Contributor Author

/retest

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@mxpv mxpv added this pull request to the merge queue May 16, 2024
Merged via the queue into containerd:main with commit 90a8667 May 16, 2024
43 checks passed
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.

None yet

5 participants