-
Notifications
You must be signed in to change notification settings - Fork 181
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
[draft] feat: Implement KEP3751 ("ControllerModifyVolume") #2344
base: master
Are you sure you want to change the base?
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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: umagnus The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/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 |
} | ||
|
||
model := armcompute.DiskUpdate{} | ||
result, err := diskClient.Get(ctx, rg, options.DiskName) |
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.
diskClient.Get
is only needed if options.StorageAccountType != "" && options.StorageAccountType != diskSku, I think this logic should move to L446
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.
diskSku
is the previous sku which is *result.SKU.Name
get from result
, so I think diskClient.Get
is still needed
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 ModifyVolume, if user does not input new disk sku, this diskClient.Get
call is not needed
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 we still need diskSku in L454, one condition is that the old sku is not ultrassd or premiumv2, but cx give iops and throught and no disksku. If we don't get old disk sku, we can't determine it
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 |
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: