Skip to content
types.go 2.31 KiB
Newer Older
Timothee Gosselin's avatar
WIP
Timothee Gosselin committed
package cronjob

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

// GenConfigMapFunc defines a function which generates ConfigMap.
type GenCronJobFunc func(Conf) (*batchv1beta1.CronJob, error)
type GenSuccessfulJobsHistoryLimitFunc func() (*int32, error)
type GenFailedJobsHistoryLimitHistoryLimitFunc func() (*int32, error)
type GenConcurrencyPolicyFunc func() (batchv1beta1.ConcurrencyPolicy, error)
type GenSuspendPolicyFunc func() (bool, error)
type GenStartingDeadlineSecondsSecondsFunc func() (*int64, error)
type GenScheduleFunc func() (string, error)

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

type Mutate interface {
	job.Mutate
	GenSuccessfulJobsHistoryLimit() (*int32, error)
	GenFailedJobsHistoryLimitHistoryLimit() (*int32, error)
	GenConcurrencyPolicy() (batchv1beta1.ConcurrencyPolicy, error)
	GenSuspendPolicy() (bool, error)
	GenStartingDeadlineSecondsSeconds() (*int64, error)
	GenSchedule() (string, error)
}

Timothee Gosselin's avatar
WIP
Timothee Gosselin committed
type Conf struct {
	Namespace                    string
	Name                         string
	Obj                          interfaces.Object
	Reconcile                    interfaces.Reconcile
	previousObject               runtime.Object
	Owner                        interfaces.Object
	OwnerReference               bool
	GenFinalizers                meta.GenFinalizers
	GenLabels                    meta.GenLabels
	GenAnnotations               meta.GenAnnotations
	ManualSelector               bool
	GenParallelismFunc           job.GenParallelismFunc
	GenCompletionsFunc           job.GenCompletionsFunc
	GenActiveDeadlineSecondsFunc job.GenActiveDeadlineSecondsFunc
	GenBackoffLimitFunc          job.GenBackoffLimitFunc
	//	GenSelectorFunc
	GenSuccessfulJobsHistoryLimitFunc
	GenFailedJobsHistoryLimitHistoryLimitFunc
	GenConcurrencyPolicyFunc
	GenSuspendPolicyFunc
	GenStartingDeadlineSecondsSecondsFunc
	GenScheduleFunc
	GenVolumesFunc         pod.GenVolumesFunc
	GenSecurityContextFunc pod.GenSecurityContextFunc
	GenRestartPolicyFunc   pod.GenRestartPolicyFunc
	GenContainers          []container.Mutate
}