mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] [ML] Multi DB Settings (#1536)
This commit is contained in:
parent
9ceaba91cf
commit
93e6af545f
7 changed files with 128 additions and 18 deletions
|
@ -34,6 +34,7 @@
|
|||
- (Feature) (ML) Handler for Extension StatefulSet and Service
|
||||
- (Feature) (ML) Pod & Container Config
|
||||
- (Improvement) (ML) BatchJob status update
|
||||
- (Feature) (ML) Multi DB Settings
|
||||
|
||||
## [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
|
||||
|
|
|
@ -76,7 +76,7 @@ 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>
|
||||
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L30)</sup>
|
||||
|
||||
Port defines on which port the container will be listening for connections
|
||||
|
||||
|
@ -132,7 +132,7 @@ 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>
|
||||
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L30)</sup>
|
||||
|
||||
Port defines on which port the container will be listening for connections
|
||||
|
||||
|
@ -180,7 +180,7 @@ Links:
|
|||
|
||||
### .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#L33)</sup>
|
||||
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment.go#L56)</sup>
|
||||
|
||||
Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
|
||||
|
||||
|
@ -250,7 +250,7 @@ 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>
|
||||
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L30)</sup>
|
||||
|
||||
Port defines on which port the container will be listening for connections
|
||||
|
||||
|
@ -513,6 +513,30 @@ UID keeps the information about object UID
|
|||
|
||||
## Status
|
||||
|
||||
### .status.arangoDB.secret.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.arangoDB.secret.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.arangoDB.secret.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
|
||||
|
||||
***
|
||||
|
||||
### .status.conditions
|
||||
|
||||
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_status.go#L31)</sup>
|
||||
|
|
|
@ -27,6 +27,29 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
)
|
||||
|
||||
const (
|
||||
ArangoMLExtensionSpecDeploymentComponentPrediction = "prediction"
|
||||
ArangoMLExtensionSpecDeploymentComponentTraining = "training"
|
||||
ArangoMLExtensionSpecDeploymentComponentProject = "project"
|
||||
|
||||
ArangoMLExtensionSpecDeploymentComponentPredictionDefaultPort = 16000
|
||||
ArangoMLExtensionSpecDeploymentComponentTrainingDefaultPort = 16001
|
||||
ArangoMLExtensionSpecDeploymentComponentProjectDefaultPort = 16002
|
||||
)
|
||||
|
||||
func GetArangoMLExtensionSpecDeploymentComponentDefaultPort(component string) int32 {
|
||||
switch component {
|
||||
case ArangoMLExtensionSpecDeploymentComponentPrediction:
|
||||
return ArangoMLExtensionSpecDeploymentComponentPredictionDefaultPort
|
||||
case ArangoMLExtensionSpecDeploymentComponentTraining:
|
||||
return ArangoMLExtensionSpecDeploymentComponentTrainingDefaultPort
|
||||
case ArangoMLExtensionSpecDeploymentComponentProject:
|
||||
return ArangoMLExtensionSpecDeploymentComponentProjectDefaultPort
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
type ArangoMLExtensionSpecDeployment struct {
|
||||
// Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
|
||||
// +doc/default: 1
|
||||
|
@ -87,9 +110,9 @@ func (s *ArangoMLExtensionSpecDeployment) GetComponents() map[string]*ArangoMLEx
|
|||
return nil
|
||||
}
|
||||
return map[string]*ArangoMLExtensionSpecDeploymentComponent{
|
||||
"prediction": s.GetPrediction(),
|
||||
"training": s.GetTraining(),
|
||||
"project": s.GetProject(),
|
||||
ArangoMLExtensionSpecDeploymentComponentPrediction: s.GetPrediction(),
|
||||
ArangoMLExtensionSpecDeploymentComponentTraining: s.GetTraining(),
|
||||
ArangoMLExtensionSpecDeploymentComponentProject: s.GetProject(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,12 +153,22 @@ func (s *ArangoMLExtensionSpecDeployment) Validate() error {
|
|||
var usedPorts util.List[int32]
|
||||
for prefix, component := range s.GetComponents() {
|
||||
err := component.Validate()
|
||||
errs = append(errs, shared.PrefixResourceErrors(prefix, err))
|
||||
if err != nil {
|
||||
errs = append(errs, shared.PrefixResourceErrors(prefix, err))
|
||||
continue
|
||||
}
|
||||
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())))
|
||||
port := component.GetPort(GetArangoMLExtensionSpecDeploymentComponentDefaultPort(prefix))
|
||||
|
||||
if port == 0 {
|
||||
errs = append(errs, shared.PrefixResourceErrors(prefix, errors.Newf("port not defined")))
|
||||
continue
|
||||
}
|
||||
|
||||
if usedPorts.IndexOf(port) >= 0 {
|
||||
errs = append(errs, shared.PrefixResourceErrors(prefix, errors.Newf("port %d already specified for other component", port)))
|
||||
} else {
|
||||
usedPorts.Append(component.GetPort())
|
||||
usedPorts.Append(port)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ 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 {
|
||||
|
@ -34,9 +33,9 @@ type ArangoMLExtensionSpecDeploymentComponent struct {
|
|||
*sharedApi.ContainerTemplate `json:",inline"`
|
||||
}
|
||||
|
||||
func (s *ArangoMLExtensionSpecDeploymentComponent) GetPort() int32 {
|
||||
func (s *ArangoMLExtensionSpecDeploymentComponent) GetPort(def int32) int32 {
|
||||
if s == nil || s.Port == nil {
|
||||
return 0
|
||||
return def
|
||||
}
|
||||
return *s.Port
|
||||
}
|
||||
|
@ -56,10 +55,6 @@ func (s *ArangoMLExtensionSpecDeploymentComponent) Validate() error {
|
|||
|
||||
var err []error
|
||||
|
||||
if s.GetPort() < 1 {
|
||||
err = append(err, shared.PrefixResourceErrors("port", errors.Newf("must be positive")))
|
||||
}
|
||||
|
||||
err = append(err,
|
||||
s.GetContainerTemplate().Validate(),
|
||||
)
|
||||
|
|
|
@ -35,4 +35,7 @@ type ArangoMLExtensionStatus struct {
|
|||
|
||||
// ServiceAccount keeps the information about ServiceAccount
|
||||
ServiceAccount *shared.ServiceAccount `json:"serviceAccount,omitempty"`
|
||||
|
||||
// ArangoDB keeps the information about local arangodb reference
|
||||
ArangoDB *ArangoMLExtensionStatusArangoDBRef `json:"arangoDB,omitempty"`
|
||||
}
|
||||
|
|
28
pkg/apis/ml/v1alpha1/extension_status_arangodb_ref.go
Normal file
28
pkg/apis/ml/v1alpha1/extension_status_arangodb_ref.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// 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/v1"
|
||||
|
||||
type ArangoMLExtensionStatusArangoDBRef struct {
|
||||
// Secret keeps the information about Secret for ArangoDB Authentication
|
||||
Secret *shared.Object `json:"secret,omitempty"`
|
||||
}
|
26
pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go
generated
26
pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go
generated
|
@ -551,6 +551,11 @@ func (in *ArangoMLExtensionStatus) DeepCopyInto(out *ArangoMLExtensionStatus) {
|
|||
*out = new(sharedv1.ServiceAccount)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.ArangoDB != nil {
|
||||
in, out := &in.ArangoDB, &out.ArangoDB
|
||||
*out = new(ArangoMLExtensionStatusArangoDBRef)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -564,6 +569,27 @@ func (in *ArangoMLExtensionStatus) DeepCopy() *ArangoMLExtensionStatus {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoMLExtensionStatusArangoDBRef) DeepCopyInto(out *ArangoMLExtensionStatusArangoDBRef) {
|
||||
*out = *in
|
||||
if in.Secret != nil {
|
||||
in, out := &in.Secret, &out.Secret
|
||||
*out = new(sharedv1.Object)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoMLExtensionStatusArangoDBRef.
|
||||
func (in *ArangoMLExtensionStatusArangoDBRef) DeepCopy() *ArangoMLExtensionStatusArangoDBRef {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ArangoMLExtensionStatusArangoDBRef)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ArangoMLExtensionStatusMetadataService) DeepCopyInto(out *ArangoMLExtensionStatusMetadataService) {
|
||||
*out = *in
|
||||
|
|
Loading…
Reference in a new issue