Skip to content

Commit

Permalink
MLCronJob status update
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo committed Dec 6, 2023
1 parent 749c04b commit 51ab3ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions chart/kube-arangodb/templates/ml-operator/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ rules:
- "secrets"
- "serviceaccounts"
verbs: ["*"]
- apiGroups: ["batch"]
resources:
- "cronjobs"
verbs: ["*"]
{{- end }}
{{- end }}
12 changes: 11 additions & 1 deletion pkg/apis/ml/v1alpha1/cronjob_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
batchApi "k8s.io/api/batch/v1"

"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)

type ArangoMLCronJobSpec struct {
Expand All @@ -33,5 +34,14 @@ type ArangoMLCronJobSpec struct {
}

func (a *ArangoMLCronJobSpec) Validate() error {
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
if a == nil {
return errors.Newf("Spec is not defined")
}

var err []error
if a.CronJobSpec == nil {
err = append(err, shared.PrefixResourceErrors("spec", errors.Newf("CronJobSpec is not defined")))
}

return shared.WithErrors(err...)
}

0 comments on commit 51ab3ba

Please sign in to comment.