-
Notifications
You must be signed in to change notification settings - Fork 208
feat: Implement KEP3751 ("ControllerModifyVolume") #2344
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
Conversation
|
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 Once the patch is verified, the new status will be reflected by the 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. |
|
/ok-to-test |
|
/retest |
| } | ||
|
|
||
| model := armcompute.DiskUpdate{ | ||
| SKU: &armcompute.DiskSKU{ |
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.
are these two parameters necessary in DiskUpdate struct? IMO, if only sku is needed, then only update sku, otherwise only update diskProperties
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.
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?
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 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
|
/retest |
1 similar comment
|
/retest |
pkg/azuredisk/controllerserver.go
Outdated
| skuName = "" | ||
| } | ||
|
|
||
| if _, err := azureutils.NormalizeCachingMode(diskParams.CachingMode); err != nil { |
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.
why there is cachingmode check here since cachingmode change is not allowed
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.
remove it since azuredisk cannot change PremiumV2
pkg/azuredisk/controllerserver.go
Outdated
| } | ||
| if skuName == armcompute.DiskStorageAccountTypesPremiumV2LRS { | ||
| // PremiumV2LRS only supports None caching mode | ||
| azureutils.SetKeyValueInMap(diskParams.VolumeContext, consts.CachingModeField, string(v1.AzureDataDiskCachingNone)) |
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.
so this change is also not necessary?
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.
remove it
pkg/azuredisk/controllerserver.go
Outdated
| azureutils.SetKeyValueInMap(diskParams.VolumeContext, consts.CachingModeField, string(v1.AzureDataDiskCachingNone)) | ||
| } | ||
|
|
||
| metricsRequest := "controller_modify_volume" |
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 necessary to define a new var here since it's just used once
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.
remove it
pkg/azuredisk/controllerserver_v2.go
Outdated
| mc.ObserveOperationWithResult(isOperationSucceeded, consts.VolumeID, diskURI) | ||
| }() | ||
|
|
||
| err = localDiskController.ModifyDisk(ctx, volumeOptions) |
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.
pls make same change as v1
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.
done
pkg/azuredisk/controllerserver_v2.go
Outdated
| return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume not found, failed with error: %v", err)) | ||
| } | ||
|
|
||
| mutableParams := req.GetMutableParameters() |
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.
remove this mutableParams var define, just use req.GetMutableParameters() in L327
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.
remove it
pkg/azuredisk/controllerserver.go
Outdated
| return nil, status.Error(codes.NotFound, fmt.Sprintf("Volume not found, failed with error: %v", err)) | ||
| } | ||
|
|
||
| mutableParams := req.GetMutableParameters() |
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.
remove this mutableParams var define, just use req.GetMutableParameters() in L327
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.
remove it
| } | ||
| } | ||
|
|
||
| if _, err := diskClient.Patch(ctx, rg, options.DiskName, model); err != nil { |
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.
only run diskClient.Patch if model.SKU or model.Properties is not nil
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.
done
|
/retest |
|
/retest |
1 similar comment
|
/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) |
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.
remove this line since it's not necessary
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.
done
pkg/azureutils/azure_disk_utils.go
Outdated
| 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) |
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.
pls also provide the key name in error msg, e.g. (parsing %s:%s failed with error: %v, consts.DiskIOPSReadWriteField, v, err)
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.
add it
pkg/azureutils/azure_disk_utils.go
Outdated
| 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) |
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 as the above comments
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.
added
pkg/azuredisk/controllerserver.go
Outdated
| } | ||
| diskURI := volumeID | ||
|
|
||
| if err := azureutils.IsValidDiskURI(diskURI); err != nil { |
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 necessary here since since azureutils.GetDiskName(diskURI) already checks whether diskURI is valid
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.
remove it
pkg/azuredisk/controllerserver.go
Outdated
| ResourceGroup: diskParams.ResourceGroup, | ||
| SubscriptionID: diskParams.SubscriptionID, | ||
| StorageAccountType: skuName, | ||
| SourceResourceID: volumeID, |
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.
use diskURI even it's the same
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.
done
|
pls also add yamllint check in the PR, refer to kubernetes-sigs/blob-csi-driver#1484 |
|
/test pull-azuredisk-csi-driver-sanity |
| @@ -0,0 +1,49 @@ | |||
| --- | |||
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.
pls use existing sc/pvc/pod config yaml files, this yaml file is not necessary
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.
But the existing sc has no yaml files to use PremiumV2_LRS which supports DiskIOPSReadWrite and DiskMBpsReadWrite parameters as an example.
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.
then only create a new storage class
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.
done
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.
/lgtm
|
[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 |
|
pls cherrypick to release-1.30, thx |
|
New changes are detected. LGTM label has been removed. |
|
/retest |
3 similar comments
|
/retest |
|
/retest |
|
/retest |
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:
Release note: