Documentation ¶
Index ¶
- Variables
- func LoadTemplate(path string) (*wfv1.Template, error)
- type ContainerRuntimeExecutor
- type WorkflowExecutor
- func (we *WorkflowExecutor) AddAnnotation(ctx context.Context, key, value string) error
- func (we *WorkflowExecutor) AddError(err error)
- func (we *WorkflowExecutor) AnnotateOutputs(ctx context.Context, logArt *wfv1.Artifact) error
- func (we *WorkflowExecutor) CaptureScriptExitCode(ctx context.Context) error
- func (we *WorkflowExecutor) CaptureScriptResult(ctx context.Context) error
- func (we *WorkflowExecutor) ExecResource(action string, manifestPath string, flags []string) (string, string, error)
- func (we *WorkflowExecutor) GetConfigMapKey(ctx context.Context, name, key string) (string, error)
- func (we *WorkflowExecutor) GetMainContainerID(ctx context.Context) (string, error)
- func (we *WorkflowExecutor) GetMainContainerStatus(ctx context.Context) (*apiv1.ContainerStatus, error)
- func (we *WorkflowExecutor) GetSecret(ctx context.Context, accessKeyName string, accessKey string) (string, error)
- func (we *WorkflowExecutor) GetSecrets(ctx context.Context, namespace, name, key string) ([]byte, error)
- func (we *WorkflowExecutor) GetTerminationGracePeriodDuration(ctx context.Context) (time.Duration, error)
- func (we *WorkflowExecutor) HandleError(ctx context.Context)
- func (we *WorkflowExecutor) InitDriver(ctx context.Context, art *wfv1.Artifact) (artifact.ArtifactDriver, error)
- func (we *WorkflowExecutor) KillSidecars(ctx context.Context) error
- func (we *WorkflowExecutor) LoadArtifacts(ctx context.Context) error
- func (we *WorkflowExecutor) LoadExecutionControl() error
- func (we *WorkflowExecutor) SaveArtifacts(ctx context.Context) error
- func (we *WorkflowExecutor) SaveLogs(ctx context.Context) (*wfv1.Artifact, error)
- func (we *WorkflowExecutor) SaveParameters(ctx context.Context) error
- func (we *WorkflowExecutor) SaveResourceParameters(ctx context.Context, resourceNamespace string, resourceName string) error
- func (we *WorkflowExecutor) StageFiles() error
- func (we *WorkflowExecutor) Wait(ctx context.Context) error
- func (we *WorkflowExecutor) WaitResource(ctx context.Context, resourceNamespace string, resourceName string) error
Constants ¶
This section is empty.
Variables ¶
var ExecutorRetry = wait.Backoff{ Steps: 5, Duration: 1 * time.Second, Factor: 1.6, Jitter: 0.5, }
ExecutorRetry is a retry backoff settings for WorkflowExecutor Run Seconds 0 0.000 1 1.000 2 2.600 3 5.160 4 9.256
Functions ¶
Types ¶
type ContainerRuntimeExecutor ¶
type ContainerRuntimeExecutor interface { // GetFileContents returns the file contents of a file in a container as a string GetFileContents(containerID string, sourcePath string) (string, error) // CopyFile copies a source file in a container to a local path CopyFile(containerID string, sourcePath string, 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, containerID string, combinedOutput bool) (io.ReadCloser, error) // GetExitCode returns the exit code of the container // Used to capture script exit code as an output parameter GetExitCode(ctx context.Context, containerID string) (string, error) // WaitInit is called before Wait() to signal the executor about an impending Wait call. // For most executors this is a noop, and is only used by the the PNS executor WaitInit() error // Wait waits for the container to complete Wait(ctx context.Context, containerID string) error // Kill a list of containerIDs first with a SIGTERM then with a SIGKILL after a grace period Kill(ctx context.Context, containerIDs []string, terminationGracePeriodDuration time.Duration) error }
ContainerRuntimeExecutor is the interface for interacting with a container runtime (e.g. docker)
type WorkflowExecutor ¶
type WorkflowExecutor struct { PodName string Template wfv1.Template ClientSet kubernetes.Interface Namespace string PodAnnotationsPath string ExecutionControl *common.ExecutionControl RuntimeExecutor ContainerRuntimeExecutor // contains filtered or unexported fields }
WorkflowExecutor is program which runs as the init/wait container
func NewExecutor ¶
func NewExecutor(clientset kubernetes.Interface, podName, namespace, podAnnotationsPath string, cre ContainerRuntimeExecutor, template wfv1.Template) WorkflowExecutor
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(err error)
AddError adds an error to the list of encountered errors durign execution
func (*WorkflowExecutor) AnnotateOutputs ¶
AnnotateOutputs annotation to the pod indicating all the outputs.
func (*WorkflowExecutor) CaptureScriptExitCode ¶
func (we *WorkflowExecutor) CaptureScriptExitCode(ctx context.Context) error
CaptureScriptExitCode will add the exit code of a script template as output exit code
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(action string, manifestPath string, flags []string) (string, string, error)
ExecResource will run kubectl action against a manifest
func (*WorkflowExecutor) GetConfigMapKey ¶
GetConfigMapKey retrieves a configmap value and memoizes the result
func (*WorkflowExecutor) GetMainContainerID ¶
func (we *WorkflowExecutor) GetMainContainerID(ctx context.Context) (string, error)
GetMainContainerID returns the container id of the main container
func (*WorkflowExecutor) GetMainContainerStatus ¶
func (we *WorkflowExecutor) GetMainContainerStatus(ctx context.Context) (*apiv1.ContainerStatus, error)
GetMainContainerStatus returns the container status of the main container, nil if the main container does not exist
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) GetSecrets ¶
func (we *WorkflowExecutor) GetSecrets(ctx context.Context, namespace, name, key string) ([]byte, error)
GetSecrets retrieves a secret value and memoizes the result
func (*WorkflowExecutor) GetTerminationGracePeriodDuration ¶
func (we *WorkflowExecutor) GetTerminationGracePeriodDuration(ctx context.Context) (time.Duration, error)
GetTerminationGracePeriodDuration returns the terminationGracePeriodSeconds of podSpec in Time.Duration format
func (*WorkflowExecutor) HandleError ¶
func (we *WorkflowExecutor) HandleError(ctx context.Context)
HandleError is a helper to annotate the pod with the error message upon a unexpected executor panic or error
func (*WorkflowExecutor) InitDriver ¶
func (we *WorkflowExecutor) InitDriver(ctx context.Context, art *wfv1.Artifact) (artifact.ArtifactDriver, error)
InitDriver initializes an instance of an artifact driver
func (*WorkflowExecutor) KillSidecars ¶
func (we *WorkflowExecutor) KillSidecars(ctx context.Context) error
KillSidecars kills any sidecars to the main container
func (*WorkflowExecutor) LoadArtifacts ¶
func (we *WorkflowExecutor) LoadArtifacts(ctx context.Context) error
LoadArtifacts loads artifacts from location to a container path
func (*WorkflowExecutor) LoadExecutionControl ¶
func (we *WorkflowExecutor) LoadExecutionControl() error
LoadExecutionControl reads the execution control definition from the the Kubernetes downward api annotations volume file
func (*WorkflowExecutor) SaveArtifacts ¶
func (we *WorkflowExecutor) SaveArtifacts(ctx context.Context) error
SaveArtifacts uploads artifacts to the archive location
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() 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 string, resourceName string) error
WaitResource waits for a specific resource to satisfy either the success or failure condition