Skip to content
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

feat: Identifiable user agents in various Argo commands #5624

Merged
merged 1 commit into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/argo/commands/client/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ package client

import (
"context"
"fmt"
"os"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

"github.com/argoproj/argo-workflows/v3"
"github.com/argoproj/argo-workflows/v3/pkg/apiclient"
"github.com/argoproj/argo-workflows/v3/util/kubeconfig"
)
Expand Down Expand Up @@ -86,6 +89,8 @@ func GetAuthString() string {
if err != nil {
log.Fatal(err)
}
version := argo.GetVersion()
restConfig = restclient.AddUserAgent(restConfig, fmt.Sprintf("argo-workflows/%s argo-cli", version.Version))
authString, err := kubeconfig.GetAuthString(restConfig, explicitPath)
if err != nil {
log.Fatal(err)
Expand Down
4 changes: 4 additions & 0 deletions cmd/argo/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ import (
"golang.org/x/net/context"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth"
restclient "k8s.io/client-go/rest"
"k8s.io/utils/env"

"github.com/argoproj/argo-workflows/v3"
"github.com/argoproj/argo-workflows/v3/cmd/argo/commands/client"
wfclientset "github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned"
"github.com/argoproj/argo-workflows/v3/server/apiserver"
Expand Down Expand Up @@ -59,6 +61,8 @@ See %s`, help.ArgoSever),
if err != nil {
return err
}
version := argo.GetVersion()
config = restclient.AddUserAgent(config, fmt.Sprintf("argo-workflows/%s argo-server", version.Version))
config.Burst = 30
config.QPS = 20.0

Expand Down
2 changes: 1 addition & 1 deletion cmd/argoexec/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func initExecutor() *executor.WorkflowExecutor {
executorType := os.Getenv(common.EnvVarContainerRuntimeExecutor)
log.WithFields(log.Fields{"version": version, "executorType": executorType}).Info("Starting Workflow Executor")
config, err := clientConfig.ClientConfig()
config = restclient.AddUserAgent(config, fmt.Sprintf("argo-workflows/%s executor/%s", version.Version, executorType))
checkErr(err)
config = restclient.AddUserAgent(config, fmt.Sprintf("argo-workflows/%s argo-executor/%s", version.Version, executorType))

logs.AddK8SLogTransportWrapper(config) // lets log all request as we should typically do < 5 per pod, so this is will show up problems

Expand Down
4 changes: 4 additions & 0 deletions cmd/workflow-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import (

// load authentication plugin for obtaining credentials from cloud providers.
_ "k8s.io/client-go/plugin/pkg/client/auth"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

"github.com/argoproj/argo-workflows/v3"
wfclientset "github.com/argoproj/argo-workflows/v3/pkg/client/clientset/versioned"
cmdutil "github.com/argoproj/argo-workflows/v3/util/cmd"
"github.com/argoproj/argo-workflows/v3/util/logs"
Expand Down Expand Up @@ -71,6 +73,8 @@ func NewRootCommand() *cobra.Command {
if err != nil {
return err
}
version := argo.GetVersion()
config = restclient.AddUserAgent(config, fmt.Sprintf("argo-workflows/%s argo-controller", version.Version))
config.Burst = burst
config.QPS = qps

Expand Down