func NewJobUpdater(job *paddlev1.TrainingJob, kubeCli kubernetes.Interface, jobCli trainingJobClient.Interface,
	auto bool, restartLimit int, outter bool) *JobUpdater {
	eventBroadcaster := record.NewBroadcaster()
	eventBroadcaster.StartLogging(glog.Infof)
	eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: kubeCli.CoreV1().Events("")})
	recorder := eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: "TrainingJobController"})
	return &JobUpdater{
		Job:            job,
		kubeCli:        kubeCli,
		trainingJobCli: jobCli,
		status:         *job.Status.DeepCopy(),
		recorder:       recorder,
		autoclean:      auto,
		restartLimit:   restartLimit,
		outter:         outter,
	}
}
NewJobUpdater returns JobUpdater instance
package updater
import (
	"errors"
	"fmt"
	"reflect"
	"strconv"
	"strings"
	"time"
	"github.com/golang/glog"
	log "github.com/inconshreveable/log15"
	corev1 "k8s.io/api/core/v1"
	"k8s.io/api/extensions/v1beta1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	"k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/client-go/kubernetes"
	typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
	"k8s.io/client-go/tools/record"
	paddlev1 "github.com/baidu/paddle-on-k8s-operator/pkg/apis/paddlepaddle/v1alpha1"
	trainingJobClient "github.com/baidu/paddle-on-k8s-operator/pkg/client/clientset/versioned"
	"github.com/baidu/paddle-on-k8s-operator/pkg/client/clientset/versioned/scheme"
)
var (
	ErrorUnkownResourceType = errors.New("UnknownResourceType")
)
type JobUpdater struct {
	Job            *paddlev1.TrainingJob
	kubeCli        kubernetes.Interface
	trainingJobCli trainingJobClient.Interface
	status         paddlev1.TrainingJobStatus
	recorder       record.EventRecorder
	autoclean      bool
	Additional     int32
	restartLimit   int
	outter         bool
}