pod

package
v0.9.5-alpha Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: Apache-2.0 Imports: 21 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 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

func ResolveRefStringValue

func ResolveRefStringValue(ref string, client clientset.Interface) (string, error)

ResolveRefStringValue resolves the given secret ref value, if it's not a ref value, return the origin value. Ref value is in format of '$.<ns>.<secret>/<jsonpath>/...' to refer value in a secret.

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 clientset.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 names.

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.

type SecretRefValue

type SecretRefValue struct {
	// Namespace of the secret
	Namespace string
	// Name of the secret
	Secret string
	// Json path in the secret to refer the value. If more than one
	// paths provided, value resolved for the previous path would be
	// regarded as a marshaled json and be used as data source to the
	// following one.
	Jsonpaths []string
}

SecretRefValue represents a value in a secret. It's defined by a secret and json paths.

func NewSecretRefValue

func NewSecretRefValue() *SecretRefValue

NewSecretRefValue create a secret reference value.

func (*SecretRefValue) Parse

func (r *SecretRefValue) Parse(ref string) error

Parse parses a given ref. The reference value specifies json path in a secret. Format of the reference is: $.<namespace>.<secret-name>/<jsonpath>/<jsonpath> For example, in secret (named 'secret' under namespace 'ns'):

{
 "apiVersion": "v1",
  "data": {
   "key": "KEY",
   "json": "{\"user\":{\"id\": \"111\"}}"
  },
  "kind": "Secret",
  "type": "Opaque",
  "metadata": {
      ...
  }
}

$.ns.secret/data.key --> KEY $.ns.secret/data.json/user.id --> 111

func (*SecretRefValue) Resolve

func (r *SecretRefValue) Resolve(client clientset.Interface) (interface{}, error)

Resolve resolves the secret ref and get the real value.

Jump to

Keyboard shortcuts

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