From 21e6323ff39747b766d19f155a7057822231698a Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Thu, 20 Jul 2023 05:40:07 +0200 Subject: [PATCH] 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. --- pkg/scope/provider.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/scope/provider.go b/pkg/scope/provider.go index 50592c2f40..d062b0382d 100644 --- a/pkg/scope/provider.go +++ b/pkg/scope/provider.go @@ -37,6 +37,7 @@ import ( infrav1 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7" "sigs.k8s.io/cluster-api-provider-openstack/pkg/clients" + "sigs.k8s.io/cluster-api-provider-openstack/version" ) const ( @@ -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())) + provider.UserAgent = ua + config := &tls.Config{ MinVersion: tls.VersionTLS12, }