Documentation ¶
Index ¶
Constants ¶
const (
DefaultJobWatcherTimeout = 30 * time.Minute
)
Variables ¶
var BuildKitImage = "932427637498.dkr.ecr.us-west-2.amazonaws.com/furan2-builder:v0.7.2-rootless"
var JobLabel = "created-by:furan2"
JobLabel is a label added to every build job to aid search/aggregation
var (
PodMaxLines = int64(1000)
)
Functions ¶
func FuranJobFunc ¶
func FuranJobFunc(info ImageInfo, build models.Build, bkresources [2]corev1.ResourceList) *batchv1.Job
FuranJobFunc is a JobFactoryFunc that generates a Kubernetes Job to execute a build
Types ¶
type FakeJob ¶
type FakeJobRunner ¶
type ImageInfo ¶
type ImageInfo struct {
Namespace, PodName, Image, ServiceAccount string
ImagePullSecrets []string
RootArgs []string // All args prior to the "server" command (secrets setup, etc)
Resources [2]corev1.ResourceList
EnvVars []corev1.EnvVar // any env vars that reference k8s secrets
}
ImageInfo models information about /this/ currently running Furan pod/container These are the values that are injected into build jobs
type JobFactoryFunc ¶
type JobFactoryFunc func(info ImageInfo, build models.Build, bkresources [2]corev1.ResourceList) *batchv1.Job
JobFactoryFunc is a function that generates a new image build Job given an ImageInfo and an optional set of buildkit resource requests and limits
type JobWatcher ¶
type JobWatcher struct {
JobName, JobNamespace string
// contains filtered or unexported fields
}
JobWatcher is an object that keeps track of a newly-created k8s Job and signals when it succeeds or fails
func (*JobWatcher) Error ¶
func (jw *JobWatcher) Error() chan error
func (*JobWatcher) Logs ¶
func (jw *JobWatcher) Logs() (map[string]map[string][]byte, error)
Logs fetches the logs for pods associated with this job and returns a map of pod name to a map of container name to the last PodMaxLines of log output for that container. Ex: logByteSlice := output["pod-name-xyz111"]["app-container"]
func (*JobWatcher) Running ¶
func (jw *JobWatcher) Running() chan struct{}
type K8sJobRunner ¶
type K8sJobRunner struct { JobFunc JobFactoryFunc LogFunc func(msg string, args ...interface{}) // contains filtered or unexported fields }
func NewInClusterRunner ¶
func NewInClusterRunner(dl datalayer.DataLayer) (*K8sJobRunner, error)
func (K8sJobRunner) StartCleanup ¶
func (kr K8sJobRunner) StartCleanup(ctx context.Context, interval, age time.Duration, label string) error
StartCleanup begins an asynchronous cleanup process every interval that deletes old build jobs older than now - age. Build jobs are identified in the current namespace by label, which is expected to be in the form "<key>:<value>". Cancel the context to signal the process to exit.