oam-kubernetes-runtime icon indicating copy to clipboard operation
oam-kubernetes-runtime copied to clipboard

Support Cron Trait

Open wonderflow opened this issue 5 years ago • 3 comments

We used to discuss it in Rudr https://github.com/oam-dev/rudr/issues/40 I think this is really a common trait which can be core/standard trait candidate.

This is an issue from https://github.com/crossplane/addon-oam-kubernetes-local/issues/13.

We'll continue discuss here.

wonderflow avatar Apr 21 '20 04:04 wonderflow

Per https://github.com/crossplane/oam-kubernetes-runtime/issues/55 we're centralising all things OAM into one repo, and oam-kubernetes-runtime seems like the most likely place. I'm going to move this issue there.

negz avatar Jun 30 '20 03:06 negz

Internally we are discussing how to support Job, CronJob based on Workload and trait design, The current conclusion is that we prefer to use workload support to pull up a Job or CronJob rather than a trait

The Spec :

type TaskWorkloadSpec struct {
	// OperatingSystem required by this workload.
	// +kubebuilder:validation:Enum=linux;windows
	// +optional
	OperatingSystem *oamcorev1alpha2.OperatingSystem `json:"osType,omitempty"`

	// CPUArchitecture required by this workload.
	// +kubebuilder:validation:Enum=i386;amd64;arm;arm64
	// +optional
	CPUArchitecture *oamcorev1alpha2.CPUArchitecture `json:"arch,omitempty"`

	// Specifies the maximum desired number of pods the job should
	// run at any given time. The actual number of pods running in steady state will
	// be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism),
	// i.e. when the work left to do is less than max parallelism.
	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
	// +optional
	Parallelism *int32 `json:"parallelism,omitempty"`

	// Specifies the desired number of successfully finished pods the
	// job should be run with.  Setting to nil means that the success of any
	// pod signals the success of all pods, and allows parallelism to have any positive
	// value.  Setting to 1 means that parallelism is limited to 1 and the success of that
	// pod signals the success of the job.
	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
	// +optional
	Completions *int32 `json:"completions,omitempty"`

	// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
	// +kubebuilder:validation:MinLength=0
	// +optional
	Schedule string `json:"schedule,omitempty"`

	// Containers of which this workload consists.
	Containers []oamcorev1alpha2.Container `json:"containers"`

        // initContainers
	// +optional
	InitContainers []oamcorev1alpha2.Container `json:"initContainers,omitempty"`

	// dns policy
	// +optional
	DNSPolicy corev1.DNSPolicy `json:"dnsPolicy,omitempty"`

	// node selector
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

cc @wonderflow

allenhaozi avatar Jul 03 '20 14:07 allenhaozi

Cool, would you like to contribute these workload into our catalog?

wonderflow avatar Jul 04 '20 08:07 wonderflow