Documentation ¶
Index ¶
- func ContainerName(index int) string
- func GetExecutionContext(wfr *v1alpha1.WorkflowRun) *v1alpha1.ExecutionContext
- func GetResourceVolumeName(resourceName string) string
- func InputContainerName(index int) string
- func Name(wf, stg string) string
- func OutputContainerName(index int) string
- func ResolveRefStringValue(ref string, client clientset.Interface) (string, error)
- type Builder
- func (m *Builder) AddCoordinator() error
- func (m *Builder) AddVolumeMounts() error
- func (m *Builder) ApplyResourceRequirements() error
- func (m *Builder) ApplyServiceAccount() error
- func (m *Builder) ArtifactFileName(stageName, artifactName string) (string, error)
- func (m *Builder) Build() (*corev1.Pod, error)
- func (m *Builder) CreateEmptyDirVolume(volumeName string)
- func (m *Builder) CreatePVCVolume(volumeName, pvc string) string
- func (m *Builder) CreateVolumes() error
- func (m *Builder) EnsureContainerNames() error
- func (m *Builder) InjectEnvs() error
- func (m *Builder) MountPresetVolumes() error
- func (m *Builder) Prepare() error
- func (m *Builder) ResolveArguments() error
- func (m *Builder) ResolveInputArtifacts() error
- func (m *Builder) ResolveInputResources() error
- func (m *Builder) ResolveOutputResources() error
- type SecretRefValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainerName ¶
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 ¶
GetResourceVolumeName generates a volume name for a resource.
func InputContainerName ¶
InputContainerName generates a container name for input resolver container
func OutputContainerName ¶
OutputContainerName generates a container name for output resolver container
func ResolveRefStringValue ¶
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 ¶
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 ¶
AddVolumeMounts add common PVC to workload containers
func (*Builder) ApplyResourceRequirements ¶
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 ¶
ApplyServiceAccount applies service account to pod
func (*Builder) ArtifactFileName ¶
ArtifactFileName gets artifact file name from artifacts path.
func (*Builder) CreateEmptyDirVolume ¶
CreateEmptyDirVolume creates a EmptyDir volume for the pod with the given name
func (*Builder) CreatePVCVolume ¶
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) EnsureContainerNames ¶
EnsureContainerNames ensures all containers have names.
func (*Builder) InjectEnvs ¶
InjectEnvs injects environment variables to containers, such as WorkflowRun name stage name, namespace.
func (*Builder) MountPresetVolumes ¶
MountPresetVolumes add preset volumes defined in WorkflowRun.
func (*Builder) ResolveInputArtifacts ¶
ResolveInputArtifacts mount each input artifact from PVC.
func (*Builder) ResolveInputResources ¶
ResolveInputResources creates init containers for each input resource and also mount resource to workload containers.
func (*Builder) ResolveOutputResources ¶
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