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

[release-1.29] fix: cache GetVolumeStats on Windows node #2275

Conversation

andyzhangx
Copy link
Member

What type of PR is this?
/kind bug

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

cherrypick of #2273

(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. labels Apr 11, 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 ZeroMagic April 11, 2024 03:40
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 11, 2024
@andyzhangx
Copy link
Member Author

/retest

5 similar comments
@andyzhangx
Copy link
Member Author

/retest

@andyzhangx
Copy link
Member Author

/retest

@andyzhangx
Copy link
Member Author

/retest

@andyzhangx
Copy link
Member Author

/retest

@andyzhangx
Copy link
Member Author

/retest

@andyzhangx andyzhangx merged commit baf5fc8 into kubernetes-sigs:release-1.29 Apr 11, 2024
24 of 25 checks passed
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.

2 participants