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

Switch windows runtime endpoints to npipe #69516

Merged
merged 1 commit into from
Oct 23, 2018

Conversation

feiskyer
Copy link
Member

@feiskyer feiskyer commented Oct 8, 2018

What this PR does / why we need it:

Switch default windows runtime endpoints to npipe. tcp endpoints are also supported for backward compatibility.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Refer kubernetes-sigs/cri-tools#374.

Release note:

Windows runtime endpoints is now switched to 'npipe:////./pipe/dockershim' from 'tcp://localhost:3735'.

/sig windows
/assign @PatrickLang

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 8, 2018
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/windows Categorizes an issue or PR as relevant to SIG Windows. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Oct 8, 2018
@feiskyer feiskyer added the kind/bug Categorizes issue or PR as related to a bug. label Oct 8, 2018
@k8s-ci-robot k8s-ci-robot removed the needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Oct 8, 2018
@feiskyer
Copy link
Member Author

feiskyer commented Oct 8, 2018

cc @jterry75

/retest

@jterry75
Copy link

jterry75 commented Oct 9, 2018

@feiskyer - Can you take a look at: jterry75@a2f1f44. I did npipe support a while back including adding tests and supporting both path types (npipe://./path and \\.\pipe\path). I think that we should merge your commit with this one so we get all of it. Do you agree?

@feiskyer
Copy link
Member Author

npipe://./path and \.\pipe\path

I'd suggest we only support npipe format. The reason it this is an option of kubelet, so it's format should be consistent with all platforms, e.g. unix:... for linux and npipe:... for windows.

@feiskyer
Copy link
Member Author

/retest

@Random-Liu
Copy link
Member

@jterry75 I do think npipe:... is more clear to me. Is there any particular reason that \\.\pipe\path should be supported? For example, compatibility? Or in some case only that works?

@feiskyer
Copy link
Member Author

Is there any particular reason that \.\pipe\path should be supported? For example, compatibility?

I think backward compatibility only exists on volumes, e.g. what #69484 did. Kubelet options are new features, there are no backward issues.

@feiskyer feiskyer added this to the v1.13 milestone Oct 10, 2018
@jterry75
Copy link

@Random-Liu @feiskyer - I am totally fine supporting only npipe:// paths. But we still need this part of the code: jterry75@a2f1f44#diff-ae2806b52080b15d453c30c075eb0bc8R47. And I would prefer you take the test cases that I added for npipe:// paths.

IE:

protocol, addr, err := parseEndpoint("npipe://./pipe/mypipe")
// protocol == "npipe"
// addr == "\\\\.\\pipe\\mypipe"

We need to return addr as the \\.\pipe converted path so that winio.DialPipe or winio.ListenPipe works.

@feiskyer
Copy link
Member Author

@jterry75 Thanks. But the commit you provided doesn't handle npipe:////./pipe/ correctly. I fixed that another way. PTAL

@jterry75
Copy link

@feiskyer - Your change looks good. Two questions:

  1. Is npipe:////./pipe (4 /'s) even a valid addr? I understand that npipe://./pipe (2 /'s) is valid and should be parse-able though. That would be like putting tcp:////127.0.0.1:8080 right?
  2. Are you saying that winio.DialPipe("//./pipe/mypipe", nil) works? I haven't tried it with forward slashes but I thought Windows paths had to be winio.DialPipe("\\\\.\\pipe\\mypipe", nil) which is why I suggested returning the addr portion from parse normalized.

@feiskyer
Copy link
Member Author

For your question:

  • npipe:////./pipe is valid only for npipe and the change doesn't influence tcp
  • winio.DialPipe("//./pipe/mypipe", nil) works of course for windows. It is actually same with winio.DialPipe("\\\\.\\pipe\\mypipe", nil)

@jterry75
Copy link

Perfect. LGTM then

@feiskyer
Copy link
Member Author

@Random-Liu PTAL

btw, cri-tools should be updated after this PR merged. I will update it after this PR got merged.

@@ -30,6 +31,8 @@ func FromApiserverCache(opts *metav1.GetOptions) {
}

func parseEndpoint(endpoint string) (string, string, error) {
// url.Parse doesn't recognize \, so replace with / first.
endpoint = strings.Replace(endpoint, "\\", "/", -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's safe to do this on non-windows platforms.

Either use libraries that can handle paths differently on different OS, or rewrite this function in _windows.go
The latter might be good since protocols like unix:// cannot be accepted on windows.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Thanks.

@yujuhong
Copy link
Contributor

/cc @pjh

@k8s-ci-robot
Copy link
Contributor

@yujuhong: GitHub didn't allow me to request PR reviews from the following users: pjh.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @pjh

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.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 16, 2018
@feiskyer
Copy link
Member Author

@yujuhong Addressed comments. PTAL

Copy link
Contributor

@yujuhong yujuhong left a comment

Choose a reason for hiding this comment

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

Okay with the overall approach. Would like a windows folk to review the npipe path parsing

return "", "", err
}

if u.Scheme == "tcp" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm... we can just use switch here.

@@ -376,8 +376,8 @@ func (f *KubeletFlags) AddFlags(mainfs *pflag.FlagSet) {
fs.StringVar(&f.ExperimentalMounterPath, "experimental-mounter-path", f.ExperimentalMounterPath, "[Experimental] Path of mounter binary. Leave empty to use the default mount.")
fs.StringSliceVar(&f.AllowedUnsafeSysctls, "allowed-unsafe-sysctls", f.AllowedUnsafeSysctls, "Comma-separated whitelist of unsafe sysctls or unsafe sysctl patterns (ending in *). Use these at your own risk. Sysctls feature gate is enabled by default.")
fs.BoolVar(&f.ExperimentalKernelMemcgNotification, "experimental-kernel-memcg-notification", f.ExperimentalKernelMemcgNotification, "If enabled, the kubelet will integrate with the kernel memcg notification to determine if memory eviction thresholds are crossed rather than polling.")
fs.StringVar(&f.RemoteRuntimeEndpoint, "container-runtime-endpoint", f.RemoteRuntimeEndpoint, "[Experimental] The endpoint of remote runtime service. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'tcp://localhost:3735'")
fs.StringVar(&f.RemoteImageEndpoint, "image-service-endpoint", f.RemoteImageEndpoint, "[Experimental] The endpoint of remote image service. If not specified, it will be the same with container-runtime-endpoint by default. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'tcp://localhost:3735'")
fs.StringVar(&f.RemoteRuntimeEndpoint, "container-runtime-endpoint", f.RemoteRuntimeEndpoint, "[Experimental] The endpoint of remote runtime service. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'npipe:////./pipe/dockershim'")
Copy link
Contributor

Choose a reason for hiding this comment

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

npipe is also supported on windows, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I guess tcp is supported on both platforms?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. The usage should include such information.

fs.StringVar(&f.RemoteRuntimeEndpoint, "container-runtime-endpoint", f.RemoteRuntimeEndpoint, "[Experimental] The endpoint of remote runtime service. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'tcp://localhost:3735'")
fs.StringVar(&f.RemoteImageEndpoint, "image-service-endpoint", f.RemoteImageEndpoint, "[Experimental] The endpoint of remote image service. If not specified, it will be the same with container-runtime-endpoint by default. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'tcp://localhost:3735'")
fs.StringVar(&f.RemoteRuntimeEndpoint, "container-runtime-endpoint", f.RemoteRuntimeEndpoint, "[Experimental] The endpoint of remote runtime service. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'npipe:////./pipe/dockershim'")
fs.StringVar(&f.RemoteImageEndpoint, "image-service-endpoint", f.RemoteImageEndpoint, "[Experimental] The endpoint of remote image service. If not specified, it will be the same with container-runtime-endpoint by default. Currently unix socket is supported on Linux, and tcp is supported on windows. Examples:'unix:///var/run/dockershim.sock', 'npipe:////./pipe/dockershim'")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK

See the License for the specific language governing permissions and
limitations under the License.
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have pre-submit tests running windows unit tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet. @PatrickLang is driving Node e2e tests for Windows, but it's still running outside. We hope this will be done within v1.13 release cycle.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not yet. @PatrickLang is driving Node e2e tests for Windows, but it's still running outside. We hope this will be done within v1.13 release cycle.

assert.NotNil(t, err, "Expect error during parsing %q", test.endpoint)
continue
}
assert.Nil(t, err, "Expect no error during parsing %q", test.endpoint)
Copy link
Contributor

Choose a reason for hiding this comment

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

require.Nil is better here since you don't want the test to continue if parsing failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

ACK

expectedAddr: "//./pipe/mypipe",
},
{
endpoint: "npipe:////./pipe/mypipe2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, since I don't know much about the npipe and windows path syntax.
Is ./pipe required and what purpose does it serve?
Also, what does the // prefix do here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, pipe is required in the pipe path ( . is actually the server name for local). The full path format is \\<serverName>\pipe\<pipeName>.

See more here.

@feiskyer
Copy link
Member Author

@yujuhong Addressed comments. PTAL

@yujuhong
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, yujuhong

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 22, 2018
@feiskyer
Copy link
Member Author

/retest

@feiskyer
Copy link
Member Author

/test pull-kubernetes-integration

@PatrickLang
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 23, 2018
@k8s-ci-robot k8s-ci-robot merged commit c0974d7 into kubernetes:master Oct 23, 2018
@feiskyer feiskyer deleted the win-npipe branch October 23, 2018 23:50
feiskyer added a commit to feiskyer/cri-tools that referenced this pull request Oct 31, 2018
feiskyer added a commit to feiskyer/cri-tools that referenced this pull request Oct 31, 2018
feiskyer added a commit to feiskyer/cri-tools that referenced this pull request Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/windows Categorizes an issue or PR as relevant to SIG Windows. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants