Documentation
¶
Index ¶
- Constants
- Variables
- func New(logger *zap.Logger, client kubernetes.Interface, cfg Config) *worker
- func NewJobWatcher(logger *zap.Logger, k8sClient kubernetes.Interface, cfg *config.Config) *jobWatcher
- func NewPodCompletionWatcher(logger *zap.Logger, k8s kubernetes.Interface) *completionsWatcher
- func NewPodWatcher(logger *zap.Logger, k8s kubernetes.Interface, cfg *config.Config) *podWatcher
- func PatchPodSpec(original *corev1.PodSpec, patch *corev1.PodSpec, ...) (*corev1.PodSpec, error)
- type Config
- type KubernetesPlugin
Constants ¶
View Source
const ( AgentContainerName = "agent" CopyAgentContainerName = "copy-agent" ImageCheckContainerNamePrefix = "imagecheck-" CheckoutContainerName = "checkout" )
Variables ¶
View Source
var ErrNoCommandModification = errors.New("modifying container commands or args via podSpecPatch is not supported")
Functions ¶
func NewJobWatcher ¶
func NewJobWatcher(logger *zap.Logger, k8sClient kubernetes.Interface, cfg *config.Config) *jobWatcher
NewJobWatcher creates a JobWatcher.
func NewPodCompletionWatcher ¶
func NewPodCompletionWatcher(logger *zap.Logger, k8s kubernetes.Interface) *completionsWatcher
func NewPodWatcher ¶
NewPodWatcher creates an informer that does various things with pods and Buildkite jobs:
- If an init container fails, the BK Agent REST API will be used to fail the job (since an agent hasn't run yet).
- If a container stays in ImagePullBackOff or ErrImageNeverPull state for too long, the BK Agent REST API will be used to fail the job and the pod will be evicted.
- If a container stays in ImagePullBackOff or ErrImageNeverPull, and the pod somehow got through all the init containers (including the image checks...) the BK GraphQL API will be used to cancel the job instead.
- If a pod is pending, every so often Buildkite will be checked to see if the corresponding job has been cancelled so that the pod can be evicted early.
func PatchPodSpec ¶
func PatchPodSpec(original *corev1.PodSpec, patch *corev1.PodSpec, cmdParams *config.CommandParams, k8sPlugin *KubernetesPlugin) (*corev1.PodSpec, error)
Types ¶
type Config ¶
type Config struct { Namespace string Image string AgentTokenSecretName string JobTTL time.Duration AdditionalRedactedVars []string WorkspaceVolume *corev1.Volume AgentConfig *config.AgentConfig DefaultCheckoutParams *config.CheckoutParams DefaultCommandParams *config.CommandParams DefaultSidecarParams *config.SidecarParams DefaultMetadata config.Metadata DefaultImagePullPolicy corev1.PullPolicy DefaultImageCheckPullPolicy corev1.PullPolicy PodSpecPatch *corev1.PodSpec ProhibitK8sPlugin bool }
type KubernetesPlugin ¶
type KubernetesPlugin struct { PodSpec *corev1.PodSpec `json:"podSpec,omitempty"` PodSpecPatch *corev1.PodSpec `json:"podSpecPatch,omitempty"` GitEnvFrom []corev1.EnvFromSource `json:"gitEnvFrom,omitempty"` Sidecars []corev1.Container `json:"sidecars,omitempty"` Metadata config.Metadata `json:"metadata,omitempty"` ExtraVolumeMounts []corev1.VolumeMount `json:"extraVolumeMounts,omitempty"` CheckoutParams *config.CheckoutParams `json:"checkout,omitempty"` CommandParams *config.CommandParams `json:"commandParams,omitempty"` SidecarParams *config.SidecarParams `json:"sidecarParams,omitempty"` }
Click to show internal directories.
Click to hide internal directories.