func (j newJob) Create() error {
	if err := checkExistence(j); err != nil {
		log.Println("Creating", j.Key())
		j.Job, err = j.Client.Create(j.Job)
		return err
	}
	return nil
}
Create looks for the Job in k8s and creates it if not present
package resources
import (
	"log"
	"github.com/Mirantis/k8s-AppController/pkg/client"
	"github.com/Mirantis/k8s-AppController/pkg/interfaces"
	"github.com/Mirantis/k8s-AppController/pkg/report"
	batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1"
	"k8s.io/client-go/pkg/apis/batch/v1"
)
var jobParamFields = []string{
	"Spec.Template.Spec.Containers.Env",
	"Spec.Template.Spec.Containers.Name",
	"Spec.Template.Spec.InitContainers.Env",
	"Spec.Template.Spec.InitContainers.Name",
	"Spec.Template.ObjectMeta",
}
type newJob struct {
	Base
	Job    *v1.Job
	Client batchv1.JobInterface
}
func jobKey(name string) string {
	return "job/" + name
}
type jobTemplateFactory struct{}
func (jobTemplateFactory) ShortName(definition client.ResourceDefinition) string {
	if definition.Job == nil {
		return ""
	}
	return definition.Job.Name
}
func (jobTemplateFactory) Kind() string {
	return "job"
}
func (jobTemplateFactory) New(def client.ResourceDefinition, c client.Interface, gc interfaces.GraphContext) interfaces.Resource {
	job := parametrizeResource(def.Job, gc, jobParamFields).(*v1.Job)
	return createNewJob(job, c.Jobs(), def.Meta)
}
func (jobTemplateFactory) NewExisting(name string, c client.Interface, gc interfaces.GraphContext) interfaces.Resource {
	return report.SimpleReporter{BaseResource: existingJob{Name: name, Client: c.Jobs()}}
}
func jobStatus(j batchv1.JobInterface, name string) (interfaces.ResourceStatus, error) {
	job, err := j.Get(name)
	if err != nil {
		return interfaces.ResourceError, err
	}
	for _, cond := range job.Status.Conditions {
		if cond.Type == "Complete" && cond.Status == "True" {
			return interfaces.ResourceReady, nil
		}
	}
	return interfaces.ResourceNotReady, nil
}
func (j newJob) Key() string {
	return jobKey(j.Job.Name)
}
func (j newJob) Status(meta map[string]string) (interfaces.ResourceStatus, error) {
	return jobStatus(j.Client, j.Job.Name)
}