-
Notifications
You must be signed in to change notification settings - Fork 193
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
Support UserAgent Attribution #962
Conversation
Hi @kassarl. 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/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kassarl 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 |
9ed1908
to
d77ab72
Compare
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.
would you vendor the latest cloud provider first?
pkg/azuredisk/controllerserver.go
Outdated
@@ -293,6 +299,14 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) | |||
contentSource := &csi.VolumeContentSource{} | |||
for k, v := range customTagsMap { | |||
tags[k] = v | |||
if k == userAgentField { |
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.
user agent does not need to be set in storage class, we only need to hard code in our driver or set as driver parameter in driver start up
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.
@andyzhangx We need a way to track Azure cloud operations initiated by partner ISVs on behalf of another customer. This is done through the user agent strings as described in Azure customer usage attribution.
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 would suggest add a new parameter(userAgent
) instead of customer tags in storage class to track csi driver operations. if not set, use hard coded userAgent in driver, the implementation in this PR is too redudunt, here is a clean example: kubernetes-sigs/azurefile-csi-driver@ac18a0b
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.
The logic that was behind this was that ISVs would need a specific storage class created that tags useragent on operations, but wouldn't want the rest of the operations to be tagged with the Useragent. Vybava is verifying what method makes the most sense, but this was the implementation we initially decided to go for
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.
while current implementation would set useragent for all operations done by the driver since this whole driver would use only one useragent. Is there a customer asking for this feature? specify useragent in storage class(no matter it's tags or userAgent
field) is not a good idea: 1) PV does not use this storage class would also get the same useragent 2) if driver restart, userAgent setting would be gone.
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 created another PR to change default userAgent(#969), though it's not related to this scenario.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
…trollerserver.go to use storageclass variable and include config from secret
15e89e2
to
092b41d
Compare
case userAgentField: | ||
nonUserAgentCloud = d.cloud | ||
newUserAgent := v | ||
d.cloud, err = SetupNewUserAgentCloud(newUserAgent, d.cloud) |
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.
We don't want to change the global instance of the cloud provider as we only want the custom user agent string used for the duration of this CreateVolume
call and not for any others. Use a local variable initialized to d.cloud
for the CreateVolume
call and override the value here instead.
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.
actually in Line 219, it already changes the global instance. It's hard to set multiple cloud provider instances for multiple userAgents unless we set a big lock in CreateVolume to block other create volume activities until it succeeds, while set a lock would bring performance issue.
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.
we could support one userAgent setting in global instance in first stage, and then check how to support multiple userAgents settings in next stage, that also lgtm for me. Anyway, it's up to you.
And pls reuse GetCloudProvider
func as possible as you can, don't duplicate code, thanks.
@@ -1219,3 +1241,139 @@ func getEntriesAndNextToken(req *csi.ListSnapshotsRequest, snapshots []compute.S | |||
|
|||
return listSnapshotResp, nil | |||
} | |||
|
|||
// Creates a new cloud during CreateVolume call to configure the Useragent property of DiskClient | |||
func SetupNewUserAgentCloud(userAgent string, currentAz *azure.Cloud) (*azure.Cloud, error) { |
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.
Consider GetCloudProviderWithUserAgent
and move this and supporting functions to same file as GetCloudProvider
. (This is currently pkg/azuredisk/azure.go
, but #977 will be moving it to pkg/azureutils/azure_disk_utils.go
.)
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 reuse existing functions, and don't duplicate functions, code duplication would make it difficult to maintain
@@ -384,7 +384,7 @@ func (az *Cloud) DeletePublicIP(service *v1.Service, pipResourceGroup string, pi | |||
} | |||
|
|||
// DeleteLB invokes az.LoadBalancerClient.Delete with exponential backoff retry | |||
func (az *Cloud) DeleteLB(service *v1.Service, lbName string) error { |
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.
You have updates to the vendor
directory, but I don't see any corresponding updates to go.mod
. Are you missing this file in the PR?
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 must have forgotten to add go.mod. When I updated the vendors, it changed almost all of the packages so I was trying to just include the ones relevant. I'll fix that
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.
vendor change was already done in previous PR, just rebase to current master branch
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.
/ok-to-test
@kassarl: The following test failed, say
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. |
@kassarl: PR needs rebase. 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. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Allows for customer attribution for PVCs when they are created
Which issue(s) this PR fixes:
Fixes #
Requirements:
Special notes for your reviewer:
Release note: