Skip to content
types.go 1.49 KiB
Newer Older
Timothee Gosselin's avatar
Timothee Gosselin committed
package job

import (
	"github.com/ankitrgadiya/operatorlib/pkg/container"
	"github.com/ankitrgadiya/operatorlib/pkg/interfaces"
	"github.com/ankitrgadiya/operatorlib/pkg/meta"
	pod "github.com/ankitrgadiya/operatorlib/pkg/pod"
	batchv1 "k8s.io/api/batch/v1"
	"k8s.io/apimachinery/pkg/runtime"
)

// GenConfigMapFunc defines a function which generates ConfigMap.
type GenJobFunc func(Conf) (*batchv1.Job, error)
type GenParallelismFunc func(interfaces.Object) (*int32, error)
type GenCompletionsFunc func(interfaces.Object) (*int32, error)
type GenActiveDeadlineSecondsFunc func(interfaces.Object) (*int64, error)
type GenBackoffLimitFunc func(interfaces.Object) (*int32, error)

// type GenSelectorFunc func(interfaces.Object) (*metav1.LabelSelector, error)

// Conf is used to pass parameters to functions in this package to
// perform operations on Configmap objects.
type Conf struct {
	Namespace      string
	Name           string
	Obj            *batchv1.Job
	Reconcile      interfaces.Reconcile
	previousObject runtime.Object
	Owner          interfaces.Object
	OwnerReference bool
	GenFinalizers  meta.GenFinalizers
	GenLabels      meta.GenLabels
	GenAnnotations meta.GenAnnotations
	ManualSelector bool
	GenJobFunc
	GenParallelismFunc
	GenCompletionsFunc
	GenActiveDeadlineSecondsFunc
	GenBackoffLimitFunc
	//	GenSelectorFunc
	GenContainers          []container.Mutate
	GenVolumesFunc         pod.GenVolumesFunc
	GenSecurityContextFunc pod.GenSecurityContextFunc
	GenRestartPolicyFunc   pod.GenRestartPolicyFunc
}