github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/pkg/kubernetes/resources/cronjob/adapt.go (about) 1 package cronjob 2 3 import ( 4 "github.com/caos/orbos/pkg/kubernetes" 5 "github.com/caos/orbos/pkg/kubernetes/resources" 6 "k8s.io/api/batch/v1beta1" 7 ) 8 9 func AdaptFuncToEnsure(job *v1beta1.CronJob) (resources.QueryFunc, error) { 10 return func(_ kubernetes.ClientInt, _ map[string]interface{}) (resources.EnsureFunc, error) { 11 return func(k8sClient kubernetes.ClientInt) error { 12 return k8sClient.ApplyCronJob(job) 13 }, nil 14 }, nil 15 } 16 17 func AdaptFuncToDestroy(namespace, name string) (resources.DestroyFunc, error) { 18 return func(client kubernetes.ClientInt) error { 19 return client.DeleteCronJob(namespace, name) 20 }, nil 21 }