Skip to content

Commit 21e6323

Browse files
committed
chore: use capo cluster agent for API requests
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.
1 parent 88a3a1d commit 21e6323

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/scope/provider.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737

3838
infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
3939
"sigs.k8s.io/cluster-api-provider-openstack/pkg/clients"
40+
"sigs.k8s.io/cluster-api-provider-openstack/version"
4041
)
4142

4243
const (
@@ -152,6 +153,10 @@ func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logg
152153
return nil, nil, "", fmt.Errorf("create providerClient err: %v", err)
153154
}
154155

156+
ua := gophercloud.UserAgent{}
157+
ua.Prepend(fmt.Sprintf("cluster-api-provider-openstack/%s", version.Get().String()))
158+
provider.UserAgent = ua
159+
155160
config := &tls.Config{
156161
MinVersion: tls.VersionTLS12,
157162
}

0 commit comments

Comments
 (0)