pod

package
Version: v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainerName

func ContainerName(index int) string

ContainerName generate container names for pod.

func GetExecutionContext

func GetExecutionContext(wfr *v1alpha1.WorkflowRun) *v1alpha1.ExecutionContext

GetExecutionContext gets execution context from WorkflowRun, if not found, use the default context in workflow controller configuration.

func GetResourceVolumeName

func GetResourceVolumeName(resourceName string) string

GetResourceVolumeName generates a volume name for a resource.

func InputContainerName

func InputContainerName(index int) string

InputContainerName generates a container name for input resolver container

func MatchContainerGroup added in v0.9.6

func MatchContainerGroup(group v1alpha1.ContainerGroup, container string) bool

MatchContainerGroup matches a container name against a ContainerGroup, if the container belongs to the container group, return true, otherwise false. It only tests containers, init containers are not considered here. If input container group is empty or invalid, return true.

func Name

func Name(wf, stg string) string

Name generates a pod name from Workflow name and Stage name

func OutputContainerName

func OutputContainerName(index int) string

OutputContainerName generates a container name for output resolver container

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder is builder used to build pod for stage

func NewBuilder

func NewBuilder(client k8s.Interface, wf *v1alpha1.Workflow, wfr *v1alpha1.WorkflowRun, stg *v1alpha1.Stage) *Builder

NewBuilder creates a new pod builder.

func (*Builder) AddCoordinator

func (m *Builder) AddCoordinator() error

AddCoordinator adds coordinator container as sidecar to pod. Coordinator is used to collect logs, artifacts and notify resource resolvers to push resources.

func (*Builder) AddVolumeMounts

func (m *Builder) AddVolumeMounts() error

AddVolumeMounts add common PVC to workload containers

func (*Builder) ApplyResourceRequirements

func (m *Builder) ApplyResourceRequirements() error

ApplyResourceRequirements applies resource requirements containers in the pod. Resource requirements can be specified in three places (ordered by priority descending order): - In the Stage spec - In the Workflow spec - In the Workflow Controller configurations as default values. So requirements set in stage spec would have the highest priority.

func (*Builder) ApplyServiceAccount

func (m *Builder) ApplyServiceAccount() error

ApplyServiceAccount applies service account to pod

func (*Builder) ArtifactFileName

func (m *Builder) ArtifactFileName(stageName, artifactName string) (string, error)

ArtifactFileName gets artifact file name from artifacts path.

func (*Builder) Build

func (m *Builder) Build() (*corev1.Pod, error)

Build ...

func (*Builder) CreateEmptyDirVolume

func (m *Builder) CreateEmptyDirVolume(volumeName string)

CreateEmptyDirVolume creates a EmptyDir volume for the pod with the given name

func (*Builder) CreatePVCVolume

func (m *Builder) CreatePVCVolume(volumeName, pvc string) string

CreatePVCVolume tries to create a PVC volume for the given volume name and PVC name. If no volume available for the PVC, a new volume would be created and the volume name will be returned. If a volume of the given PVC already exists, return name of the volume, note that in this case, the returned volume name is usually different to the provided 'volumeName' argument.

func (*Builder) CreateVolumes

func (m *Builder) CreateVolumes() error

CreateVolumes ...

func (*Builder) EnsureContainerNames

func (m *Builder) EnsureContainerNames() error

EnsureContainerNames ensures all containers have name set.

func (*Builder) InjectEnvs

func (m *Builder) InjectEnvs() error

InjectEnvs injects environment variables to containers, such as WorkflowRun name stage name, namespace.

func (*Builder) MountPresetVolumes

func (m *Builder) MountPresetVolumes() error

MountPresetVolumes add preset volumes defined in WorkflowRun.

func (*Builder) Prepare

func (m *Builder) Prepare() error

Prepare ...

func (*Builder) ResolveArguments

func (m *Builder) ResolveArguments() error

ResolveArguments ...

func (*Builder) ResolveInputArtifacts

func (m *Builder) ResolveInputArtifacts() error

ResolveInputArtifacts mount each input artifact from PVC.

func (*Builder) ResolveInputResources

func (m *Builder) ResolveInputResources() error

ResolveInputResources creates init containers for each input resource and also mount resource to workload containers.

func (*Builder) ResolveOutputResources

func (m *Builder) ResolveOutputResources() error

ResolveOutputResources add resource resolvers to pod spec.

Source Files

Jump to

Keyboard shortcuts

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