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

Set executor log level #1226

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 4 additions & 0 deletions cmd/argoexec/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ func initExecutor() *executor.WorkflowExecutor {
podAnnotationsPath = GlobalArgs.podAnnotationsPath
}

if logLevel := os.Getenv(common.EnvVarLogLevel); logLevel != "" {
cmd.SetLogLevel(logLevel)
}

config, err := clientConfig.ClientConfig()
if err != nil {
panic(err.Error())
Expand Down
2 changes: 2 additions & 0 deletions workflow/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const (
EnvVarKubeletPort = "ARGO_KUBELET_PORT"
// EnvVarKubeletInsecure is used to disable the TLS verification
EnvVarKubeletInsecure = "ARGO_KUBELET_INSECURE"
// EnvVarLogLevel is the log level of executor
EnvVarLogLevel = "ARGO_LOG_LEVEL"

// ContainerRuntimeExecutorDocker to use docker as container runtime executor
ContainerRuntimeExecutorDocker = "docker"
Expand Down
3 changes: 3 additions & 0 deletions workflow/controller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ type WorkflowControllerConfig struct {
// ExecutorResources specifies the resource requirements that will be used for the executor sidecar
ExecutorResources *apiv1.ResourceRequirements `json:"executorResources,omitempty"`

// ExecutorLogLevel is the log level of executor
ExecutorLogLevel string `json:"executorLogLevel,omitempty"`

// KubeConfig specifies a kube config file for the wait & init containers
KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`

Expand Down
13 changes: 10 additions & 3 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,23 @@ func (woc *wfOperationCtx) newWaitContainer(tmpl *wfv1.Template) (*apiv1.Contain
}

func (woc *wfOperationCtx) createEnvVars() []apiv1.EnvVar {
envVars := execEnvVars
if woc.controller.Config.ExecutorLogLevel != "" {
envVars = append(envVars, apiv1.EnvVar{
Name: common.EnvVarLogLevel,
Value: woc.controller.Config.ExecutorLogLevel,
})
}
switch woc.controller.Config.ContainerRuntimeExecutor {
case common.ContainerRuntimeExecutorK8sAPI:
return append(execEnvVars,
return append(envVars,
apiv1.EnvVar{
Name: common.EnvVarContainerRuntimeExecutor,
Value: woc.controller.Config.ContainerRuntimeExecutor,
},
)
case common.ContainerRuntimeExecutorKubelet:
return append(execEnvVars,
return append(envVars,
apiv1.EnvVar{
Name: common.EnvVarContainerRuntimeExecutor,
Value: woc.controller.Config.ContainerRuntimeExecutor,
Expand All @@ -291,7 +298,7 @@ func (woc *wfOperationCtx) createEnvVars() []apiv1.EnvVar {
},
)
default:
return execEnvVars
return envVars
}
}

Expand Down