Skip to content

Commit

Permalink
chore: use capo cluster agent for API requests
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mnaser committed Jul 20, 2023
1 parent 88a3a1d commit 21e6323
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/scope/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 21e6323

Please sign in to comment.