Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchJob status update #1532

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
- (Improvement) (ML) Job Sidecar Shutdown
- (Feature) (ML) Handler for Extension StatefulSet and Service
- (Feature) (ML) Pod & Container Config
- (Improvement) (ML) BatchJob status update

## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks
Expand Down
42 changes: 41 additions & 1 deletion docs/api/ArangoMLBatchJob.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,51 @@

## Spec

### .spec

Type: `batch.Job` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_spec.go#L33)</sup>

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1#JobSpec)

## Status

### .status

Type: `batch.JobStatus` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_status.go#L37)</sup>

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1#JobStatus)

***

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_status.go#L28)</sup>
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_status.go#L33)</sup>

Conditions specific to the entire batch job

***

### .status.ref.name

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>

Name of the object

***

### .status.ref.namespace

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>

Namespace of the object. Should default to the namespace of the parent object

***

### .status.ref.uid

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>

UID keeps the information about object UID

8 changes: 4 additions & 4 deletions docs/api/ArangoMLCronJob.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
Type: `batch.CronJobSpec` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_spec.go#L33)</sup>

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1beta1#CronJobSpec)
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1#CronJobSpec)

## Status

### .status

Type: `batch.CronJobStatus` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L38)</sup>
Type: `batch.CronJobStatus` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L37)</sup>

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1beta1#CronJobStatus)
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1#CronJobStatus)

***

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L34)</sup>
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L33)</sup>

Conditions specific to the entire cron job

Expand Down
21 changes: 19 additions & 2 deletions pkg/apis/ml/v1alpha1/batchjob_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,28 @@

package v1alpha1

import "github.com/arangodb/kube-arangodb/pkg/apis/shared"
import (
batch "k8s.io/api/batch/v1"

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

type ArangoMLBatchJobSpec struct {
// +doc/type: batch.Job
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#JobSpec
*batch.JobSpec `json:",inline"`
}

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

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

return shared.WithErrors(err...)
}
14 changes: 13 additions & 1 deletion pkg/apis/ml/v1alpha1/batchjob_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@

package v1alpha1

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
import (
batch "k8s.io/api/batch/v1"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)

type ArangoMLBatchJobStatus struct {
// Conditions specific to the entire batch job
// +doc/type: api.Conditions
Conditions api.ConditionList `json:"conditions,omitempty"`

// +doc/type: batch.JobStatus
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#JobStatus
*batch.JobStatus `json:",inline"`

// Ref keeps the reference to the CronJob
Ref *sharedApi.Object `json:"ref,omitempty"`
}
2 changes: 1 addition & 1 deletion pkg/apis/ml/v1alpha1/cronjob_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

type ArangoMLCronJobSpec struct {
// +doc/type: batch.CronJobSpec
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1beta1#CronJobSpec
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#CronJobSpec
*batch.CronJobSpec `json:",inline"`
}

Expand Down
7 changes: 1 addition & 6 deletions pkg/apis/ml/v1alpha1/cronjob_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
batch "k8s.io/api/batch/v1"

api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)

Expand All @@ -34,13 +33,9 @@ type ArangoMLCronJobStatus struct {
Conditions api.ConditionList `json:"conditions,omitempty"`

// +doc/type: batch.CronJobStatus
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1beta1#CronJobStatus
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#CronJobStatus
*batch.CronJobStatus `json:",inline"`

// Ref keeps the reference to the CronJob
Ref *sharedApi.Object `json:"ref,omitempty"`
}

func (a *ArangoMLCronJobStatus) Validate() error {
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
}
1 change: 1 addition & 0 deletions pkg/apis/ml/v1alpha1/extension_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ const (
ExtensionStatefulSetReadyCondition api.ConditionType = "ExtensionDeploymentReady"
LicenseValidCondition api.ConditionType = "LicenseValid"
CronJobSyncedCondition api.ConditionType = "CronJobSynced"
BatchJobSyncedCondition api.ConditionType = "BatchJobSynced"
)
33 changes: 24 additions & 9 deletions pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading