Skip to content

Conversation

@umagnus
Copy link
Contributor

@umagnus umagnus commented Jun 7, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

feat: Implement KEP3751 ("ControllerModifyVolume")
Implements support for modifying volumes via KEP3751 (https://kep.k8s.io/3751)

Which issue(s) this PR fixes:

Fixes #

Requirements:

Special notes for your reviewer:

I0627 02:52:59.490914       1 utils.go:105] GRPC call: /csi.v1.Controller/ControllerModifyVolume
I0627 02:52:59.490952       1 utils.go:106] GRPC request: {"mutable_parameters":{"DiskIOPSReadWrite":"5000","DiskMBpsReadWrite":"1200"},"volume_id":"/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-526c35c8-87d2-4a67-8cee-99e3b6ce3b3f"}
I0627 02:52:59.875553       1 controllerserver.go:437] begin to modify azure disk() account type() rg() location()
I0627 02:52:59.875586       1 azure_managedDiskController.go:420] azureDisk - modifying managed Name:pvc-526c35c8-87d2-4a67-8cee-99e3b6ce3b3f, StorageAccountType:, DiskIOPSReadWrite:5000, DiskMBpsReadWrite:1200
I0627 02:53:03.174198       1 azure_managedDiskController.go:486] azureDisk - modified new MD Name:pvc-526c35c8-87d2-4a67-8cee-99e3b6ce3b3f StorageAccountType:
I0627 02:53:03.174248       1 controllerserver.go:466] modify azure disk() account type() rg() location() successfully
I0627 02:53:03.174608       1 azure_metrics.go:115] "Observed Request Latency" latency_seconds=3.298678755 request="azuredisk_csi_driver_controller_modify_volume" resource_group="mc_aks-yxytest_group_aks-yxytest_eastus" subscription_id="8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8" source="disk.csi.azure.com" volumeid="/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-526c35c8-87d2-4a67-8cee-99e3b6ce3b3f" result_code="succeeded"

I0627 06:58:30.405618       1 utils.go:105] GRPC call: /csi.v1.Controller/ControllerModifyVolume
I0627 06:58:30.405664       1 utils.go:106] GRPC request: {"mutable_parameters":{"cachingMode":"None","skuName":"StandardSSD_LRS"},"volume_id":"/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a"}
I0627 06:58:30.533276       1 controllerserver.go:437] begin to modify azure disk() account type(StandardSSD_LRS) rg() location()
I0627 06:58:30.533333       1 azure_managedDiskController.go:420] azureDisk - modifying managed Name:pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a, StorageAccountType:StandardSSD_LRS, DiskIOPSReadWrite:, DiskMBpsReadWrite:
I0627 06:58:33.598201       1 azure_managedDiskController.go:486] azureDisk - modified new MD Name:pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a StorageAccountType:StandardSSD_LRS
I0627 06:58:33.598251       1 controllerserver.go:466] modify azure disk() account type(StandardSSD_LRS) rg() location() successfully
I0627 06:58:33.598305       1 azure_metrics.go:115] "Observed Request Latency" latency_seconds=3.064952723 request="azuredisk_csi_driver_controller_modify_volume" resource_group="mc_aks-yxytest_group_aks-yxytest_eastus" subscription_id="8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8" source="disk.csi.azure.com" volumeid="/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a" result_code="succeeded"

I0627 07:14:17.551830       1 utils.go:105] GRPC call: /csi.v1.Controller/ControllerModifyVolume
I0627 07:14:17.551909       1 utils.go:106] GRPC request: {"mutable_parameters":{"skuName":"Premium_LRS"},"volume_id":"/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a"}
I0627 07:14:17.634946       1 controllerserver.go:437] begin to modify azure disk() account type(Premium_LRS) rg() location()
I0627 07:14:17.635000       1 azure_managedDiskController.go:420] azureDisk - modifying managed Name:pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a, StorageAccountType:Premium_LRS, DiskIOPSReadWrite:, DiskMBpsReadWrite:
I0627 07:14:20.141664       1 azure_managedDiskController.go:486] azureDisk - modified new MD Name:pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a StorageAccountType:Premium_LRS
I0627 07:14:20.141707       1 controllerserver.go:466] modify azure disk() account type(Premium_LRS) rg() location() successfully
I0627 07:14:20.141760       1 azure_metrics.go:115] "Observed Request Latency" latency_seconds=2.506722411 request="azuredisk_csi_driver_controller_modify_volume" resource_group="mc_aks-yxytest_group_aks-yxytest_eastus" subscription_id="8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8" source="disk.csi.azure.com" volumeid="/subscriptions/8ecadfc9-d1a3-4ea4-b844-0d9f87e4d7c8/resourceGroups/MC_aks-yxytest_group_aks-yxytest_eastus/providers/Microsoft.Compute/disks/pvc-11b511bb-c767-42c9-9fae-cf31c641ab4a" result_code="succeeded"
I0627 07:14:20.141795       1 utils.go:112] GRPC response: {}

image
image

Release note:

none

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 7, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @umagnus. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 7, 2024
@andyzhangx
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 7, 2024
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 25, 2024
@umagnus
Copy link
Contributor Author

umagnus commented Jun 26, 2024

/retest

}

model := armcompute.DiskUpdate{
SKU: &armcompute.DiskSKU{
Copy link
Member

Choose a reason for hiding this comment

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

are these two parameters necessary in DiskUpdate struct? IMO, if only sku is needed, then only update sku, otherwise only update diskProperties

Copy link
Member

Choose a reason for hiding this comment

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

in L432, there is result, err := diskClient.Get(ctx, rg, options.DiskName) operation, is this necessary if disk sku is not going to be modified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I move model.SKU = &armcompute.DiskSKU{ Name: to.Ptr(diskSku), } and model.Properties = &diskProperties in update needed. But I think result, err := diskClient.Get(ctx, rg, options.DiskName) is still need because we need old disk sku in L443 and L454

@umagnus
Copy link
Contributor Author

umagnus commented Jun 28, 2024

/retest

1 similar comment
@umagnus
Copy link
Contributor Author

umagnus commented Jun 28, 2024

/retest

skuName = ""
}

if _, err := azureutils.NormalizeCachingMode(diskParams.CachingMode); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

why there is cachingmode check here since cachingmode change is not allowed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it since azuredisk cannot change PremiumV2

}
if skuName == armcompute.DiskStorageAccountTypesPremiumV2LRS {
// PremiumV2LRS only supports None caching mode
azureutils.SetKeyValueInMap(diskParams.VolumeContext, consts.CachingModeField, string(v1.AzureDataDiskCachingNone))
Copy link
Member

Choose a reason for hiding this comment

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

so this change is also not necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it

azureutils.SetKeyValueInMap(diskParams.VolumeContext, consts.CachingModeField, string(v1.AzureDataDiskCachingNone))
}

metricsRequest := "controller_modify_volume"
Copy link
Member

Choose a reason for hiding this comment

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

not necessary to define a new var here since it's just used once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it

mc.ObserveOperationWithResult(isOperationSucceeded, consts.VolumeID, diskURI)
}()

err = localDiskController.ModifyDisk(ctx, volumeOptions)
Copy link
Member

Choose a reason for hiding this comment

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

pls make same change as v1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume not found, failed with error: %v", err))
}

mutableParams := req.GetMutableParameters()
Copy link
Member

Choose a reason for hiding this comment

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

remove this mutableParams var define, just use req.GetMutableParameters() in L327

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it

return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume not found, failed with error: %v", err))
}

mutableParams := req.GetMutableParameters()
Copy link
Member

Choose a reason for hiding this comment

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

remove this mutableParams var define, just use req.GetMutableParameters() in L327

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it

}
}

if _, err := diskClient.Patch(ctx, rg, options.DiskName, model); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

only run diskClient.Patch if model.SKU or model.Properties is not nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@andyzhangx
Copy link
Member

/retest

@umagnus
Copy link
Contributor Author

umagnus commented Jul 3, 2024

/retest

1 similar comment
@umagnus
Copy link
Contributor Author

umagnus commented Jul 4, 2024

/retest

klog.V(4).Infof("azureDisk - no modification needed for disk(%s)", options.DiskName)
}

klog.V(2).Infof("azureDisk - modified new MD Name:%s StorageAccountType:%s", options.DiskName, options.StorageAccountType)
Copy link
Member

Choose a reason for hiding this comment

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

remove this line since it's not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

diskParams.ResourceGroup = v
case consts.DiskIOPSReadWriteField:
if _, err = strconv.Atoi(v); err != nil {
return diskParams, fmt.Errorf("parse %s failed with error: %v", v, err)
Copy link
Member

Choose a reason for hiding this comment

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

pls also provide the key name in error msg, e.g. (parsing %s:%s failed with error: %v, consts.DiskIOPSReadWriteField, v, err)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

add it

diskParams.DiskIOPSReadWrite = v
case consts.DiskMBPSReadWriteField:
if _, err = strconv.Atoi(v); err != nil {
return diskParams, fmt.Errorf("parse %s failed with error: %v", v, err)
Copy link
Member

Choose a reason for hiding this comment

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

same as the above comments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

}
diskURI := volumeID

if err := azureutils.IsValidDiskURI(diskURI); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

not necessary here since since azureutils.GetDiskName(diskURI) already checks whether diskURI is valid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove it

ResourceGroup: diskParams.ResourceGroup,
SubscriptionID: diskParams.SubscriptionID,
StorageAccountType: skuName,
SourceResourceID: volumeID,
Copy link
Member

Choose a reason for hiding this comment

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

use diskURI even it's the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@andyzhangx
Copy link
Member

pls also add yamllint check in the PR, refer to kubernetes-sigs/blob-csi-driver#1484

@andyzhangx
Copy link
Member

/test pull-azuredisk-csi-driver-sanity

@@ -0,0 +1,49 @@
---
Copy link
Member

Choose a reason for hiding this comment

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

pls use existing sc/pvc/pod config yaml files, this yaml file is not necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the existing sc has no yaml files to use PremiumV2_LRS which supports DiskIOPSReadWrite and DiskMBpsReadWrite parameters as an example.

Copy link
Member

Choose a reason for hiding this comment

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

then only create a new storage class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 16, 2024
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 16, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andyzhangx, umagnus

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 Jul 16, 2024
@andyzhangx andyzhangx changed the title [draft] feat: Implement KEP3751 ("ControllerModifyVolume") feat: Implement KEP3751 ("ControllerModifyVolume") Jul 16, 2024
@andyzhangx
Copy link
Member

pls cherrypick to release-1.30, thx

@k8s-ci-robot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 16, 2024
@andyzhangx
Copy link
Member

/retest

3 similar comments
@andyzhangx
Copy link
Member

/retest

@umagnus
Copy link
Contributor Author

umagnus commented Jul 17, 2024

/retest

@andyzhangx
Copy link
Member

/retest

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/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants