Documentation ¶
Overview ¶
Package pod provides methods for converting between a TaskRun and a Pod.
Index ¶
- Constants
- Variables
- func DidTaskRunFail(pod *corev1.Pod) bool
- func IsContainerStep(name string) bool
- func IsPodExceedingNodeResources(pod *corev1.Pod) bool
- func IsSidecarStatusRunning(tr *v1beta1.TaskRun) bool
- func MakeTaskRunStatus(logger *zap.SugaredLogger, tr v1beta1.TaskRun, pod *corev1.Pod) (v1beta1.TaskRunStatus, error)
- func SidecarsReady(podStatus corev1.PodStatus) bool
- func StepName(name string, i int) string
- func StopSidecars(ctx context.Context, nopImage string, kubeclient kubernetes.Interface, ...) (*corev1.Pod, error)
- func TrimSidecarPrefix(name string) string
- func UpdateReady(ctx context.Context, kubeclient kubernetes.Interface, pod corev1.Pod) error
- type Builder
- type EntrypointCache
- type Transformer
Constants ¶
const ( // TektonHermeticEnvVar is the env var we set in containers to indicate they should be run hermetically TektonHermeticEnvVar = "TEKTON_HERMETIC" // ExecutionModeAnnotation is an experimental optional annotation to set the execution mode on a TaskRun ExecutionModeAnnotation = "experimental.tekton.dev/execution-mode" // ExecutionModeHermetic indicates hermetic execution mode ExecutionModeHermetic = "hermetic" )
const ( // ReasonCouldntGetTask indicates that the reason for the failure status is that the // Task couldn't be found ReasonCouldntGetTask = "CouldntGetTask" // ReasonFailedResolution indicated that the reason for failure status is // that references within the TaskRun could not be resolved ReasonFailedResolution = "TaskRunResolutionFailed" // ReasonFailedValidation indicated that the reason for failure status is // that taskrun failed runtime validation ReasonFailedValidation = "TaskRunValidationFailed" // ReasonExceededResourceQuota indicates that the TaskRun failed to create a pod due to // a ResourceQuota in the namespace ReasonExceededResourceQuota = "ExceededResourceQuota" // ReasonExceededNodeResources indicates that the TaskRun's pod has failed to start due // to resource constraints on the node ReasonExceededNodeResources = "ExceededNodeResources" // ReasonCreateContainerConfigError indicates that the TaskRun failed to create a pod due to // config error of container ReasonCreateContainerConfigError = "CreateContainerConfigError" // ReasonPodCreationFailed indicates that the reason for the current condition // is that the creation of the pod backing the TaskRun failed ReasonPodCreationFailed = "PodCreationFailed" // ReasonPending indicates that the pod is in corev1.Pending, and the reason is not // ReasonExceededNodeResources or isPodHitConfigError ReasonPending = "Pending" )
Variables ¶
var ( ReleaseAnnotation = "pipeline.tekton.dev/release" // MaxActiveDeadlineSeconds is a maximum permitted value to be used for a task with no timeout MaxActiveDeadlineSeconds = int64(math.MaxInt32) )
These are effectively const, but Go doesn't have such an annotation.
Functions ¶
func DidTaskRunFail ¶ added in v0.11.0
DidTaskRunFail check the status of pod to decide if related taskrun is failed
func IsContainerStep ¶ added in v0.11.0
IsContainerStep returns true if the container name indicates that it represents a step.
func IsPodExceedingNodeResources ¶
IsPodExceedingNodeResources returns true if the Pod's status indicates there are insufficient resources to schedule the Pod.
func IsSidecarStatusRunning ¶ added in v0.11.0
IsSidecarStatusRunning determines if any SidecarStatus on a TaskRun is still running.
func MakeTaskRunStatus ¶
func MakeTaskRunStatus(logger *zap.SugaredLogger, tr v1beta1.TaskRun, pod *corev1.Pod) (v1beta1.TaskRunStatus, error)
MakeTaskRunStatus returns a TaskRunStatus based on the Pod's status.
func SidecarsReady ¶
SidecarsReady returns true if all of the Pod's sidecars are Ready or Terminated.
func StepName ¶ added in v0.27.0
StepName returns the step name after adding "step-" prefix to the actual step name or returns "step-unnamed-<step-index>" if not specified
func StopSidecars ¶
func StopSidecars(ctx context.Context, nopImage string, kubeclient kubernetes.Interface, namespace, name string) (*corev1.Pod, error)
StopSidecars updates sidecar containers in the Pod to a nop image, which exits successfully immediately.
func TrimSidecarPrefix ¶ added in v0.11.0
TrimSidecarPrefix returns the container name, stripped of its sidecar prefix.
func UpdateReady ¶
UpdateReady updates the Pod's annotations to signal the first step to start by projecting the ready annotation via the Downward API.
Types ¶
type Builder ¶ added in v0.15.0
type Builder struct { Images pipeline.Images KubeClient kubernetes.Interface EntrypointCache EntrypointCache }
Builder exposes options to configure Pod construction from TaskSpecs/Runs.
func (*Builder) Build ¶ added in v0.15.0
func (b *Builder) Build(ctx context.Context, taskRun *v1beta1.TaskRun, taskSpec v1beta1.TaskSpec, transformers ...Transformer) (*corev1.Pod, error)
Build creates a Pod using the configuration options set on b and the TaskRun and TaskSpec provided in its arguments. An error is returned if there are any problems during the conversion.
type EntrypointCache ¶
type EntrypointCache interface {
// contains filtered or unexported methods
}
EntrypointCache looks up an image's entrypoint (command) in a container image registry, possibly using the given service account's credentials.
func NewEntrypointCache ¶
func NewEntrypointCache(kubeclient kubernetes.Interface) (EntrypointCache, error)
NewEntrypointCache returns a new entrypoint cache implementation that uses K8s credentials to pull image metadata from a container image registry.