Documentation
¶
Index ¶
- func GetTerminationGracePeriodDuration() time.Duration
- func IsWorkflowCompleted(wts *wfv1.WorkflowTaskSet) bool
- type AgentExecutor
- type ContainerRuntimeExecutor
- type Initializer
- type TemplateWriter
- type WorkflowExecutor
- func (we *WorkflowExecutor) AddAnnotation(ctx context.Context, key, value string) error
- func (we *WorkflowExecutor) AddError(ctx context.Context, err error)
- func (we *WorkflowExecutor) CaptureScriptResult(ctx context.Context) error
- func (we *WorkflowExecutor) Data(ctx context.Context) error
- func (we *WorkflowExecutor) ExecResource(ctx context.Context, action string, manifestPath string, flags []string) (string, string, string, error)
- func (we *WorkflowExecutor) FinalizeOutput(ctx context.Context)
- func (we *WorkflowExecutor) GetConfigMapKey(ctx context.Context, name, key string) (string, error)
- func (we *WorkflowExecutor) GetSecret(ctx context.Context, accessKeyName string, accessKey string) (string, error)
- func (we *WorkflowExecutor) HandleError(ctx context.Context) func()
- func (we *WorkflowExecutor) HasError() error
- func (we *WorkflowExecutor) Init() error
- func (we *WorkflowExecutor) InitDriver(ctx context.Context, art *wfv1.Artifact) (artifactcommon.ArtifactDriver, error)
- func (we *WorkflowExecutor) InitializeOutput(ctx context.Context)
- func (we *WorkflowExecutor) KillArtifactSidecars(ctx context.Context) error
- func (we *WorkflowExecutor) LoadArtifactsFromPlugin(ctx context.Context, pluginName wfv1.ArtifactPluginName) error
- func (we *WorkflowExecutor) LoadArtifactsWithoutPlugins(ctx context.Context) error
- func (we *WorkflowExecutor) PostMain(ctx, bgCtx context.Context, preMainFailed bool) error
- func (we *WorkflowExecutor) ReportOutputs(ctx context.Context, artifacts []wfv1.Artifact) error
- func (we *WorkflowExecutor) ReportOutputsLogs(ctx context.Context) error
- func (we *WorkflowExecutor) SaveArtifacts(ctx context.Context) (wfv1.Artifacts, error)
- func (we *WorkflowExecutor) SaveLogs(ctx context.Context) []wfv1.Artifact
- func (we *WorkflowExecutor) SaveParameters(ctx context.Context) error
- func (we *WorkflowExecutor) SaveResourceParameters(ctx context.Context, resourceNamespace string, resourceName string) error
- func (we *WorkflowExecutor) StageFiles(ctx context.Context) error
- func (we *WorkflowExecutor) Wait(ctx context.Context) error
- func (we *WorkflowExecutor) WaitResource(ctx context.Context, resourceNamespace, resourceName, selfLink string) error
- func (we *WorkflowExecutor) WorkflowName() string
- func (we *WorkflowExecutor) WriteTemplate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTerminationGracePeriodDuration ¶
GetTerminationGracePeriodDuration returns the terminationGracePeriodSeconds of podSpec in Time.Duration format
func IsWorkflowCompleted ¶
func IsWorkflowCompleted(wts *wfv1.WorkflowTaskSet) bool
Types ¶
type AgentExecutor ¶
type AgentExecutor struct {
WorkflowName string
ClientSet kubernetes.Interface
WorkflowInterface workflow.Interface
RESTClient rest.Interface
Namespace string
// contains filtered or unexported fields
}
func NewAgentExecutor ¶
func NewAgentExecutor(clientSet kubernetes.Interface, restClient rest.Interface, config *rest.Config, namespace, workflowName, workflowUID string, plugins []executorplugins.TemplateExecutor) *AgentExecutor
type ContainerRuntimeExecutor ¶
type ContainerRuntimeExecutor interface {
// GetFileContents returns the file contents of a file in a container as a string
GetFileContents(containerName string, sourcePath string) (string, error)
// CopyFile copies a source file in a container to a local path
CopyFile(ctx context.Context, containerName, sourcePath, destPath string, compressionLevel int) error
// GetOutputStream returns the entirety of the container output as a io.Reader
// Used to capture script results as an output parameter, and to archive container logs
GetOutputStream(ctx context.Context, containerName string, combinedOutput bool) (io.ReadCloser, error)
// Wait waits for the container to complete.
Wait(ctx context.Context, containerNames []string) error
// Kill a list of containers first with a SIGTERM then with a SIGKILL after a grace period
Kill(ctx context.Context, containerNames []string, terminationGracePeriodDuration time.Duration) error
}
ContainerRuntimeExecutor is the interface for interacting with a container runtime
type Initializer ¶
type TemplateWriter ¶
TemplateWriter is implemented by runtime executors that can write the template JSON to the shared volume without performing the full Init sequence (e.g. without copying the argoexec binary). Used by the init-less `supervisor` entrypoint, where the binary is delivered via a Kubernetes image volume.
type WorkflowExecutor ¶
type WorkflowExecutor struct {
PodName string
Template wfv1.Template
IncludeScriptOutput bool
Deadline time.Time
ClientSet kubernetes.Interface
RESTClient rest.Interface
Namespace string
RuntimeExecutor ContainerRuntimeExecutor
Tracing *tracing.Tracing
// contains filtered or unexported fields
}
WorkflowExecutor is program which runs as the init/wait container
func NewExecutor ¶
func NewExecutor( ctx context.Context, clientset kubernetes.Interface, taskResultClient argoprojv1.WorkflowTaskResultInterface, restClient rest.Interface, podName string, podUID types.UID, workflow string, workflowUID types.UID, nodeID, namespace string, cre ContainerRuntimeExecutor, template wfv1.Template, includeScriptOutput bool, deadline time.Time, annotationPatchTickDuration, readProgressFileTickDuration time.Duration, ) (*WorkflowExecutor, error)
NewExecutor instantiates a new workflow executor
func (*WorkflowExecutor) AddAnnotation ¶
func (we *WorkflowExecutor) AddAnnotation(ctx context.Context, key, value string) error
AddAnnotation adds an annotation to the workflow pod
func (*WorkflowExecutor) AddError ¶
func (we *WorkflowExecutor) AddError(ctx context.Context, err error)
AddError adds an error to the list of encountered errors during execution
func (*WorkflowExecutor) CaptureScriptResult ¶
func (we *WorkflowExecutor) CaptureScriptResult(ctx context.Context) error
CaptureScriptResult will add the stdout of a script template as output result
func (*WorkflowExecutor) ExecResource ¶
func (we *WorkflowExecutor) ExecResource(ctx context.Context, action string, manifestPath string, flags []string) (string, string, string, error)
ExecResource will run kubectl action against a manifest
func (*WorkflowExecutor) FinalizeOutput ¶
func (we *WorkflowExecutor) FinalizeOutput(ctx context.Context)
FinalizeOutput adds a label or annotation to denote that outputs have completed reporting.
func (*WorkflowExecutor) GetConfigMapKey ¶
GetConfigMapKey retrieves a configmap value and memoizes the result. Safe to call concurrently from multiple plugin-load goroutines in init-less mode; memoizedMu serializes map access.
func (*WorkflowExecutor) GetSecret ¶
func (we *WorkflowExecutor) GetSecret(ctx context.Context, accessKeyName string, accessKey string) (string, error)
GetSecret will retrieve the Secrets from VolumeMount
func (*WorkflowExecutor) HandleError ¶
func (we *WorkflowExecutor) HandleError(ctx context.Context) func()
HandleError is a helper to annotate the pod with the error message upon a unexpected executor panic or error. Usage: defer we.HandleError(ctx)()
func (*WorkflowExecutor) HasError ¶
func (we *WorkflowExecutor) HasError() error
HasError return the first error if exist
func (*WorkflowExecutor) Init ¶
func (we *WorkflowExecutor) Init() error
func (*WorkflowExecutor) InitDriver ¶
func (we *WorkflowExecutor) InitDriver(ctx context.Context, art *wfv1.Artifact) (artifactcommon.ArtifactDriver, error)
InitDriver initializes an instance of an artifact driver
func (*WorkflowExecutor) InitializeOutput ¶
func (we *WorkflowExecutor) InitializeOutput(ctx context.Context)
func (*WorkflowExecutor) KillArtifactSidecars ¶
func (we *WorkflowExecutor) KillArtifactSidecars(ctx context.Context) error
func (*WorkflowExecutor) LoadArtifactsFromPlugin ¶
func (we *WorkflowExecutor) LoadArtifactsFromPlugin(ctx context.Context, pluginName wfv1.ArtifactPluginName) error
func (*WorkflowExecutor) LoadArtifactsWithoutPlugins ¶
func (we *WorkflowExecutor) LoadArtifactsWithoutPlugins(ctx context.Context) error
func (*WorkflowExecutor) PostMain ¶
func (we *WorkflowExecutor) PostMain(ctx, bgCtx context.Context, preMainFailed bool) error
PostMain drives the phase after the user's main container has started: wait for main to exit, then capture script result, output parameters, output artifacts and logs, and report outputs. It is shared between the `argoexec wait` command (legacy pod layout) and the new `argoexec supervisor` command (init-less pod layout).
If preMainFailed is true, the supervisor's pre-main phase failed (or the ready marker could not be written). In that case the user's main never produced outputs and we must NOT try to save script result / output parameters / output artifacts — those calls would fail with confusing "file not found" errors on required artifacts. We still wait for main to exit and capture logs so the failure is surfaced cleanly.
The caller owns tracing init/shutdown and the defer stack (errHandler, FinalizeOutput, KillArtifactSidecars, stats). bgCtx is a span-scoped background context used for calls that must not be cancelled with the parent ctx so that outputs are still captured during termination.
func (*WorkflowExecutor) ReportOutputs ¶
ReportOutputs updates the WorkflowTaskResult (or falls back to annotate the Pod)
func (*WorkflowExecutor) ReportOutputsLogs ¶
func (we *WorkflowExecutor) ReportOutputsLogs(ctx context.Context) error
ReportOutputsLogs updates the WorkflowTaskResult log fields
func (*WorkflowExecutor) SaveArtifacts ¶
SaveArtifacts uploads artifacts to the archive location
func (*WorkflowExecutor) SaveLogs ¶
func (we *WorkflowExecutor) SaveLogs(ctx context.Context) []wfv1.Artifact
func (*WorkflowExecutor) SaveParameters ¶
func (we *WorkflowExecutor) SaveParameters(ctx context.Context) error
SaveParameters will save the content in the specified file path as output parameter value
func (*WorkflowExecutor) SaveResourceParameters ¶
func (we *WorkflowExecutor) SaveResourceParameters(ctx context.Context, resourceNamespace string, resourceName string) error
SaveResourceParameters will save any resource output parameters
func (*WorkflowExecutor) StageFiles ¶
func (we *WorkflowExecutor) StageFiles(ctx context.Context) error
StageFiles will create any files required by script/resource templates
func (*WorkflowExecutor) Wait ¶
func (we *WorkflowExecutor) Wait(ctx context.Context) error
Wait is the sidecar container logic which waits for the main container to complete. Also monitors for updates in the pod annotations which may change (e.g. terminate) Upon completion, kills any sidecars after it finishes.
func (*WorkflowExecutor) WaitResource ¶
func (we *WorkflowExecutor) WaitResource(ctx context.Context, resourceNamespace, resourceName, selfLink string) error
WaitResource waits for a specific resource to satisfy either the success or failure condition
func (*WorkflowExecutor) WorkflowName ¶
func (we *WorkflowExecutor) WorkflowName() string
WorkflowName returns the name of the workflow being executed
func (*WorkflowExecutor) WriteTemplate ¶
func (we *WorkflowExecutor) WriteTemplate() error
WriteTemplate writes the template JSON to the shared volume without copying the argoexec binary. Used by the init-less supervisor, where the binary is delivered via a Kubernetes image volume.