Operator for CronJob resources
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.6 KiB

  1. package v1alpha1
  2. import (
  3. batchv1beta1 "k8s.io/api/batch/v1beta1"
  4. corev1 "k8s.io/api/core/v1"
  5. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  6. )
  7. // CronOpSpec defines the desired state of CronOp
  8. // +k8s:openapi-gen=true
  9. type CronTask struct {
  10. Name string `json:"name"`
  11. Schedule string `json:"schedule,omitempty"` // default "0 * * * *", hourly
  12. Commands []string `json:"commands"`
  13. RestartPolicy *corev1.RestartPolicy `json:"restartPolicy,omitempty"` // default OnFailure
  14. ConcurrencyPolicy *batchv1beta1.ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"` // default Allow
  15. }
  16. type CronOpSpec struct {
  17. Image string `json:"image,omitempty"` // default busybox
  18. Tasks []CronTask `json:"tasks,omitempty"` // default empty
  19. }
  20. // CronOpStatus defines the observed state of CronOp
  21. // +k8s:openapi-gen=true
  22. type CronOpStatus struct {
  23. }
  24. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  25. // CronOp is the Schema for the cronops API
  26. // +k8s:openapi-gen=true
  27. // +kubebuilder:subresource:status
  28. type CronOp struct {
  29. metav1.TypeMeta `json:",inline"`
  30. metav1.ObjectMeta `json:"metadata,omitempty"`
  31. Spec CronOpSpec `json:"spec,omitempty"`
  32. Status CronOpStatus `json:"status,omitempty"`
  33. }
  34. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  35. // CronOpList contains a list of CronOp
  36. type CronOpList struct {
  37. metav1.TypeMeta `json:",inline"`
  38. metav1.ListMeta `json:"metadata,omitempty"`
  39. Items []CronOp `json:"items"`
  40. }
  41. func init() {
  42. SchemeBuilder.Register(&CronOp{}, &CronOpList{})
  43. }