Skip to content

Commit

Permalink
fix: Add identifiable user agent in API client. Fixes #11996 (#12276)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrytangyuan committed Nov 27, 2023
1 parent 1f49104 commit bb29d6a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/apiclient/argo-kube-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
sensor "github.com/argoproj/argo-events/pkg/client/sensor/clientset/versioned"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

"github.com/argoproj/argo-workflows/v3"
"github.com/argoproj/argo-workflows/v3/persist/sqldb"
"github.com/argoproj/argo-workflows/v3/pkg/apiclient/clusterworkflowtemplate"
"github.com/argoproj/argo-workflows/v3/pkg/apiclient/cronworkflow"
Expand Down Expand Up @@ -45,6 +47,8 @@ func newArgoKubeClient(ctx context.Context, clientConfig clientcmd.ClientConfig,
if err != nil {
return nil, nil, err
}
version := argo.GetVersion()
restConfig = restclient.AddUserAgent(restConfig, fmt.Sprintf("argo-workflows/%s argo-api-client", version.Version))
dynamicClient, err := dynamic.NewForConfig(restConfig)
if err != nil {
return nil, nil, fmt.Errorf("failure to create dynamic client: %w", err)
Expand Down

0 comments on commit bb29d6a

Please sign in to comment.