-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Conversation
cc @jterry75 /retest |
@feiskyer - Can you take a look at: jterry75@a2f1f44. I did |
I'd suggest we only support |
/retest |
@jterry75 I do think |
I think backward compatibility only exists on volumes, e.g. what #69484 did. Kubelet options are new features, there are no backward issues. |
@Random-Liu @feiskyer - I am totally fine supporting only IE: protocol, addr, err := parseEndpoint("npipe://./pipe/mypipe")
// protocol == "npipe"
// addr == "\\\\.\\pipe\\mypipe" We need to return |
@jterry75 Thanks. But the commit you provided doesn't handle |
@feiskyer - Your change looks good. Two questions:
|
For your question:
|
Perfect. LGTM then |
@Random-Liu PTAL btw, cri-tools should be updated after this PR merged. I will update it after this PR got merged. |
pkg/kubelet/util/util.go
Outdated
@@ -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) |
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.
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.
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.
Good catch. Thanks.
/cc @pjh |
@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:
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. |
@yujuhong Addressed comments. PTAL |
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.
Okay with the overall approach. Would like a windows folk to review the npipe path parsing
pkg/kubelet/util/util_unix.go
Outdated
return "", "", err | ||
} | ||
|
||
if u.Scheme == "tcp" { |
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.
Hmm... we can just use switch
here.
cmd/kubelet/app/options/options.go
Outdated
@@ -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'") |
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.
npipe
is also supported on windows, no?
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.
Also, I guess tcp
is supported on both platforms?
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.
Good catch. The usage should include such information.
cmd/kubelet/app/options/options.go
Outdated
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'") |
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.
Same here.
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.
ACK
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
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.
Do we have pre-submit tests running windows unit tests?
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.
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.
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.
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) |
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.
require.Nil
is better here since you don't want the test to continue if parsing 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.
ACK
expectedAddr: "//./pipe/mypipe", | ||
}, | ||
{ | ||
endpoint: "npipe:////./pipe/mypipe2", |
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.
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?
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.
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.
@yujuhong Addressed comments. PTAL |
/approve |
[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 |
/retest |
/test pull-kubernetes-integration |
/lgtm |
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:
/sig windows
/assign @PatrickLang