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: cache GetVolumeStats on Windows node #2273

Merged

Conversation

andyzhangx
Copy link
Member

@andyzhangx andyzhangx commented Apr 10, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:
fix: cache GetVolumeStats on Windows node

(Get-Item -Path $Env:mount).Target powershell command is an expensive call on Windows node, this PR adds a 10min expire cache into GetVolumeStats on Windows node, thus to reduce the calling number

I0411 02:02:50.830339   23500 utils.go:105] GRPC call: /csi.v1.Node/NodeGetVolumeStats
I0411 02:02:50.830339   23500 utils.go:106] GRPC request: {"volume_id":"/subscriptions/b9d2281e-dcd5-4dfd-9a97-0d50377cdf76/resourceGroups/MC_andy-aks127_andy-aks127_eastus2euap/providers/Microsoft.Compute/disks/pvc-f2aab55f-72a2-459b-bd78-eb865864afcf","volume_path":"c:\\var\\lib\\kubelet\\pods\\05906335-fed7-4564-abc5-2e3a1ae55f4e\\volumes\\kubernetes.io~csi\\pvc-f2aab55f-72a2-459b-bd78-eb865864afcf\\mount"}
I0411 02:02:50.831825   23500 azure_disk_utils.go:830] Executing command: "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Mta -NoProfile -Command (Get-Item -Path $Env:mount).Target"
I0411 02:02:51.127112   23500 azure_disk_utils.go:830] Executing command: "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Mta -NoProfile -Command (Get-Item -Path $Env:mount).Target"
I0411 02:02:51.409105   23500 safe_mounter_host_process_windows.go:243] GetVolumeStats(c:\var\lib\kubelet\pods\05906335-fed7-4564-abc5-2e3a1ae55f4e\volumes\kubernetes.io~csi\pvc-f2aab55f-72a2-459b-bd78-eb865864afcf\mount) returned volumeID(\\?\Volume{9f75c746-4b8f-4e38-8ef2-7ce79f6ad55f}\)
I0411 02:02:51.411294   23500 azure_disk_utils.go:830] Executing command: "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -Mta -NoProfile -Command (Get-Volume -UniqueId \"$Env:volumeID\" | Select SizeRemaining,Size) | ConvertTo-Json"
I0411 02:02:53.534717   23500 utils.go:112] GRPC response: {"usage":[{"available":107219058688,"total":107356352512,"unit":1,"used":137293824}]}
I0411 02:03:21.142675   23500 utils.go:105] GRPC call: /csi.v1.Node/NodeGetCapabilities
I0411 02:03:21.142675   23500 utils.go:106] GRPC request: {}
I0411 02:03:21.142675   23500 utils.go:112] GRPC response: {"capabilities":[{"Type":{"Rpc":{"type":1}}},{"Type":{"Rpc":{"type":3}}},{"Type":{"Rpc":{"type":2}}},{"Type":{"Rpc":{"type":5}}}]}
I0411 02:03:21.146027   23500 utils.go:105] GRPC call: /csi.v1.Node/NodeGetVolumeStats
I0411 02:03:21.146027   23500 utils.go:106] GRPC request: {"volume_id":"/subscriptions/b9d2281e-dcd5-4dfd-9a97-0d50377cdf76/resourceGroups/MC_andy-aks127_andy-aks127_eastus2euap/providers/Microsoft.Compute/disks/pvc-dd0cf69e-4031-4b23-82c4-8b649188c059","volume_path":"c:\\var\\lib\\kubelet\\pods\\e29b9bc8-bdce-466c-a647-7093425340b7\\volumes\\kubernetes.io~csi\\pvc-dd0cf69e-4031-4b23-82c4-8b649188c059\\mount"}
I0411 02:03:21.146513   23500 azure_common_windows.go:175] NodeGetVolumeStats: volume stats for volume /subscriptions/b9d2281e-dcd5-4dfd-9a97-0d50377cdf76/resourceGroups/MC_andy-aks127_andy-aks127_eastus2euap/providers/Microsoft.Compute/disks/pvc-dd0cf69e-4031-4b23-82c4-8b649188c059 path c:\var\lib\kubelet\pods\e29b9bc8-bdce-466c-a647-7093425340b7\volumes\kubernetes.io~csi\pvc-dd0cf69e-4031-4b23-82c4-8b649188c059\mount is cached
I0411 02:03:21.146513   23500 utils.go:112] GRPC response: {"usage":[{"available":107224064000,"total":107356352512,"unit":1,"used":132288512}]}

Which issue(s) this PR fixes:

Fixes #2235

Requirements:

Special notes for your reviewer:

(Get-Item -Path C:\var\lib\kubelet\pods\01b6c711-6226-4df9-8fd9-c4886319d48f\volumes\kubernetes.io~csi\pvc-c8096712-6a5a-43f8-a33b-1060a4cd412d\mount).Target
c:\var\lib\kubelet\plugins\kubernetes.io\csi\file.csi.azure.com\426aaea866bfa6e7db031404028042a2460256f5b454e0727c921138389be445\globalmount

(Get-Item -Path c:\var\lib\kubelet\plugins\kubernetes.io\csi\file.csi.azure.com\426aaea866bfa6e7db031404028042a2460256f5b454e0727c921138389be445\globalmount).Target
UNC\fc07931f463f043a5bd1a0b.file.core.windows.net\pvc-c8096712-6a5a-43f8-a33b-1060a4cd412d\

(Get-Item -Path C:\var\lib\kubelet\plugins\kubernetes.io\csi\disk.csi.azure.com\95d764218d14515cced832a6fa730d0cd34db9315b93e1fb89d8d9eaf7e7903a\globalmount).Target
Volume{5119f826-d03c-4d16-9fd1-5e9c1c29c939}\

I0409 13:38:51.650865   20420 volume.go:239] Readlink: c:\var\lib\kubelet\plugins\kubernetes.io\csi\disk.csi.azure.com\95d764218d14515cced832a6fa730d0cd34db9315b93e1fb89d8d9eaf7e7903a\globalmount
I0409 13:38:51.651481   20420 volume.go:239] Readlink: G:\
E0409 13:38:51.656304   20420 utils.go:110] GRPC error: GetVolumeIDFromMount(c:\var\lib\kubelet\pods\1e8d0def-30cd-4571-bb7d-2d366a186b0d\volumes\kubernetes.io~csi\pvc-62b91cd8-17c7-4bbe-a819-0461d396bc6c\mount) failed with error: readlink G:\: The file or directory is not a reparse point.

Release note:

fix: cache GetVolumeStats on Windows node

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 10, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx

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 requested review from cvvz and edreed April 10, 2024 15:10
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 10, 2024
@andyzhangx andyzhangx removed the request for review from edreed April 10, 2024 15:12
@andyzhangx andyzhangx force-pushed the cache-volume-stats-win branch from ca5682e to de92e7e Compare April 10, 2024 15:15
@andyzhangx
Copy link
Member Author

/retest

@k8s-ci-robot
Copy link
Contributor

@andyzhangx: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-azuredisk-csi-driver-e2e-capz de92e7e link true /test pull-azuredisk-csi-driver-e2e-capz
pull-azuredisk-csi-driver-e2e-capz-windows-2019-hostprocess de92e7e link true /test pull-azuredisk-csi-driver-e2e-capz-windows-2019-hostprocess

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.

@andyzhangx andyzhangx merged commit 9e16113 into kubernetes-sigs:master Apr 11, 2024
22 of 25 checks passed
@andyzhangx
Copy link
Member Author

/cherrypick release-1.30

@andyzhangx
Copy link
Member Author

/cherrypick release-1.29

@k8s-infra-cherrypick-robot

@andyzhangx: new pull request created: #2274

In response to this:

/cherrypick release-1.30

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-infra-cherrypick-robot

@andyzhangx: #2273 failed to apply on top of branch "release-1.29":

Applying: fix: cache GetVolumeStats on Windows node
Using index info to reconstruct a base tree...
M	pkg/azuredisk/azuredisk.go
A	pkg/azuredisk/azuredisk_option.go
M	pkg/azuredisk/nodeserver.go
M	pkg/azuredisk/nodeserver_v2.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/azuredisk/nodeserver_v2.go
Auto-merging pkg/azuredisk/nodeserver.go
CONFLICT (modify/delete): pkg/azuredisk/azuredisk_option.go deleted in HEAD and modified in fix: cache GetVolumeStats on Windows node. Version fix: cache GetVolumeStats on Windows node of pkg/azuredisk/azuredisk_option.go left in tree.
Auto-merging pkg/azuredisk/azuredisk.go
CONFLICT (content): Merge conflict in pkg/azuredisk/azuredisk.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix: cache GetVolumeStats on Windows node
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.29

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.

@andyzhangx
Copy link
Member Author

/cherrypick release-1.28

@k8s-infra-cherrypick-robot

@andyzhangx: #2273 failed to apply on top of branch "release-1.28":

Applying: fix: cache GetVolumeStats on Windows node
Using index info to reconstruct a base tree...
M	pkg/azuredisk/azuredisk.go
A	pkg/azuredisk/azuredisk_option.go
M	pkg/azuredisk/nodeserver.go
M	pkg/azuredisk/nodeserver_v2.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/azuredisk/nodeserver_v2.go
Auto-merging pkg/azuredisk/nodeserver.go
CONFLICT (modify/delete): pkg/azuredisk/azuredisk_option.go deleted in HEAD and modified in fix: cache GetVolumeStats on Windows node. Version fix: cache GetVolumeStats on Windows node of pkg/azuredisk/azuredisk_option.go left in tree.
Auto-merging pkg/azuredisk/azuredisk.go
CONFLICT (content): Merge conflict in pkg/azuredisk/azuredisk.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix: cache GetVolumeStats on Windows node
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherrypick release-1.28

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.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High CPU and memory usage on Windows Node
3 participants