1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] [ML] Jobs templates (#1539)

This commit is contained in:
jwierzbo 2023-12-18 15:51:12 +01:00 committed by GitHub
parent 607dd1bf9e
commit 50eeb84898
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 2882 additions and 154 deletions

View file

@ -20,11 +20,11 @@ Links:
*** ***
### .status.conditions ### .status.mlConditions
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_status.go#L33)</sup> Type: `api.MLConditions` <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 MLConditions specific to the entire batch job
*** ***

View file

@ -20,11 +20,11 @@ Links:
*** ***
### .status.conditions ### .status.mlConditions
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L33)</sup> Type: `api.MLConditions` <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 MLConditions specific to the entire cron job
*** ***

View file

@ -451,6 +451,594 @@ Links:
*** ***
### .spec.jobsTemplates.prediction.cpu.affinity
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L37)</sup>
Affinity defines scheduling constraints for workload
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
***
### .spec.jobsTemplates.prediction.cpu.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
HostIPC defines to use the host's ipc namespace.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.cpu.hostNetwork
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L27)</sup>
HostNetwork requests Host network for this pod. Use the host's network namespace.
If this option is set, the ports that will be used must be specified.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.cpu.hostPID
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L30)</sup>
HostPID define to use the host's pid namespace.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.cpu.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
Image define image details
***
### .spec.jobsTemplates.prediction.cpu.nodeSelector
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L32)</sup>
NodeSelector is a selector that must be true for the workload to fit on a node.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
***
### .spec.jobsTemplates.prediction.cpu.podSecurityContext
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_pod.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.prediction.cpu.pullPolicy
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
PullPolicy define Image pull policy
Default Value: `IfNotPresent`
***
### .spec.jobsTemplates.prediction.cpu.pullSecrets
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
PullSecrets define Secrets used to pull Image from registry
***
### .spec.jobsTemplates.prediction.cpu.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L34)</sup>
Resources holds resource requests & limits for container
Links:
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)
***
### .spec.jobsTemplates.prediction.cpu.schedulerName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L47)</sup>
SchedulerName specifies, the pod will be dispatched by specified scheduler.
If not specified, the pod will be dispatched by default scheduler.
Default Value: `""`
***
### .spec.jobsTemplates.prediction.cpu.securityContext
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.prediction.cpu.shareProcessNamespace
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L39)</sup>
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
When this is set containers will be able to view and signal processes from other containers
in the same pod, and the first process in each container will not be assigned PID 1.
HostPID and ShareProcessNamespace cannot both be set.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.cpu.tolerations
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L42)</sup>
Tolerations defines tolerations
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
***
### .spec.jobsTemplates.prediction.gpu.affinity
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L37)</sup>
Affinity defines scheduling constraints for workload
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
***
### .spec.jobsTemplates.prediction.gpu.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
HostIPC defines to use the host's ipc namespace.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.gpu.hostNetwork
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L27)</sup>
HostNetwork requests Host network for this pod. Use the host's network namespace.
If this option is set, the ports that will be used must be specified.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.gpu.hostPID
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L30)</sup>
HostPID define to use the host's pid namespace.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.gpu.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
Image define image details
***
### .spec.jobsTemplates.prediction.gpu.nodeSelector
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L32)</sup>
NodeSelector is a selector that must be true for the workload to fit on a node.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
***
### .spec.jobsTemplates.prediction.gpu.podSecurityContext
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_pod.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.prediction.gpu.pullPolicy
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
PullPolicy define Image pull policy
Default Value: `IfNotPresent`
***
### .spec.jobsTemplates.prediction.gpu.pullSecrets
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
PullSecrets define Secrets used to pull Image from registry
***
### .spec.jobsTemplates.prediction.gpu.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L34)</sup>
Resources holds resource requests & limits for container
Links:
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)
***
### .spec.jobsTemplates.prediction.gpu.schedulerName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L47)</sup>
SchedulerName specifies, the pod will be dispatched by specified scheduler.
If not specified, the pod will be dispatched by default scheduler.
Default Value: `""`
***
### .spec.jobsTemplates.prediction.gpu.securityContext
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.prediction.gpu.shareProcessNamespace
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L39)</sup>
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
When this is set containers will be able to view and signal processes from other containers
in the same pod, and the first process in each container will not be assigned PID 1.
HostPID and ShareProcessNamespace cannot both be set.
Default Value: `false`
***
### .spec.jobsTemplates.prediction.gpu.tolerations
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L42)</sup>
Tolerations defines tolerations
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
***
### .spec.jobsTemplates.training.cpu.affinity
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L37)</sup>
Affinity defines scheduling constraints for workload
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
***
### .spec.jobsTemplates.training.cpu.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
HostIPC defines to use the host's ipc namespace.
Default Value: `false`
***
### .spec.jobsTemplates.training.cpu.hostNetwork
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L27)</sup>
HostNetwork requests Host network for this pod. Use the host's network namespace.
If this option is set, the ports that will be used must be specified.
Default Value: `false`
***
### .spec.jobsTemplates.training.cpu.hostPID
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L30)</sup>
HostPID define to use the host's pid namespace.
Default Value: `false`
***
### .spec.jobsTemplates.training.cpu.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
Image define image details
***
### .spec.jobsTemplates.training.cpu.nodeSelector
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L32)</sup>
NodeSelector is a selector that must be true for the workload to fit on a node.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
***
### .spec.jobsTemplates.training.cpu.podSecurityContext
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_pod.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.training.cpu.pullPolicy
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
PullPolicy define Image pull policy
Default Value: `IfNotPresent`
***
### .spec.jobsTemplates.training.cpu.pullSecrets
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
PullSecrets define Secrets used to pull Image from registry
***
### .spec.jobsTemplates.training.cpu.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L34)</sup>
Resources holds resource requests & limits for container
Links:
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)
***
### .spec.jobsTemplates.training.cpu.schedulerName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L47)</sup>
SchedulerName specifies, the pod will be dispatched by specified scheduler.
If not specified, the pod will be dispatched by default scheduler.
Default Value: `""`
***
### .spec.jobsTemplates.training.cpu.securityContext
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.training.cpu.shareProcessNamespace
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L39)</sup>
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
When this is set containers will be able to view and signal processes from other containers
in the same pod, and the first process in each container will not be assigned PID 1.
HostPID and ShareProcessNamespace cannot both be set.
Default Value: `false`
***
### .spec.jobsTemplates.training.cpu.tolerations
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L42)</sup>
Tolerations defines tolerations
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
***
### .spec.jobsTemplates.training.gpu.affinity
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L37)</sup>
Affinity defines scheduling constraints for workload
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
***
### .spec.jobsTemplates.training.gpu.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
HostIPC defines to use the host's ipc namespace.
Default Value: `false`
***
### .spec.jobsTemplates.training.gpu.hostNetwork
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L27)</sup>
HostNetwork requests Host network for this pod. Use the host's network namespace.
If this option is set, the ports that will be used must be specified.
Default Value: `false`
***
### .spec.jobsTemplates.training.gpu.hostPID
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L30)</sup>
HostPID define to use the host's pid namespace.
Default Value: `false`
***
### .spec.jobsTemplates.training.gpu.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
Image define image details
***
### .spec.jobsTemplates.training.gpu.nodeSelector
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L32)</sup>
NodeSelector is a selector that must be true for the workload to fit on a node.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
***
### .spec.jobsTemplates.training.gpu.podSecurityContext
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_pod.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.training.gpu.pullPolicy
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
PullPolicy define Image pull policy
Default Value: `IfNotPresent`
***
### .spec.jobsTemplates.training.gpu.pullSecrets
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
PullSecrets define Secrets used to pull Image from registry
***
### .spec.jobsTemplates.training.gpu.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L34)</sup>
Resources holds resource requests & limits for container
Links:
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)
***
### .spec.jobsTemplates.training.gpu.schedulerName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L47)</sup>
SchedulerName specifies, the pod will be dispatched by specified scheduler.
If not specified, the pod will be dispatched by default scheduler.
Default Value: `""`
***
### .spec.jobsTemplates.training.gpu.securityContext
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.jobsTemplates.training.gpu.shareProcessNamespace
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L39)</sup>
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
When this is set containers will be able to view and signal processes from other containers
in the same pod, and the first process in each container will not be assigned PID 1.
HostPID and ShareProcessNamespace cannot both be set.
Default Value: `false`
***
### .spec.jobsTemplates.training.gpu.tolerations
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L42)</sup>
Tolerations defines tolerations
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
***
### .spec.metadataService.local.arangoMLFeatureStore ### .spec.metadataService.local.arangoMLFeatureStore
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_metadata_service.go#L65)</sup> Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_metadata_service.go#L65)</sup>

View file

@ -39,7 +39,7 @@ type ArangoMLBatchJobList struct {
// +genclient // +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoMLBatchJob contains definition and status of the ArangoML BatchJob. // ArangoMLBatchJob contains the definition and status of the ArangoML BatchJob.
type ArangoMLBatchJob struct { type ArangoMLBatchJob struct {
meta.TypeMeta `json:",inline"` meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"` meta.ObjectMeta `json:"metadata,omitempty"`
@ -49,13 +49,13 @@ type ArangoMLBatchJob struct {
} }
// AsOwner creates an OwnerReference for the given BatchJob // AsOwner creates an OwnerReference for the given BatchJob
func (d *ArangoMLBatchJob) AsOwner() meta.OwnerReference { func (a *ArangoMLBatchJob) AsOwner() meta.OwnerReference {
trueVar := true trueVar := true
return meta.OwnerReference{ return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(), APIVersion: SchemeGroupVersion.String(),
Kind: ml.ArangoMLBatchJobResourceKind, Kind: ml.ArangoMLBatchJobResourceKind,
Name: d.Name, Name: a.Name,
UID: d.UID, UID: a.UID,
Controller: &trueVar, Controller: &trueVar,
} }
} }

View file

@ -40,7 +40,11 @@ func (a *ArangoMLBatchJobSpec) Validate() error {
var err []error var err []error
if a.JobSpec == nil { if a.JobSpec == nil {
err = append(err, shared.PrefixResourceErrors("spec", errors.Newf("JobSpec is not defined"))) return shared.PrefixResourceErrors("spec", errors.Newf("JobSpec is not defined"))
}
if len(a.JobSpec.Template.Spec.Containers) != 1 {
err = append(err, shared.PrefixResourceErrors("spec.template.spec.containers", errors.Newf("Exactly one container is required")))
} }
return shared.WithErrors(err...) return shared.WithErrors(err...)

View file

@ -28,9 +28,9 @@ import (
) )
type ArangoMLBatchJobStatus struct { type ArangoMLBatchJobStatus struct {
// Conditions specific to the entire batch job // MLConditions specific to the entire batch job
// +doc/type: api.Conditions // +doc/type: api.MLConditions
Conditions api.ConditionList `json:"conditions,omitempty"` MLConditions api.ConditionList `json:"mlConditions,omitempty"`
// +doc/type: batch.JobStatus // +doc/type: batch.JobStatus
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#JobStatus // +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#JobStatus

View file

@ -23,6 +23,16 @@ package v1alpha1
import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
const ( const (
ReadyCondition api.ConditionType = "Ready" ReadyCondition api.ConditionType = "Ready"
SpecValidCondition api.ConditionType = "SpecValid" SpecValidCondition api.ConditionType = "SpecValid"
ExtensionFoundCondition api.ConditionType = "ExtensionFound"
ExtensionStorageFoundCondition api.ConditionType = "StorageFound"
ExtensionDeploymentFoundCondition api.ConditionType = "DeploymentFound"
ExtensionBootstrapCompletedCondition api.ConditionType = "BootstrapCompleted"
ExtensionMetadataServiceValidCondition api.ConditionType = "MetadataServiceValid"
ExtensionServiceAccountReadyCondition api.ConditionType = "ServiceAccountReady"
ExtensionStatefulSetReadyCondition api.ConditionType = "ExtensionDeploymentReady"
LicenseValidCondition api.ConditionType = "LicenseValid"
CronJobSyncedCondition api.ConditionType = "CronJobSynced"
BatchJobSyncedCondition api.ConditionType = "BatchJobSynced"
) )

View file

@ -40,7 +40,12 @@ func (a *ArangoMLCronJobSpec) Validate() error {
var err []error var err []error
if a.CronJobSpec == nil { if a.CronJobSpec == nil {
err = append(err, shared.PrefixResourceErrors("spec", errors.Newf("CronJobSpec is not defined"))) return shared.PrefixResourceErrors("spec", errors.Newf("CronJobSpec is not defined"))
}
if len(a.CronJobSpec.JobTemplate.Spec.Template.Spec.Containers) != 1 {
err = append(err, shared.PrefixResourceErrors("spec.jobTemplate.spec.template.spec.containers",
errors.Newf("Exactly one container is required")))
} }
return shared.WithErrors(err...) return shared.WithErrors(err...)

View file

@ -28,9 +28,9 @@ import (
) )
type ArangoMLCronJobStatus struct { type ArangoMLCronJobStatus struct {
// Conditions specific to the entire cron job // MLConditions specific to the entire cron job
// +doc/type: api.Conditions // +doc/type: api.MLConditions
Conditions api.ConditionList `json:"conditions,omitempty"` MLConditions api.ConditionList `json:"mlConditions,omitempty"`
// +doc/type: batch.CronJobStatus // +doc/type: batch.CronJobStatus
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#CronJobStatus // +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1#CronJobStatus

View file

@ -1,35 +0,0 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package v1alpha1
import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
const (
ExtensionStorageFoundCondition api.ConditionType = "StorageFound"
ExtensionDeploymentFoundCondition api.ConditionType = "DeploymentFound"
ExtensionBootstrapCompletedCondition api.ConditionType = "BootstrapCompleted"
ExtensionMetadataServiceValidCondition api.ConditionType = "MetadataServiceValid"
ExtensionServiceAccountReadyCondition api.ConditionType = "ServiceAccountReady"
ExtensionStatefulSetReadyCondition api.ConditionType = "ExtensionDeploymentReady"
LicenseValidCondition api.ConditionType = "LicenseValid"
CronJobSyncedCondition api.ConditionType = "CronJobSynced"
BatchJobSyncedCondition api.ConditionType = "BatchJobSynced"
)

View file

@ -36,11 +36,14 @@ type ArangoMLExtensionSpec struct {
// Image defines default image used for the extension // Image defines default image used for the extension
*sharedApi.Image `json:",inline"` *sharedApi.Image `json:",inline"`
// ArangoMLExtensionSpecInit define Init job specification // ArangoMLExtensionTemplate define Init job specification
Init *ArangoMLExtensionSpecInit `json:"init,omitempty"` Init *ArangoMLExtensionTemplate `json:"init,omitempty"`
// Deployment specifies how the ML extension will be deployed into cluster // Deployment specifies how the ML extension will be deployed into cluster
Deployment *ArangoMLExtensionSpecDeployment `json:"deployment,omitempty"` Deployment *ArangoMLExtensionSpecDeployment `json:"deployment,omitempty"`
// JobsTemplates defines templates for jobs
JobsTemplates *ArangoMLJobsTemplates `json:"jobsTemplates,omitempty"`
} }
func (a *ArangoMLExtensionSpec) GetMetadataService() *ArangoMLExtensionSpecMetadataService { func (a *ArangoMLExtensionSpec) GetMetadataService() *ArangoMLExtensionSpecMetadataService {
@ -59,7 +62,7 @@ func (a *ArangoMLExtensionSpec) GetImage() *sharedApi.Image {
return a.Image return a.Image
} }
func (a *ArangoMLExtensionSpec) GetInit() *ArangoMLExtensionSpecInit { func (a *ArangoMLExtensionSpec) GetInit() *ArangoMLExtensionTemplate {
if a == nil || a.Init == nil { if a == nil || a.Init == nil {
return nil return nil
} }
@ -75,11 +78,18 @@ func (a *ArangoMLExtensionSpec) GetStorage() *sharedApi.Object {
return a.Storage return a.Storage
} }
func (s *ArangoMLExtensionSpec) GetDeployment() *ArangoMLExtensionSpecDeployment { func (a *ArangoMLExtensionSpec) GetDeployment() *ArangoMLExtensionSpecDeployment {
if s == nil || s.Deployment == nil { if a == nil || a.Deployment == nil {
return nil return nil
} }
return s.Deployment return a.Deployment
}
func (a *ArangoMLExtensionSpec) GetJobsTemplates() *ArangoMLJobsTemplates {
if a == nil || a.JobsTemplates == nil {
return nil
}
return a.JobsTemplates
} }
func (a *ArangoMLExtensionSpec) Validate() error { func (a *ArangoMLExtensionSpec) Validate() error {
@ -94,5 +104,6 @@ func (a *ArangoMLExtensionSpec) Validate() error {
shared.PrefixResourceErrors("init", a.GetInit().Validate()), shared.PrefixResourceErrors("init", a.GetInit().Validate()),
shared.ValidateAnyNotNil(".image or .init.image needs to be specified", a.GetImage(), a.GetInit().GetContainerTemplate().GetImage()), shared.ValidateAnyNotNil(".image or .init.image needs to be specified", a.GetImage(), a.GetInit().GetContainerTemplate().GetImage()),
shared.PrefixResourceErrors("deployment", a.GetDeployment().Validate()), shared.PrefixResourceErrors("deployment", a.GetDeployment().Validate()),
shared.PrefixResourceErrors("jobsTemplates", a.GetJobsTemplates().Validate()),
)) ))
} }

View file

@ -1,61 +0,0 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package v1alpha1
import (
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)
type ArangoMLExtensionSpecInit struct {
// PodTemplate keeps the information about Pod configuration
*sharedApi.PodTemplate `json:",inline"`
// ContainerTemplate Keeps the information about Container configuration
*sharedApi.ContainerTemplate `json:",inline"`
}
func (a *ArangoMLExtensionSpecInit) GetPodTemplate() *sharedApi.PodTemplate {
if a == nil {
return nil
}
return a.PodTemplate
}
func (a *ArangoMLExtensionSpecInit) GetContainerTemplate() *sharedApi.ContainerTemplate {
if a == nil {
return nil
}
return a.ContainerTemplate
}
func (a *ArangoMLExtensionSpecInit) Validate() error {
if a == nil {
return nil
}
return shared.WithErrors(
a.GetPodTemplate().Validate(),
a.GetContainerTemplate().Validate(),
)
}

View file

@ -0,0 +1,139 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package v1alpha1
import (
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
)
type JobType string
const (
MLJobTrainingType JobType = "training"
MLJobPredictionType JobType = "prediction"
)
type ArangoMLJobsTemplates struct {
// Prediction defines template for the prediction job
Prediction *ArangoMLJobTemplates `json:"prediction,omitempty"`
// Training defines template for the training job
Training *ArangoMLJobTemplates `json:"training,omitempty"`
}
func (a *ArangoMLJobsTemplates) GetJobTemplates(jobType JobType) *ArangoMLJobTemplates {
if a == nil {
return nil
}
switch jobType {
case MLJobTrainingType:
return a.Training
case MLJobPredictionType:
return a.Prediction
default:
return nil
}
}
func (a *ArangoMLJobsTemplates) Validate() error {
if a == nil {
return nil
}
return shared.WithErrors(
shared.PrefixResourceErrors("prediction", a.Prediction.Validate()),
shared.PrefixResourceErrors("training", a.Training.Validate()),
)
}
type JobScheduleType string
const (
MLJobScheduleCPU JobScheduleType = "cpu"
MLJobScheduleGPU JobScheduleType = "gpu"
)
type ArangoMLJobTemplates struct {
// CPU defines templates for CPU jobs
CPU *ArangoMLExtensionTemplate `json:"cpu,omitempty"`
// GPU defines templates for GPU jobs
GPU *ArangoMLExtensionTemplate `json:"gpu,omitempty"`
}
func (a *ArangoMLJobTemplates) GetJobTemplateSpec(scheduleType JobScheduleType) *ArangoMLExtensionTemplate {
switch scheduleType {
case MLJobScheduleCPU:
return a.CPU
case MLJobScheduleGPU:
return a.GPU
default:
return nil
}
}
func (a *ArangoMLJobTemplates) Validate() error {
if a == nil {
return nil
}
return shared.WithErrors(
shared.PrefixResourceErrors("cpu", a.CPU.Validate()),
shared.PrefixResourceErrors("gpu", a.GPU.Validate()),
)
}
type ArangoMLExtensionTemplate struct {
// PodTemplate keeps the information about Pod configuration
*sharedApi.PodTemplate `json:",inline"`
// ContainerTemplate Keeps the information about Container configuration
*sharedApi.ContainerTemplate `json:",inline"`
}
func (a *ArangoMLExtensionTemplate) GetPodTemplate() *sharedApi.PodTemplate {
if a == nil {
return nil
}
return a.PodTemplate
}
func (a *ArangoMLExtensionTemplate) GetContainerTemplate() *sharedApi.ContainerTemplate {
if a == nil {
return nil
}
return a.ContainerTemplate
}
func (a *ArangoMLExtensionTemplate) Validate() error {
if a == nil {
return nil
}
return shared.WithErrors(
a.GetPodTemplate().Validate(),
a.GetContainerTemplate().Validate(),
)
}

View file

@ -118,8 +118,8 @@ func (in *ArangoMLBatchJobSpec) DeepCopy() *ArangoMLBatchJobSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLBatchJobStatus) DeepCopyInto(out *ArangoMLBatchJobStatus) { func (in *ArangoMLBatchJobStatus) DeepCopyInto(out *ArangoMLBatchJobStatus) {
*out = *in *out = *in
if in.Conditions != nil { if in.MLConditions != nil {
in, out := &in.Conditions, &out.Conditions in, out := &in.MLConditions, &out.MLConditions
*out = make(deploymentv1.ConditionList, len(*in)) *out = make(deploymentv1.ConditionList, len(*in))
for i := range *in { for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
@ -233,8 +233,8 @@ func (in *ArangoMLCronJobSpec) DeepCopy() *ArangoMLCronJobSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLCronJobStatus) DeepCopyInto(out *ArangoMLCronJobStatus) { func (in *ArangoMLCronJobStatus) DeepCopyInto(out *ArangoMLCronJobStatus) {
*out = *in *out = *in
if in.Conditions != nil { if in.MLConditions != nil {
in, out := &in.Conditions, &out.Conditions in, out := &in.MLConditions, &out.MLConditions
*out = make(deploymentv1.ConditionList, len(*in)) *out = make(deploymentv1.ConditionList, len(*in))
for i := range *in { for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i]) (*in)[i].DeepCopyInto(&(*out)[i])
@ -344,7 +344,7 @@ func (in *ArangoMLExtensionSpec) DeepCopyInto(out *ArangoMLExtensionSpec) {
} }
if in.Init != nil { if in.Init != nil {
in, out := &in.Init, &out.Init in, out := &in.Init, &out.Init
*out = new(ArangoMLExtensionSpecInit) *out = new(ArangoMLExtensionTemplate)
(*in).DeepCopyInto(*out) (*in).DeepCopyInto(*out)
} }
if in.Deployment != nil { if in.Deployment != nil {
@ -352,6 +352,11 @@ func (in *ArangoMLExtensionSpec) DeepCopyInto(out *ArangoMLExtensionSpec) {
*out = new(ArangoMLExtensionSpecDeployment) *out = new(ArangoMLExtensionSpecDeployment)
(*in).DeepCopyInto(*out) (*in).DeepCopyInto(*out)
} }
if in.JobsTemplates != nil {
in, out := &in.JobsTemplates, &out.JobsTemplates
*out = new(ArangoMLJobsTemplates)
(*in).DeepCopyInto(*out)
}
return return
} }
@ -458,32 +463,6 @@ func (in *ArangoMLExtensionSpecDeploymentService) DeepCopy() *ArangoMLExtensionS
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionSpecInit) DeepCopyInto(out *ArangoMLExtensionSpecInit) {
*out = *in
if in.PodTemplate != nil {
in, out := &in.PodTemplate, &out.PodTemplate
*out = new(sharedv1.PodTemplate)
(*in).DeepCopyInto(*out)
}
if in.ContainerTemplate != nil {
in, out := &in.ContainerTemplate, &out.ContainerTemplate
*out = new(sharedv1.ContainerTemplate)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionSpecInit.
func (in *ArangoMLExtensionSpecInit) DeepCopy() *ArangoMLExtensionSpecInit {
if in == nil {
return nil
}
out := new(ArangoMLExtensionSpecInit)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionSpecMetadataService) DeepCopyInto(out *ArangoMLExtensionSpecMetadataService) { func (in *ArangoMLExtensionSpecMetadataService) DeepCopyInto(out *ArangoMLExtensionSpecMetadataService) {
*out = *in *out = *in
@ -632,6 +611,84 @@ func (in *ArangoMLExtensionStatusMetadataServiceLocal) DeepCopy() *ArangoMLExten
return out return out
} }
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionTemplate) DeepCopyInto(out *ArangoMLExtensionTemplate) {
*out = *in
if in.PodTemplate != nil {
in, out := &in.PodTemplate, &out.PodTemplate
*out = new(sharedv1.PodTemplate)
(*in).DeepCopyInto(*out)
}
if in.ContainerTemplate != nil {
in, out := &in.ContainerTemplate, &out.ContainerTemplate
*out = new(sharedv1.ContainerTemplate)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionTemplate.
func (in *ArangoMLExtensionTemplate) DeepCopy() *ArangoMLExtensionTemplate {
if in == nil {
return nil
}
out := new(ArangoMLExtensionTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLJobTemplates) DeepCopyInto(out *ArangoMLJobTemplates) {
*out = *in
if in.CPU != nil {
in, out := &in.CPU, &out.CPU
*out = new(ArangoMLExtensionTemplate)
(*in).DeepCopyInto(*out)
}
if in.GPU != nil {
in, out := &in.GPU, &out.GPU
*out = new(ArangoMLExtensionTemplate)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLJobTemplates.
func (in *ArangoMLJobTemplates) DeepCopy() *ArangoMLJobTemplates {
if in == nil {
return nil
}
out := new(ArangoMLJobTemplates)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLJobsTemplates) DeepCopyInto(out *ArangoMLJobsTemplates) {
*out = *in
if in.Prediction != nil {
in, out := &in.Prediction, &out.Prediction
*out = new(ArangoMLJobTemplates)
(*in).DeepCopyInto(*out)
}
if in.Training != nil {
in, out := &in.Training, &out.Training
*out = new(ArangoMLJobTemplates)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLJobsTemplates.
func (in *ArangoMLJobsTemplates) DeepCopy() *ArangoMLJobsTemplates {
if in == nil {
return nil
}
out := new(ArangoMLJobsTemplates)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLStorage) DeepCopyInto(out *ArangoMLStorage) { func (in *ArangoMLStorage) DeepCopyInto(out *ArangoMLStorage) {
*out = *in *out = *in

File diff suppressed because it is too large Load diff

30
pkg/util/labels.go Normal file
View file

@ -0,0 +1,30 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package util
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func ExtractLabel(obj meta.Object, label string) (string, bool) {
v, ok := obj.GetLabels()[label]
return v, ok
}