util

package
v3.2.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: Apache-2.0 Imports: 47 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddParamToGlobalScope added in v3.0.3

func AddParamToGlobalScope(wf *wfv1.Workflow, log *log.Entry, param wfv1.Parameter) bool

func ApplySubmitOpts

func ApplySubmitOpts(wf *wfv1.Workflow, opts *wfv1.SubmitOpts) error

Apply the Submit options into workflow object

func ConvertYAMLToJSON

func ConvertYAMLToJSON(str string) (string, error)

func CreateServerDryRun

func CreateServerDryRun(ctx context.Context, wf *wfv1.Workflow, wfClientset wfclientset.Interface) (*wfv1.Workflow, error)

CreateServerDryRun fills the workflow struct with the server's representation without creating it and returns an error, if there is any

func FormulateResubmitWorkflow

func FormulateResubmitWorkflow(wf *wfv1.Workflow, memoized bool) (*wfv1.Workflow, error)

FormulateResubmitWorkflow formulate a new workflow from a previous workflow, optionally re-using successful nodes

func FromUnstructured

func FromUnstructured(un *unstructured.Unstructured) (*wfv1.Workflow, error)

FromUnstructured converts an unstructured object to a workflow. This function performs a lot of allocations and con resulting in a lot of memory being used. Users should avoid invoking this function if the data they need is available from `unstructured.Unstructured`. especially if they're looping. Available values include: `GetLabels()`, `GetName()`, `GetNamespace()` etc. Single values can be accessed using `unstructured.Nested*`, e.g. `unstructured.NestedString(un.Object, "spec", "phase")`.

func FromUnstructuredObj

func FromUnstructuredObj(un *unstructured.Unstructured, v interface{}) error

func GetNodeType

func GetNodeType(tmpl *wfv1.Template) wfv1.NodeType

func InstanceIDRequirement

func InstanceIDRequirement(instanceID string) labels.Requirement

InstanceIDRequirement returns the label requirement to filter against a controller instance (or not)

func IsJSONStr

func IsJSONStr(str string) bool

func IsWorkflowCompleted

func IsWorkflowCompleted(wf *wfv1.Workflow) bool

IsWorkflowCompleted returns whether or not a workflow is considered completed

func IsWorkflowSuspended

func IsWorkflowSuspended(wf *wfv1.Workflow) bool

IsWorkflowSuspended returns whether or not a workflow is considered suspended

func JoinWorkflowMetaData

func JoinWorkflowMetaData(wfMetaData, wftMetaData, wfDefaultMetaData *metav1.ObjectMeta)

JoinWorkflowMetaData will join the workflow metadata with the following order of preference 1. Workflow, 2 WorkflowTemplate (WorkflowTemplateRef), 3. WorkflowDefault.

func JoinWorkflowSpec

func JoinWorkflowSpec(wfSpec, wftSpec, wfDefaultSpec *wfv1.WorkflowSpec) (*wfv1.Workflow, error)

JoinWorkflowSpec will join the workflow specs with the following order of preference 1. Workflow Spec, 2 WorkflowTemplate Spec (WorkflowTemplateRef), 3. WorkflowDefault Spec.

func MergeTo

func MergeTo(patch, target *wfv1.Workflow) error

MergeTo will merge one workflow (the "patch" workflow) into another (the "target" workflow. If the target workflow defines a field, this take precedence over the patch.

func NewWorkflowInformer

func NewWorkflowInformer(dclient dynamic.Interface, ns string, resyncPeriod time.Duration, tweakListOptions internalinterfaces.TweakListOptionsFunc, indexers cache.Indexers) cache.SharedIndexInformer

NewWorkflowInformer returns the workflow informer used by the controller. This is actually a custom built UnstructuredInformer which is in actuality returning unstructured.Unstructured objects. We no longer return WorkflowInformer due to: https://github.com/kubernetes/kubernetes/issues/57705 https://github.com/argoproj/argo-workflows/issues/632

func PodSpecPatchMerge

func PodSpecPatchMerge(wf *wfv1.Workflow, tmpl *wfv1.Template) (string, error)

PodSpecPatchMerge will do strategic merge the workflow level PodSpecPatch and template level PodSpecPatch

func PopulateSubmitOpts

func PopulateSubmitOpts(command *cobra.Command, submitOpts *wfv1.SubmitOpts, includeDryRun bool)

func ReadFromFilePathsOrUrls

func ReadFromFilePathsOrUrls(filePathsOrUrls ...string) ([][]byte, error)

ReadFromFilePathsOrUrls reads the content of a single or a list of file paths and/or urls

func ReadFromStdin

func ReadFromStdin() ([]byte, error)

Reads from stdin

func ReadFromUrl

func ReadFromUrl(url string) ([]byte, error)

Reads the content of a url

func ReadManifest

func ReadManifest(manifestPaths ...string) ([][]byte, error)

ReadManifest reads from stdin, a single file/url, or a list of files and/or urls

func ResumeWorkflow

func ResumeWorkflow(ctx context.Context, wfIf v1alpha1.WorkflowInterface, hydrator hydrator.Interface, workflowName string, nodeFieldSelector string) error

ResumeWorkflow resumes a workflow by setting spec.suspend to nil and any suspended nodes to Successful. Retries conflict errors

func RetryWorkflow

func RetryWorkflow(ctx context.Context, kubeClient kubernetes.Interface, hydrator hydrator.Interface, wfClient v1alpha1.WorkflowInterface, name string, restartSuccessful bool, nodeFieldSelector string) (*wfv1.Workflow, error)

RetryWorkflow updates a workflow, deleting all failed steps as well as the onExit node (and children)

func SelectorMatchesNode

func SelectorMatchesNode(selector fields.Selector, node wfv1.NodeStatus) bool

func SetWorkflow

func SetWorkflow(ctx context.Context, wfClient v1alpha1.WorkflowInterface, hydrator hydrator.Interface, name string, nodeFieldSelector string, values SetOperationValues) error

func StopWorkflow

func StopWorkflow(ctx context.Context, wfClient v1alpha1.WorkflowInterface, hydrator hydrator.Interface, name string, nodeFieldSelector string, message string) error

StopWorkflow terminates a workflow by setting its spec.shutdown to ShutdownStrategyStop Or terminates a single resume step referenced by nodeFieldSelector

func SubmitWorkflow

func SubmitWorkflow(ctx context.Context, wfIf v1alpha1.WorkflowInterface, wfClientset wfclientset.Interface, namespace string, wf *wfv1.Workflow, opts *wfv1.SubmitOpts) (*wfv1.Workflow, error)

SubmitWorkflow validates and submit a single workflow and override some of the fields of the workflow

func SuspendWorkflow

func SuspendWorkflow(ctx context.Context, wfIf v1alpha1.WorkflowInterface, workflowName string) error

SuspendWorkflow suspends a workflow by setting spec.suspend to true. Retries conflict errors

func TerminateWorkflow

func TerminateWorkflow(ctx context.Context, wfClient v1alpha1.WorkflowInterface, name string) error

TerminateWorkflow terminates a workflow by setting its spec.shutdown to ShutdownStrategyTerminate

func ToUnstructured

func ToUnstructured(wf *wfv1.Workflow) (*unstructured.Unstructured, error)

ToUnstructured converts an workflow to an Unstructured object

Types

type SetOperationValues

type SetOperationValues struct {
	Phase            wfv1.NodePhase
	Message          string
	OutputParameters map[string]string
}

type WorkflowLister

type WorkflowLister interface {
	List() ([]*wfv1.Workflow, error)
}

WorkflowLister implements the List() method of v1alpha.WorkflowLister interface but does so using an Unstructured informer and converting objects to workflows. Ignores objects that failed to convert.

func NewWorkflowLister

func NewWorkflowLister(informer cache.SharedIndexInformer) WorkflowLister

NewWorkflowLister returns a new workflow lister

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL