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

NodePort API spec & socat implementation #26

Merged
merged 2 commits into from Oct 29, 2018

Conversation

AkihiroSuda
Copy link
Member

@AkihiroSuda AkihiroSuda commented Oct 15, 2018

The API can be used for exposing TCP/UDP ports in the network namespace created along with the user namespace to the host network namespace.

  • api.sock is created under the rootlesskit --state-dir directory
  • API is described in pkg/api/openapi.yaml
    • GET /v1/ports
    • POST /v1/ports
    • DELETE /v1/ports
  • rootlessctl CLI can be used as an API client:
    • rootlessctl list-ports
    • rootlessctl add-ports
    • rootlessctl remove-ports
  • To expose child 80 as parent 8080: rootlessctl --socket=/path/to/api.sock add-ports 0.0.0.0:8080:80/tcp

Currently, only socat implementation is available as rootlesskit --port-driver.
The slirp4netns-native implementation is being experimented at rootless-containers/slirp4netns#29 but it does not work with large MTUs at the moment.

The code under pkg/port/socat package might be also reusable for other projects.

Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp

return b, err
}
if lr.N == 0 {
return b, errors.Errorf("expected at most %d bytes, got more (%d bytes are still left)", maxBytes, lr.N)
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: fix error string

The API can be used for exposing TCP/UDP ports in the network namespace
created along with the user namespace to the host network namespace.

* `api.sock` is created under the `rootlesskit --state-dir` directory
* API is described in `pkg/api/openapi.yaml`
 * `GET /v1/ports`
 * `POST /v1/ports`
 * `DELETE /v1/ports`
* `rootlessctl` CLI can be used as an API client:
 * `rootlessctl list-ports`
 * `rootlessctl add-ports`
 * `rootlessctl remove-ports`
* To expose child 80 as parent 8080: `rootlessctl --socket=/path/to/api.sock add-ports 0.0.0.0:8080:80/tcp`

Currently, only `socat` implementation is available as `rootlesskit
--port-driver`.

The code under `pkg/port/socat` package might be also reusable for other
projects.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
@AkihiroSuda
Copy link
Member Author

https://travis-ci.org/rootless-containers/rootlesskit/builds/445516404?utm_source=github_status&utm_medium=notification

slirp4netns mtu=65520

  • outbound (child->slirp4netns->parent): 8.82 Gbits/sec
  • inbound (parent->socat->nsenter->socat->child): 8.82 Gbits/sec

not so bad

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
@AkihiroSuda AkihiroSuda merged commit e031e8b into rootless-containers:master Oct 29, 2018
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.

None yet

1 participant