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

[Feature] [ML] Add deployment fields to Extension spec (#1527)

This commit is contained in:
Nikita Vaniasin 2023-12-06 12:20:32 +01:00 committed by GitHub
parent f1038721b7
commit 44733f29f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 695 additions and 8 deletions

View file

@ -100,6 +100,7 @@ To upgrade to the Enterprise Edition, you need to get in touch with the ArangoDB
| Feature | Operator Version | Introduced | ArangoDB Version | ArangoDB Edition | State | Enabled | Flag | Remarks |
|:-------------------------------------------------------|:-----------------|:-----------|:-----------------|:-----------------|:-----------|:--------|:-----|:----------------------------------------------------------------------------|
| ArangoML integration | 1.2.36 | 1.2.36 | >= 3.8.0 | Enterprise | Alpha | True | N/A | Support for ArangoML CRDs |
| AgencyCache | 1.2.30 | 1.2.30 | >= 3.8.0 | Enterprise | Production | True | N/A | Enable Agency Cache mechanism in the Operator (Increase limit of the nodes) |
| Member Maintenance Support | 1.2.25 | 1.2.16 | >= 3.8.0 | Enterprise | Production | True | N/A | Enable Member Maintenance during planned restarts |
| [Rebalancer](docs/features/rebalancer.md) | 1.2.15 | 1.2.5 | >= 3.8.0 | Enterprise | Production | True | N/A | N/A |

View file

@ -2,6 +2,168 @@
## Spec
### .spec.deployment.prediction.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.deployment.prediction.port
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
Port defines on which port the container will be listening for connections
***
### .spec.deployment.prediction.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.deployment.prediction.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.deployment.prediction.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L33)</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.deployment.project.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.deployment.project.port
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
Port defines on which port the container will be listening for connections
***
### .spec.deployment.project.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.deployment.project.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.deployment.project.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L33)</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.deployment.replicas
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment.go#L32)</sup>
Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
Default Value: `1`
***
### .spec.deployment.service.type
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_service.go#L37)</sup>
Type determines how the Service is exposed
Links:
* [Kubernetes Documentation](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types)
Possible Values:
* ClusterIP (default) - service will only be accessible inside the cluster, via the cluster IP
* NodePort - service will be exposed on one port of every node, in addition to 'ClusterIP' type
* LoadBalancer - service will be exposed via an external load balancer (if the cloud provider supports it), in addition to 'NodePort' type
* ExternalName - service consists of only a reference to an external name that kubedns or equivalent will return as a CNAME record, with no exposing or proxying of any pods involved
***
### .spec.deployment.training.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.deployment.training.port
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
Port defines on which port the container will be listening for connections
***
### .spec.deployment.training.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.deployment.training.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.deployment.training.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/resources.go#L33)</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.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>

View file

@ -34,6 +34,7 @@
| Feature | Operator Version | Introduced | ArangoDB Version | ArangoDB Edition | State | Enabled | Flag | Remarks |
|:-----------------------------------------------------|:-----------------|:-----------|:-----------------|:-----------------|:-----------|:--------|:-----|:----------------------------------------------------------------------------|
| ArangoML integration | 1.2.36 | 1.2.36 | >= 3.8.0 | Enterprise | Alpha | True | N/A | Support for ArangoML CRDs |
| AgencyCache | 1.2.30 | 1.2.30 | >= 3.8.0 | Enterprise | Production | True | N/A | Enable Agency Cache mechanism in the Operator (Increase limit of the nodes) |
| Member Maintenance Support | 1.2.25 | 1.2.16 | >= 3.8.0 | Enterprise | Production | True | N/A | Enable Member Maintenance during planned restarts |
| [Rebalancer](rebalancer.md) | 1.2.15 | 1.2.5 | >= 3.8.0 | Enterprise | Production | True | N/A | N/A |

View file

@ -234,3 +234,10 @@ features:
releases:
- operatorVersion: 1.2.35
state: Production
- name: ArangoML integration
operatorEditions: Enterprise
arangoDBEditions: Enterprise
remarks: Support for ArangoML CRDs
releases:
- operatorVersion: 1.2.36
state: Alpha

View file

@ -30,14 +30,17 @@ type ArangoMLExtensionSpec struct {
// +doc/immutable: This setting cannot be changed after the MetadataService has been created.
MetadataService *ArangoMLExtensionSpecMetadataService `json:"metadataService,omitempty"`
// Storage specify the ArangoMLStorage used within Extension
// Storage specifies the ArangoMLStorage used within Extension
Storage *sharedApi.Object `json:"storage,omitempty"`
// Image define default image used for the extension
// Image defines default image used for the extension
*sharedApi.Image `json:",inline"`
// ArangoMLExtensionSpecInit define Init job specification
Init *ArangoMLExtensionSpecInit `json:"init,omitempty"`
// Deployment specifies how the ML extension will be deployed into cluster
Deployment *ArangoMLExtensionSpecDeployment `json:"deployment,omitempty"`
}
func (a *ArangoMLExtensionSpec) GetMetadataService() *ArangoMLExtensionSpecMetadataService {
@ -72,6 +75,13 @@ func (a *ArangoMLExtensionSpec) GetStorage() *sharedApi.Object {
return a.Storage
}
func (s *ArangoMLExtensionSpec) GetDeployment() *ArangoMLExtensionSpecDeployment {
if s == nil || s.Deployment == nil {
return nil
}
return s.Deployment
}
func (a *ArangoMLExtensionSpec) Validate() error {
if a == nil {
a = &ArangoMLExtensionSpec{}
@ -82,7 +92,7 @@ func (a *ArangoMLExtensionSpec) Validate() error {
shared.PrefixResourceErrors("storage", shared.ValidateRequired(a.GetStorage(), func(obj sharedApi.Object) error { return obj.Validate() })),
a.GetImage().Validate(),
shared.PrefixResourceErrors("init", a.GetInit().Validate()),
shared.PrefixResourceErrors("storage", shared.ValidateRequired(a.Storage, func(obj sharedApi.Object) error { return obj.Validate() })),
shared.ValidateAnyNotNil(".image or .init.image needs to be specified", a.GetImage(), a.GetInit().GetImage()),
shared.PrefixResourceErrors("deployment", a.GetDeployment().Validate()),
))
}

View file

@ -0,0 +1,132 @@
//
// 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 (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
type ArangoMLExtensionSpecDeployment struct {
// Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
// +doc/default: 1
Replicas *int32 `json:"replicas,omitempty"`
// Service defines how components will be exposed
Service *ArangoMLExtensionSpecDeploymentService `json:"service,omitempty"`
// Prediction defines how Prediction workload will be deployed
Prediction *ArangoMLExtensionSpecDeploymentComponent `json:"prediction,omitempty"`
// Training defines how Training workload will be deployed
Training *ArangoMLExtensionSpecDeploymentComponent `json:"training,omitempty"`
// Project defines how Project workload will be deployed
Project *ArangoMLExtensionSpecDeploymentComponent `json:"project,omitempty"`
}
func (s *ArangoMLExtensionSpecDeployment) GetReplicas() int32 {
if s == nil || s.Replicas == nil {
return 1
}
return *s.Replicas
}
func (s *ArangoMLExtensionSpecDeployment) GetPrediction() *ArangoMLExtensionSpecDeploymentComponent {
if s == nil {
return nil
}
return s.Prediction
}
func (s *ArangoMLExtensionSpecDeployment) GetTraining() *ArangoMLExtensionSpecDeploymentComponent {
if s == nil {
return nil
}
return s.Training
}
func (s *ArangoMLExtensionSpecDeployment) GetProject() *ArangoMLExtensionSpecDeploymentComponent {
if s == nil {
return nil
}
return s.Project
}
func (s *ArangoMLExtensionSpecDeployment) GetComponents() map[string]*ArangoMLExtensionSpecDeploymentComponent {
if s == nil {
return nil
}
return map[string]*ArangoMLExtensionSpecDeploymentComponent{
"prediction": s.GetPrediction(),
"training": s.GetTraining(),
"project": s.GetProject(),
}
}
func (s *ArangoMLExtensionSpecDeployment) HasComponents() bool {
if s == nil || len(s.GetComponents()) == 0 {
return false
}
for _, c := range s.GetComponents() {
if c != nil {
return true
}
}
return false
}
func (s *ArangoMLExtensionSpecDeployment) GetService() *ArangoMLExtensionSpecDeploymentService {
if s == nil {
return nil
}
return s.Service
}
func (s *ArangoMLExtensionSpecDeployment) Validate() error {
if s == nil {
return nil
}
errs := []error{
shared.PrefixResourceErrors("service", shared.ValidateOptional(s.GetService(), func(service ArangoMLExtensionSpecDeploymentService) error {
return service.Validate()
})),
}
if s.GetReplicas() < 0 || s.GetReplicas() > 10 {
errs = append(errs, shared.PrefixResourceErrors("replicas", errors.Newf("out of range [0, 10]")))
}
var usedPorts util.List[int32]
for prefix, component := range s.GetComponents() {
err := component.Validate()
errs = append(errs, shared.PrefixResourceErrors(prefix, err))
if err == nil {
if usedPorts.IndexOf(component.GetPort()) >= 0 {
errs = append(errs, shared.PrefixResourceErrors(prefix, errors.Newf("port %d already specified for other component", component.GetPort())))
} else {
usedPorts.Append(component.GetPort())
}
}
}
return shared.WithErrors(errs...)
}

View file

@ -0,0 +1,81 @@
//
// 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 (
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
)
type ArangoMLExtensionSpecDeploymentComponent struct {
// Port defines on which port the container will be listening for connections
Port *int32 `json:"port,omitempty"`
// Image defines image used for the component
*sharedApi.Image `json:",inline"`
// Resources holds resource requests & limits for container
// If not specified, default values will be used
*sharedApi.Resources `json:",inline"`
}
func (s *ArangoMLExtensionSpecDeploymentComponent) GetPort() int32 {
if s == nil || s.Port == nil {
return 0
}
return *s.Port
}
func (s *ArangoMLExtensionSpecDeploymentComponent) GetImage() *sharedApi.Image {
if s == nil || s.Image == nil {
return nil
}
return s.Image
}
func (s *ArangoMLExtensionSpecDeploymentComponent) GetResources() *sharedApi.Resources {
if s == nil || s.Resources == nil {
return nil
}
return s.Resources
}
func (s *ArangoMLExtensionSpecDeploymentComponent) Validate() error {
if s == nil {
return nil
}
var err []error
if s.GetPort() < 1 {
err = append(err, shared.PrefixResourceErrors("port", errors.Newf("must be positive")))
}
err = append(err,
shared.PrefixResourceErrors("resources", s.GetResources().Validate()),
shared.PrefixResourceErrors("image", shared.ValidateRequired(s.GetImage(), func(obj sharedApi.Image) error { return obj.Validate() })),
)
return shared.WithErrors(err...)
}

View file

@ -0,0 +1,57 @@
//
// 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 (
core "k8s.io/api/core/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
)
type ArangoMLExtensionSpecDeploymentService struct {
// Type determines how the Service is exposed
// +doc/enum: ClusterIP|service will only be accessible inside the cluster, via the cluster IP
// +doc/enum: NodePort|service will be exposed on one port of every node, in addition to 'ClusterIP' type
// +doc/enum: LoadBalancer|service will be exposed via an external load balancer (if the cloud provider supports it), in addition to 'NodePort' type
// +doc/enum: ExternalName|service consists of only a reference to an external name that kubedns or equivalent will return as a CNAME record, with no exposing or proxying of any pods involved
// +doc/default: ClusterIP
// +doc/link: Kubernetes Documentation|https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
Type *core.ServiceType `json:"type,omitempty"`
}
func (s *ArangoMLExtensionSpecDeploymentService) GetType() core.ServiceType {
if s == nil || s.Type == nil {
return core.ServiceTypeClusterIP
}
return *s.Type
}
func (s *ArangoMLExtensionSpecDeploymentService) Validate() error {
if s == nil {
return nil
}
errs := []error{
shared.PrefixResourceErrors("type", shared.ValidateServiceType(s.GetType())),
}
return shared.WithErrors(errs...)
}

View file

@ -39,6 +39,9 @@ func (a *ArangoMLExtensionSpecInit) GetImage() *sharedApi.Image {
}
func (a *ArangoMLExtensionSpecInit) Validate() error {
if a == nil {
return nil
}
return shared.WithErrors(
a.GetImage().Validate(),
)

View file

@ -34,7 +34,7 @@ type ArangoMLStorageSpecModeSidecar struct {
// Image define default image used for the extension
*sharedApi.Image `json:",inline"`
// Resources holds resource requests & limits for container running the S3 proxy
// Resources holds resource requests & limits for sidecar container
*sharedApi.Resources `json:",inline"`
}
@ -62,7 +62,7 @@ func (s *ArangoMLStorageSpecModeSidecar) Validate() error {
var err []error
if s.GetListenPort() < 1 {
err = append(err, shared.PrefixResourceErrors("database", errors.Newf("must be positive")))
err = append(err, shared.PrefixResourceErrors("listenPort", errors.Newf("must be positive")))
}
err = append(err, s.GetResources().Validate())

View file

@ -29,6 +29,7 @@ import (
v1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
sharedv1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
v1beta1 "k8s.io/api/batch/v1beta1"
corev1 "k8s.io/api/core/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -322,6 +323,11 @@ func (in *ArangoMLExtensionSpec) DeepCopyInto(out *ArangoMLExtensionSpec) {
*out = new(ArangoMLExtensionSpecInit)
(*in).DeepCopyInto(*out)
}
if in.Deployment != nil {
in, out := &in.Deployment, &out.Deployment
*out = new(ArangoMLExtensionSpecDeployment)
(*in).DeepCopyInto(*out)
}
return
}
@ -335,6 +341,99 @@ func (in *ArangoMLExtensionSpec) DeepCopy() *ArangoMLExtensionSpec {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionSpecDeployment) DeepCopyInto(out *ArangoMLExtensionSpecDeployment) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
if in.Service != nil {
in, out := &in.Service, &out.Service
*out = new(ArangoMLExtensionSpecDeploymentService)
(*in).DeepCopyInto(*out)
}
if in.Prediction != nil {
in, out := &in.Prediction, &out.Prediction
*out = new(ArangoMLExtensionSpecDeploymentComponent)
(*in).DeepCopyInto(*out)
}
if in.Training != nil {
in, out := &in.Training, &out.Training
*out = new(ArangoMLExtensionSpecDeploymentComponent)
(*in).DeepCopyInto(*out)
}
if in.Project != nil {
in, out := &in.Project, &out.Project
*out = new(ArangoMLExtensionSpecDeploymentComponent)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionSpecDeployment.
func (in *ArangoMLExtensionSpecDeployment) DeepCopy() *ArangoMLExtensionSpecDeployment {
if in == nil {
return nil
}
out := new(ArangoMLExtensionSpecDeployment)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionSpecDeploymentComponent) DeepCopyInto(out *ArangoMLExtensionSpecDeploymentComponent) {
*out = *in
if in.Port != nil {
in, out := &in.Port, &out.Port
*out = new(int32)
**out = **in
}
if in.Image != nil {
in, out := &in.Image, &out.Image
*out = new(sharedv1.Image)
(*in).DeepCopyInto(*out)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(sharedv1.Resources)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionSpecDeploymentComponent.
func (in *ArangoMLExtensionSpecDeploymentComponent) DeepCopy() *ArangoMLExtensionSpecDeploymentComponent {
if in == nil {
return nil
}
out := new(ArangoMLExtensionSpecDeploymentComponent)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoMLExtensionSpecDeploymentService) DeepCopyInto(out *ArangoMLExtensionSpecDeploymentService) {
*out = *in
if in.Type != nil {
in, out := &in.Type, &out.Type
*out = new(corev1.ServiceType)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionSpecDeploymentService.
func (in *ArangoMLExtensionSpecDeploymentService) DeepCopy() *ArangoMLExtensionSpecDeploymentService {
if in == nil {
return nil
}
out := new(ArangoMLExtensionSpecDeploymentService)
in.DeepCopyInto(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

View file

@ -124,3 +124,15 @@ func ValidateAnyNotNil[T any](msg string, obj ...*T) error {
return errors.Newf(msg)
}
// ValidateServiceType checks that service type is supported
func ValidateServiceType(st core.ServiceType) error {
switch st {
case core.ServiceTypeClusterIP,
core.ServiceTypeNodePort,
core.ServiceTypeLoadBalancer,
core.ServiceTypeExternalName:
return nil
}
return errors.Newf("Unsupported service type %s", st)
}

View file

@ -3,6 +3,119 @@ v1alpha1:
properties:
spec:
properties:
deployment:
description: Deployment specifies how the ML extension will be deployed into cluster
properties:
prediction:
description: Prediction defines how Prediction workload will be deployed
properties:
image:
description: Image define image details
type: string
port:
description: Port defines on which port the container will be listening for connections
format: int32
type: integer
pullPolicy:
description: PullPolicy define Image pull policy
type: string
pullSecrets:
description: PullSecrets define Secrets used to pull Image from registry
items:
type: string
type: array
resources:
description: Resources holds resource requests & limits for container
properties:
limits:
additionalProperties:
type: string
type: object
requests:
additionalProperties:
type: string
type: object
type: object
type: object
project:
description: Project defines how Project workload will be deployed
properties:
image:
description: Image define image details
type: string
port:
description: Port defines on which port the container will be listening for connections
format: int32
type: integer
pullPolicy:
description: PullPolicy define Image pull policy
type: string
pullSecrets:
description: PullSecrets define Secrets used to pull Image from registry
items:
type: string
type: array
resources:
description: Resources holds resource requests & limits for container
properties:
limits:
additionalProperties:
type: string
type: object
requests:
additionalProperties:
type: string
type: object
type: object
type: object
replicas:
description: Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
format: int32
type: integer
service:
description: Service defines how components will be exposed
properties:
type:
description: Type determines how the Service is exposed
enum:
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
type: string
type: object
training:
description: Training defines how Training workload will be deployed
properties:
image:
description: Image define image details
type: string
port:
description: Port defines on which port the container will be listening for connections
format: int32
type: integer
pullPolicy:
description: PullPolicy define Image pull policy
type: string
pullSecrets:
description: PullSecrets define Secrets used to pull Image from registry
items:
type: string
type: array
resources:
description: Resources holds resource requests & limits for container
properties:
limits:
additionalProperties:
type: string
type: object
requests:
additionalProperties:
type: string
type: object
type: object
type: object
type: object
image:
description: Image define image details
type: string
@ -44,7 +157,7 @@ v1alpha1:
type: string
type: array
storage:
description: Storage specify the ArangoMLStorage used within Extension
description: Storage specifies the ArangoMLStorage used within Extension
properties:
name:
description: Name of the object

View file

@ -22,7 +22,7 @@ package util
import "sort"
type List[T any] []T
type List[T comparable] []T
func (l List[T]) Filter(fn func(T) bool) List[T] {
if l == nil {
@ -57,7 +57,16 @@ func (l List[T]) Sort(fn func(T, T) bool) List[T] {
return clone
}
func MapList[T, V any](in List[T], fn func(T) V) List[V] {
func (l List[T]) IndexOf(item T) int {
for i, element := range l {
if element == item {
return i
}
}
return -1
}
func MapList[T, V comparable](in List[T], fn func(T) V) List[V] {
if in == nil {
return nil
}