func (j *Job) Run(ignoreSidecar bool) error {
	if ignoreSidecar {
		log.Info("Ignore sidecar containers")
	}
	running, err := j.RunJob()
	if err != nil {
		return err
	}
	log.Infof("Starting job: %s", running.Name)
	ctx, cancel := context.WithCancel(context.Background())
	if j.Timeout != 0 {
		ctx, cancel = context.WithTimeout(context.Background(), j.Timeout)
	}
	defer cancel()
	watcher := NewWatcher(j.client, j.Container)
	go func() {
		err := watcher.Watch(running, ctx)
		if err != nil {
			log.Error(err)
		}
	}()
	err = j.WaitJob(ctx, running, ignoreSidecar)
	time.Sleep(10 * time.Second)
	return err
}
Run a command on kubernetes cluster, and watch the log.
package job
import (
	"context"
	"time"
	log "github.com/sirupsen/logrus"
)
type CleanupType int
const (
	All CleanupType = iota
	Succeeded
	Failed
)
func (c CleanupType) String() string {
	return [...]string{"all", "succeeded", "failed"}[c]
}