v2.0.0-alpha3+incompat... Latest Latest

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

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 7 Imported by: 0




View Source
const (
	CRDKind      string = "Workflow"
	CRDSingular  string = "workflow"
	CRDPlural    string = "workflows"
	CRDShortName string = "wf"
	CRDGroup     string = "argoproj.io"
	CRDVersion   string = "v1alpha1"
	CRDFullName  string = CRDPlural + "." + CRDGroup

CRD constants


View Source
var (
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme   = SchemeBuilder.AddToScheme
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: CRDGroup, Version: CRDVersion}

Create a Rest client with the new CRD Schema


func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group-qualified GroupResource.


type Arguments

type Arguments struct {
	Parameters []Parameter `json:"parameters,omitempty"`
	Artifacts  []Artifact  `json:"artifacts,omitempty"`

Arguments to a template

func (*Arguments) GetArtifactByName

func (args *Arguments) GetArtifactByName(name string) *Artifact

func (*Arguments) GetParameterByName

func (args *Arguments) GetParameterByName(name string) *Parameter

type Artifact

type Artifact struct {
	// name of the artifact. must be unique within a template's inputs/outputs.
	Name string `json:"name"`

	// Path is the container path to the artifact
	Path string `json:"path,omitempty"`

	// mode bits to use on this file, must be a value between 0 and 0777
	// set when loading input artifacts.
	Mode *int32 `json:"mode,omitempty"`

	// From allows an artifact to reference an artifact from a previous step
	From string `json:"from,omitempty"`

	ArtifactLocation `json:",inline,squash"`

Artifact indicates an artifact to place at a specified path

func (*Artifact) HasLocation

func (a *Artifact) HasLocation() bool

HasLocation whether or not an artifact has a location defined

type ArtifactLocation

type ArtifactLocation struct {
	S3          *S3Artifact          `json:"s3,omitempty"`
	Git         *GitArtifact         `json:"git,omitempty"`
	HTTP        *HTTPArtifact        `json:"http,omitempty"`
	Artifactory *ArtifactoryArtifact `json:"artifactory,omitempty"`

ArtifactLocation describes a location for a single or multiple artifacts. It is used as single artifact in the context of inputs/outputs (e.g. outputs.artifacts.artname). It is also used to describe the location of multiple artifacts such as the archive location of a single workflow step, which the executor will use as a default location to store its files.

type ArtifactoryArtifact

type ArtifactoryArtifact struct {
	ArtifactoryAuth `json:",inline,squash"`
	URL             string `json:"url"`

type ArtifactoryAuth

type ArtifactoryAuth struct {
	UsernameSecret *apiv1.SecretKeySelector `json:"usernameSecret,omitempty"`
	PasswordSecret *apiv1.SecretKeySelector `json:"passwordSecret,omitempty"`

type GitArtifact

type GitArtifact struct {
	Repo           string                   `json:"repo"`
	Revision       string                   `json:"revision,omitempty"`
	UsernameSecret *apiv1.SecretKeySelector `json:"usernameSecret,omitempty"`
	PasswordSecret *apiv1.SecretKeySelector `json:"passwordSecret,omitempty"`

type HTTPArtifact

type HTTPArtifact struct {
	URL string `json:"url"`

type Inputs

type Inputs struct {
	Parameters []Parameter `json:"parameters,omitempty"`
	Artifacts  []Artifact  `json:"artifacts,omitempty"`

Inputs are the mechanism for passing parameters, artifacts, volumes from one template to another

func (*Inputs) GetArtifactByName

func (in *Inputs) GetArtifactByName(name string) *Artifact

func (*Inputs) GetParameterByName

func (in *Inputs) GetParameterByName(name string) *Parameter

type Item

type Item interface{}

Item expands a single workflow step into multiple parallel steps

type NodePhase

type NodePhase string

NodePhase is a label for the condition of a node at the current time.

const (
	NodeRunning   NodePhase = "Running"
	NodeSucceeded NodePhase = "Succeeded"
	NodeSkipped   NodePhase = "Skipped"
	NodeFailed    NodePhase = "Failed"
	NodeError     NodePhase = "Error"

Workflow and node statuses

type NodeStatus

type NodeStatus struct {
	// ID is a unique identifier of a node within the worklow
	// It is implemented as a hash of the node name, which makes the ID deterministic
	ID string `json:"id"`

	// Name is a human readable representation of the node in the node tree
	// It can represent a container, step group, or the entire workflow
	Name string `json:"name"`

	// Phase a simple, high-level summary of where the node is in its lifecycle.
	// Can be used as a state machine.
	Phase NodePhase `json:"phase"`

	// A human readable message indicating details about why the node is in this condition.
	Message string `json:"message,omitempty"`

	// Time at which this node started
	StartedAt metav1.Time `json:"startedAt,omitempty"`

	// Time at which this node completed
	FinishedAt metav1.Time `json:"finishedAt,omitempty"`

	// PodIP captures the IP of the pod for daemoned steps
	PodIP string `json:"podIP,omitempty"`

	// Daemoned tracks whether or not this node was daemoned and need to be terminated
	Daemoned *bool `json:"daemoned,omitempty"`

	// Outputs captures output parameter values and artifact locations
	Outputs *Outputs `json:"outputs,omitempty"`

	// Children is a list of child node IDs
	Children []string `json:"children,omitempty"`

func (NodeStatus) Completed

func (n NodeStatus) Completed() bool

Completed returns whether or not the node has completed execution

func (NodeStatus) IsDaemoned

func (n NodeStatus) IsDaemoned() bool

IsDaemoned returns whether or not the node is deamoned

func (NodeStatus) String

func (n NodeStatus) String() string

func (NodeStatus) Successful

func (n NodeStatus) Successful() bool

Successful returns whether or not this node completed successfully

type Outputs

type Outputs struct {
	// Parameters holds the list of output parameters produced by a step
	Parameters []Parameter `json:"parameters,omitempty"`

	// Artifacts holds the list of output artifacts produced by a step
	Artifacts []Artifact `json:"artifacts,omitempty"`

	// Result holds the result (stdout) of a script template
	Result *string `json:"result,omitempty"`

func (*Outputs) HasOutputs

func (out *Outputs) HasOutputs() bool

type Parameter

type Parameter struct {
	Name    string  `json:"name"`
	Value   *string `json:"value,omitempty"`
	Default *string `json:"default,omitempty"`

	// Path describes the location in which to retrieve the output parameter value from
	Path string `json:"path,omitempty"`

Parameter indicate a passed string parameter to a service template with an optional default value

type ResourceTemplate

type ResourceTemplate struct {
	// Action is the action to perform to the resource.
	// Must be one of: create, apply, delete
	Action string `json:"action"`

	// Manifest contains the kubernetes manifest
	Manifest string `json:"manifest"`

	// SuccessCondition is a label selector expression which describes the conditions
	// of the k8s resource in which it is acceptable to proceed to the following step
	SuccessCondition string `json:"successCondition,omitempty"`

	// FailureCondition is a label selector expression which describes the conditions
	// of the k8s resource in which the step was considered failed
	FailureCondition string `json:"failureCondition,omitempty"`

ResourceTemplate is a template subtype to manipulate kubernetes resources

type S3Artifact

type S3Artifact struct {
	S3Bucket `json:",inline,squash"`
	Key      string `json:"key"`

type S3Bucket

type S3Bucket struct {
	Endpoint        string                  `json:"endpoint"`
	Bucket          string                  `json:"bucket"`
	Region          string                  `json:"region,omitempty"`
	Insecure        *bool                   `json:"insecure,omitempty"`
	AccessKeySecret apiv1.SecretKeySelector `json:"accessKeySecret"`
	SecretKeySecret apiv1.SecretKeySelector `json:"secretKeySecret"`

type Script

type Script struct {
	Image   string   `json:"image"`
	Command []string `json:"command"`
	Source  string   `json:"source"`

Script is a template subtype to enable scripting through code steps

type Sidecar

type Sidecar struct {
	apiv1.Container `json:",inline,squash"`

	SidecarOptions `json:",inline,squash"`

Sidecar is a container which runs alongside the main container

type SidecarOptions

type SidecarOptions struct {

	// MirrorVolumeMounts will mount the same volumes specified in the main container
	// to the sidecar (including artifacts), at the same mountPaths. This enables
	// dind daemon to partially see the same filesystem as the main container in
	// order to use features such as docker volume binding
	MirrorVolumeMounts *bool `json:"mirrorVolumeMounts,omitempty"`

SidecarOptions provide a way to customize the behavior of a sidecar and how it affects the main container.

type Template

type Template struct {
	Name    string  `json:"name"`
	Inputs  Inputs  `json:"inputs,omitempty"`
	Outputs Outputs `json:"outputs,omitempty"`

	// NodeSelector is a selector to schedule this step of the workflow to be
	// run on the selected node(s). Overrides the selector set at the workflow level.
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Deamon will allow a workflow to proceed to the next step so long as the container reaches readiness
	Daemon *bool `json:"daemon,omitempty"`

	// Workflow fields
	Steps [][]WorkflowStep `json:"steps,omitempty"`

	// Container
	Container *apiv1.Container `json:"container,omitempty"`

	// Script
	Script *Script `json:"script,omitempty"`

	// Sidecar containers
	Sidecars []Sidecar `json:"sidecars,omitempty"`

	Resource *ResourceTemplate `json:"resource,omitempty"`

	// Location in which all files related to the step will be stored (logs, artifacts, etc...).
	// Can be overridden by individual items in Outputs. If omitted, will use the default
	// artifact repository location configured in the controller, appended with the
	// <workflowname>/<nodename> in the key.
	ArchiveLocation *ArtifactLocation `json:"archiveLocation,omitempty"`

	// Optional duration in seconds relative to the StartTime that the pod may be active on a node
	// before the system actively tries to terminate the pod; value must be positive integer
	// This field is only applicable to container and script templates.
	ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`

func (*Template) DeepCopy

func (t *Template) DeepCopy() *Template

func (*Template) GetType

func (tmpl *Template) GetType() TemplateType

type TemplateType

type TemplateType string

TemplateType is the type of a template

const (
	TemplateTypeContainer TemplateType = "Container"
	TemplateTypeSteps     TemplateType = "Steps"
	TemplateTypeScript    TemplateType = "Script"
	TemplateTypeResource  TemplateType = "Resource"

Possible template types

type Workflow

type Workflow struct {
	metav1.TypeMeta   `json:",inline,squash"`
	metav1.ObjectMeta `json:"metadata"`
	Spec              WorkflowSpec   `json:"spec"`
	Status            WorkflowStatus `json:"status"`

Workflow is the definition of our CRD Workflow class

func (*Workflow) DeepCopyObject

func (wf *Workflow) DeepCopyObject() runtime.Object

func (*Workflow) GetTemplate

func (wf *Workflow) GetTemplate(name string) *Template

func (*Workflow) NodeID

func (wf *Workflow) NodeID(name string) string

NodeID creates a deterministic node ID based on a node name

type WorkflowList

type WorkflowList struct {
	metav1.TypeMeta `json:",inline,squash"`
	metav1.ListMeta `json:"metadata"`
	Items           []Workflow `json:"items"`

func (*WorkflowList) DeepCopyObject

func (wfl *WorkflowList) DeepCopyObject() runtime.Object

type WorkflowSpec

type WorkflowSpec struct {
	// Templates is a list of workflow templates used in a workflow
	Templates []Template `json:"templates"`

	// Entrypoint is a template reference to the starting point of the workflow
	Entrypoint string `json:"entrypoint"`

	// Arguments contain the parameters and artifacts sent to the workflow entrypoint
	// Parameters are referencable globally using the 'workflow' variable prefix.
	// e.g. {{workflow.parameters.myparam}}
	Arguments Arguments `json:"arguments,omitempty"`

	// ServiceAccountName is the name of the ServiceAccount to run all pods of the workflow as.
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Volumes is a list of volumes that can be mounted by containers in a workflow.
	Volumes []apiv1.Volume `json:"volumes,omitempty"`

	// VolumeClaimTemplates is a list of claims that containers are allowed to reference.
	// The Workflow controller will create the claims at the beginning of the workflow
	// and delete the claims upon completion of the workflow
	VolumeClaimTemplates []apiv1.PersistentVolumeClaim `json:"volumeClaimTemplates,omitempty"`

	// NodeSelector is a selector which will result in all pods of the workflow
	// to be scheduled on the selected node(s). This is able to be overridden by
	// a nodeSelector specified in the template.
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// OnExit is a template reference which is invoked at the end of the
	// workflow, irrespective of the success, failure, or error of the
	// primary workflow.
	OnExit string `json:"onExit,omitempty"`

WorkflowSpec is the specification of a Workflow.

type WorkflowStatus

type WorkflowStatus struct {
	// Phase a simple, high-level summary of where the workflow is in its lifecycle.
	Phase NodePhase `json:"phase"`

	// Time at which this workflow started
	StartedAt metav1.Time `json:"startedAt,omitempty"`

	// Time at which this workflow completed
	FinishedAt metav1.Time `json:"finishedAt,omitempty"`

	// A human readable message indicating details about why the workflow is in this condition.
	Message string `json:"message,omitempty"`

	// Nodes is a mapping between a node ID and the node's status.
	Nodes map[string]NodeStatus `json:"nodes"`

	// PersistentVolumeClaims tracks all PVCs that were created as part of the workflow.
	// The contents of this list are drained at the end of the workflow.
	PersistentVolumeClaims []apiv1.Volume `json:"persistentVolumeClaims,omitempty"`

type WorkflowStep

type WorkflowStep struct {
	Name      string    `json:"name,omitempty"`
	Template  string    `json:"template,omitempty"`
	Arguments Arguments `json:"arguments,omitempty"`
	WithItems []Item    `json:"withItems,omitempty"`
	WithParam string    `json:"withParam,omitempty"`
	When      string    `json:"when,omitempty"`

WorkflowStep is a template ref

func (*WorkflowStep) DeepCopy

func (s *WorkflowStep) DeepCopy() *WorkflowStep

Jump to

Keyboard shortcuts

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