-
Notifications
You must be signed in to change notification settings - Fork 253
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
🌱 chore: use capo cluster agent for API requests #1614
Conversation
At the moment, we do not modify the user agent for all API requests we make which make it hard to identify if certain requests were done by CAPO or not. This change prepends the CAPO version to the Gophercloud user agent which will give plenty of benefits.
✅ Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
/lgtm make paste the updated output will be informative |
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.
This looks great. Unfortunately we don't currently set the version in our builds, so we're going to have to fix that too.
For an example of how this is done see: https://github.com/kubernetes/cloud-provider-openstack/blob/b229f849774e7e1976256faf2df4931841d242fa/Makefile#L39
@mdbooth ... i think we do..? https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/main/Makefile#L114-L115 though i haven't really validated here. |
I didn't know that was there! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mdbooth, mnaser 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 |
@@ -152,6 +153,10 @@ func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logg | |||
return nil, nil, "", fmt.Errorf("create providerClient err: %v", err) | |||
} | |||
|
|||
ua := gophercloud.UserAgent{} | |||
ua.Prepend(fmt.Sprintf("cluster-api-provider-openstack/%s", version.Get().String())) |
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.
Is there benefit in using the default user agent and simply prepending to it, e.g.
provider.UserAgent.Prepend(fmt.Sprintf("cluster-api-provider-openstack/%s", version.Get().String()))
That way we'll also get the gophercloud version in use. Perhaps that's overkill...?
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.
Personally I mimicked the patter that was used by the CPO so that's how I got where I got.
/hold cancel |
What this PR does / why we need it:
At the moment, we do not modify the user agent for all API requests we make which make it hard to identify if certain requests were done by CAPO or not.
This change prepends the CAPO version to the Gophercloud user agent which will give plenty of benefits.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #1611
Special notes for your reviewer:
TODOs:
/hold