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

Add network stats for Windows nodes and containers #74788

Merged
merged 3 commits into from Mar 8, 2019

Conversation

@feiskyer
Copy link
Member

feiskyer commented Mar 1, 2019

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

Add network stats for Windows nodes and containers.

Which issue(s) this PR fixes:

Fixes #74101

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add network stats for Windows nodes and containers

/sig windows
/sig node
/assign @yujuhong @PatrickLang @michmike

@feiskyer

This comment has been minimized.

Copy link
Member Author

feiskyer commented Mar 1, 2019

/milestone v1.14

@k8s-ci-robot k8s-ci-robot added this to the v1.14 milestone Mar 1, 2019

@k8s-ci-robot k8s-ci-robot requested review from dims and tallclair Mar 1, 2019

@michmike michmike added this to In Review in SIG-Windows Mar 1, 2019

@michmike

This comment has been minimized.

Copy link

michmike commented Mar 1, 2019

@benmoss, @aserdean can you PTAL

Show resolved Hide resolved pkg/kubelet/stats/BUILD Outdated
@michmike

This comment has been minimized.

Copy link

michmike commented Mar 1, 2019

looks good overall, even though there is a lot of duplication of code that would have been better in an abstraction. i noted a small bug in there.

have you tested this and how does performance relate to the previous code?
thanks for all the work!

@feiskyer feiskyer force-pushed the feiskyer:windows-network-stats branch from 575609f to fd5a7a5 Mar 4, 2019

@feiskyer

This comment has been minimized.

Copy link
Member Author

feiskyer commented Mar 4, 2019

Fixed the bug now. PTAL.

have you tested this and how does performance relate to the previous code?

Yep, kubelet consumes much less CPU now (kubelet 1-4% from my cluster).

@feiskyer

This comment has been minimized.

Copy link
Member Author

feiskyer commented Mar 4, 2019

/retest

// listContainerNetworkStats returns the network stats of all the running containers.
func (p *criStatsProvider) listContainerNetworkStats() (map[string]*statsapi.NetworkStats, error) {
// Always return nil for unsupported platforms.
return nil, nil

This comment has been minimized.

@benmoss

benmoss Mar 4, 2019

Member

This is going to yield a nil pointer exception on unsupported platforms on cri_stats_provider.go:192. Not sure if it matters, but maybe this could return an error like https://github.com/kubernetes/kubernetes/blob/48def74e641f8dff50fcf7c33c2a412593e2fede/pkg/util/mount/exec_mount_unsupported.go ?

This comment has been minimized.

@feiskyer

feiskyer Mar 5, 2019

Author Member

In such case, we still want to continue other stats logic in callers. So nil is returned here instead of errors.

This comment has been minimized.

@yujuhong

yujuhong Mar 6, 2019

Member

The way the code is written right now, it's hard to tell whether nil is expected or not. @feiskyer is there any existing e2e test that can be modified to validate whether networkstats is present? Maybe the summary API test?

This comment has been minimized.

@feiskyer

feiskyer Mar 7, 2019

Author Member

For Linx, there always have network stats, but for Windows, there doesn't before this PR. After this, both Windows and Linux containers would have network stats.

@k8s-ci-robot k8s-ci-robot added the lgtm label Mar 6, 2019

@michmike

This comment has been minimized.

Copy link

michmike commented Mar 6, 2019

/lgtm

@michmike

This comment has been minimized.

Copy link

michmike commented Mar 6, 2019

/approve

@michmike

This comment has been minimized.

Copy link

michmike commented Mar 6, 2019

/assign @yujuhong

@yujuhong

This comment has been minimized.

Copy link
Member

yujuhong commented Mar 6, 2019

/hold
Reviewing and I will some questions (will post soon). Holding this PR to avoid it from being merged accidentally.

@yujuhong

This comment has been minimized.

Copy link
Member

yujuhong commented Mar 6, 2019

/test pull-kubernetes-e2e-containerd-gce

@PatrickLang

This comment has been minimized.

Copy link
Contributor

PatrickLang commented Mar 6, 2019

I'm only seeing one network now.

    "network": {
      "time": "2019-03-06T19:42:34Z",
      "name": "e76e4a10-eth0",
      "rxBytes": 146563,
      "txBytes": 491768,
      "interfaces": [
        {
          "name": "e76e4a10-eth0",
          "rxBytes": 146563,
          "txBytes": 491768
        }
      ]
    },

That matches the adapter name from the Azure-CNI logs:

azure-vnet.log:704:2019/03/06 19:38:59 [cni-net] Creating endpoint e76e4a10-eth0.
azure-vnet.log:705:2019/03/06 19:38:59 [net] Creating endpoint &{Id:e76e4a10-eth0
ContainerID:e76e4a108a64edbac93f89f286262fea94221c3ecb1f7854909fc7ddd275e96d
NetNsPath:none IfName:eth0 SandboxKey: IfIndex:0 MacAddress:
DNS:{Suffix:default.svc.cluster.local Servers:[10.0.0.10 168.63.129.16]} ...

Looks good!

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Mar 6, 2019

@feiskyer: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-containerd-gce ee5fd0a link /test pull-kubernetes-e2e-containerd-gce

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@yujuhong
Copy link
Member

yujuhong left a comment

The CRI stats path is not tested by dockershim+linux AFAIK. I can't get the presubmit containerd job to run right now, so we'll need to check if post-submit CI will be affected by this change.

Other than that, this mostly looks good with questions/comments.

The summary api test is in the node e2e suite (cannot be run by windows yet). I think we should port the test over to a regular e2e, and do some sanity check to see what metrics are present. I don't think it should block this PR, but that should be addressed afterwards.

Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider_others.go Outdated
Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider_windows.go Outdated
Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider_windows.go Outdated
Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider_windows.go Outdated
Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider.go
Show resolved Hide resolved pkg/kubelet/stats/cri_stats_provider.go
// listContainerNetworkStats returns the network stats of all the running containers.
func (p *criStatsProvider) listContainerNetworkStats() (map[string]*statsapi.NetworkStats, error) {
// Always return nil for unsupported platforms.
return nil, nil

This comment has been minimized.

@yujuhong

yujuhong Mar 6, 2019

Member

The way the code is written right now, it's hard to tell whether nil is expected or not. @feiskyer is there any existing e2e test that can be modified to validate whether networkstats is present? Maybe the summary API test?

Show resolved Hide resolved pkg/kubelet/stats/helper.go
Show resolved Hide resolved pkg/kubelet/winstats/network_stats.go Outdated
go wait.Forever(func() {
p.collectMetricsData(cpuCounter, memWorkingSetCounter, memCommittedBytesCounter)
p.collectMetricsData(cpuCounter, memWorkingSetCounter, memCommittedBytesCounter, networkAdapterCounter)

This comment has been minimized.

@yujuhong

yujuhong Mar 6, 2019

Member

Is the perfCounterUpdatePeriod (1s) still reasonable after adding more metrics?

This comment has been minimized.

@feiskyer

feiskyer Mar 7, 2019

Author Member

1s should still work. And for network stats, there are some metrics per second. To ensure the cumulative data correctly, 1s should be used.

@PatrickLang

This comment has been minimized.

Copy link
Contributor

PatrickLang commented Mar 7, 2019

/retest pull-kubernetes-e2e-containerd-gce

@yujuhong

This comment has been minimized.

Copy link
Member

yujuhong commented Mar 7, 2019

pull-kubernetes-e2e-containerd-gce

We haven't triggered this job for a while. Seems like it doesn't work anymore. We'll watch the post-submit CI instead.

@feiskyer

This comment has been minimized.

Copy link
Member Author

feiskyer commented Mar 7, 2019

The summary api test is in the node e2e suite (cannot be run by windows yet). I think we should port the test over to a regular e2e, and do some sanity check to see what metrics are present. I don't think it should block this PR, but that should be addressed afterwards.

@PatrickLang Could you open an issue for tracking this? We should enable node e2e tests for Windows.

feiskyer added some commits Mar 7, 2019

@feiskyer feiskyer force-pushed the feiskyer:windows-network-stats branch from ee5fd0a to d690037 Mar 7, 2019

@k8s-ci-robot k8s-ci-robot removed the lgtm label Mar 7, 2019

@PatrickLang

This comment has been minimized.

Copy link
Contributor

PatrickLang commented Mar 7, 2019

/LGTM
@yujuhong can you approve?

@k8s-ci-robot k8s-ci-robot added the lgtm label Mar 7, 2019

@yujuhong

This comment has been minimized.

Copy link
Member

yujuhong commented Mar 7, 2019

/hold cancel
/lgtm
/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Mar 7, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, michmike, 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 merged commit fbc5150 into kubernetes:master Mar 8, 2019

17 checks passed

cla/linuxfoundation feiskyer authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-conformance-image-test Skipped.
pull-kubernetes-cross Skipped.
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-godeps Skipped.
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped.
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
pull-publishing-bot-validate Skipped.
tide In merge pool.
Details

SIG-Windows automation moved this from 1.14 Release Blocking (Windows GA, gMSA alpha) to Done (v.1.14) Mar 8, 2019

@feiskyer feiskyer deleted the feiskyer:windows-network-stats branch Mar 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.