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 IsPodHitConfigError(pod *corev1.Pod) bool
- func IsSidecarStatusRunning(tr *v1alpha1.TaskRun) bool
- func MakeLabels(s *v1alpha1.TaskRun) map[string]string
- func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, ...) (*corev1.Pod, error)
- func MakeTaskRunStatus(tr v1alpha1.TaskRun, pod *corev1.Pod, taskSpec v1alpha1.TaskSpec) v1alpha1.TaskRunStatus
- func SidecarsReady(podStatus corev1.PodStatus) bool
- func StopSidecars(nopImage string, kubeclient kubernetes.Interface, pod corev1.Pod) error
- func TrimSidecarPrefix(name string) string
- func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error
- type EntrypointCache
Constants ¶
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" // ReasonRunning indicates that the reason for the inprogress status is that the TaskRun // is just starting to be reconciled ReasonRunning = "Running" // ReasonTimedOut indicates that the TaskRun has taken longer than its configured timeout ReasonTimedOut = "TaskRunTimeout" // 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" // ReasonSucceeded indicates that the reason for the finished status is that all of the steps // completed successfully ReasonSucceeded = "Succeeded" // ReasonFailed indicates that the reason for the failure status is unknown or that one of the steps failed ReasonFailed = "Failed" )
const (
// ResultsDir is the folder used by default to create the results file
ResultsDir = "/tekton/results"
)
Variables ¶
var ( ReleaseAnnotation = "pipeline.tekton.dev/release" ReleaseAnnotationValue = version.PipelineVersion )
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 IsPodHitConfigError ¶ added in v0.10.0
IsPodHitConfigError returns true if the Pod's status undicates there are config error raised
func IsSidecarStatusRunning ¶ added in v0.11.0
IsSidecarStatusRunning determines if any SidecarStatus on a TaskRun is still running.
func MakeLabels ¶ added in v0.11.0
MakeLabels constructs the labels we will propagate from TaskRuns to Pods.
func MakePod ¶
func MakePod(images pipeline.Images, taskRun *v1alpha1.TaskRun, taskSpec v1alpha1.TaskSpec, kubeclient kubernetes.Interface, entrypointCache EntrypointCache) (*corev1.Pod, error)
MakePod converts TaskRun and TaskSpec objects to a Pod which implements the taskrun specified by the supplied CRD.
func MakeTaskRunStatus ¶
func MakeTaskRunStatus(tr v1alpha1.TaskRun, pod *corev1.Pod, taskSpec v1alpha1.TaskSpec) v1alpha1.TaskRunStatus
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 StopSidecars ¶
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 ¶
func UpdateReady(kubeclient kubernetes.Interface, pod corev1.Pod) error
UpdateReady updates the Pod's annotations to signal the first step to start by projecting the ready annotation via the Downward API.
Types ¶
type EntrypointCache ¶
type EntrypointCache interface { // Get the Image data for the given image reference. If the value is // not found in the cache, it will be fetched from the image registry, // possibly using K8s service account imagePullSecrets. Get(ref name.Reference, namespace, serviceAccountName string) (v1.Image, error) // Update the cache with a new digest->Image mapping. This will avoid a // remote registry lookup next time Get is called. Set(digest name.Digest, img v1.Image) }
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.