Skip to content

Commit

Permalink
[Feature] [ML] Shutdown Handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow committed Dec 7, 2023
1 parent 44733f2 commit 9d1d84f
Show file tree
Hide file tree
Showing 28 changed files with 819 additions and 26 deletions.
15 changes: 9 additions & 6 deletions cmd/ml_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
package cmd

import (
"context"
"os"

"github.com/rs/zerolog/log"
"github.com/spf13/cobra"

"github.com/arangodb/kube-arangodb/pkg/ml/storage"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/shutdown"
"github.com/arangodb/kube-arangodb/pkg/util/svc"
)

var (
Expand All @@ -48,13 +48,18 @@ var (
cmdMLStorageS3Options struct {
storage.ServiceConfig
}

cmdMLShutdownOptions struct {
shutdown.ServiceConfig
}
)

func init() {
cmdML.AddCommand(cmdMLStorage)
cmdMLStorage.AddCommand(cmdMLStorageS3)

f := cmdMLStorageS3.PersistentFlags()
f.StringVar(&cmdMLShutdownOptions.ListenAddress, "shutdown.address", "", "Address the GRPC shutdown service will listen on (IP:port)")
f.StringVar(&cmdMLStorageS3Options.ListenAddress, "server.address", "", "Address the GRPC service will listen on (IP:port)")

f.StringVar(&cmdMLStorageS3Options.S3.Endpoint, "s3.endpoint", "", "Endpoint of S3 API implementation")
Expand All @@ -76,12 +81,10 @@ func cmdMLStorageS3Run(cmd *cobra.Command, _ []string) {
}

func cmdMLStorageS3RunE(_ *cobra.Command) error {
ctx := util.CreateSignalContext(context.Background())

svc, err := storage.NewService(ctx, storage.StorageTypeS3Proxy, cmdMLStorageS3Options.ServiceConfig)
service, err := storage.NewService(shutdown.Context(), storage.StorageTypeS3Proxy, cmdMLStorageS3Options.ServiceConfig)
if err != nil {
return err
}

return svc.Run(ctx)
return svc.RunServices(shutdown.Context(), service, shutdown.Service(cmdMLShutdownOptions.ServiceConfig))
}
28 changes: 26 additions & 2 deletions docs/api/ArangoMLCronJob.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Links:

### .status

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

Links:
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1beta1#CronJobStatus)
Expand All @@ -22,7 +22,31 @@ Links:

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L32)</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

***

### .status.object.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.object.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.object.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

52 changes: 52 additions & 0 deletions docs/api/ArangoMLExtension.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,58 @@

## Spec

### .spec.deployment.job.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.deployment.job.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.deployment.job.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.deployment.job.image.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.job.image.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.job.image.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.image

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
Expand Down
10 changes: 10 additions & 0 deletions docs/api/ArangoMLStorage.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ 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.mode.sidecar.shutdownListenPort

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

ShutdownListenPort defines on which port the sidecar container will be listening for shutdown connections

Default Value: `9202`

## Status

### .status.conditions
Expand Down
96 changes: 96 additions & 0 deletions pkg/api/shutdown/v1/operator.pb.go

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

31 changes: 31 additions & 0 deletions pkg/api/shutdown/v1/operator.proto

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

Loading

0 comments on commit 9d1d84f

Please sign in to comment.