Skip to content

Commit 2b9f51e

Browse files
committed
[Feature] [ML] Shutdown Handler
1 parent 244c362 commit 2b9f51e

29 files changed

+824
-50
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- (Improvement) (ML) Switch to fsnotify for file watching for MacOS support
3131
- (Feature) (ML) Unify Images, Resources and Lifecycle
3232
- (Improvement) (ML) CronJob status update
33+
- (Improvement) (ML) Job Sidecar Shutdown
3334

3435
## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
3536
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks

cmd/ml_storage.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
package cmd
2222

2323
import (
24-
"context"
2524
"os"
2625

2726
"github.com/rs/zerolog/log"
2827
"github.com/spf13/cobra"
2928

3029
"github.com/arangodb/kube-arangodb/pkg/ml/storage"
31-
"github.com/arangodb/kube-arangodb/pkg/util"
30+
"github.com/arangodb/kube-arangodb/pkg/util/shutdown"
31+
"github.com/arangodb/kube-arangodb/pkg/util/svc"
3232
)
3333

3434
var (
@@ -48,13 +48,18 @@ var (
4848
cmdMLStorageS3Options struct {
4949
storage.ServiceConfig
5050
}
51+
52+
cmdMLShutdownOptions struct {
53+
shutdown.ServiceConfig
54+
}
5155
)
5256

5357
func init() {
5458
cmdML.AddCommand(cmdMLStorage)
5559
cmdMLStorage.AddCommand(cmdMLStorageS3)
5660

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

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

7883
func cmdMLStorageS3RunE(_ *cobra.Command) error {
79-
ctx := util.CreateSignalContext(context.Background())
80-
81-
svc, err := storage.NewService(ctx, storage.StorageTypeS3Proxy, cmdMLStorageS3Options.ServiceConfig)
84+
service, err := storage.NewService(shutdown.Context(), storage.StorageTypeS3Proxy, cmdMLStorageS3Options.ServiceConfig)
8285
if err != nil {
8386
return err
8487
}
8588

86-
return svc.Run(ctx)
89+
return svc.RunServices(shutdown.Context(), service, shutdown.ServiceCentral(cmdMLShutdownOptions.ServiceConfig))
8790
}

docs/api/ArangoMLExtension.V1Alpha1.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,58 @@
22

33
## Spec
44

5+
### .spec.deployment.job.gpu.image
6+
7+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
8+
9+
Image define image details
10+
11+
***
12+
13+
### .spec.deployment.job.gpu.pullPolicy
14+
15+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
16+
17+
PullPolicy define Image pull policy
18+
19+
Default Value: `IfNotPresent`
20+
21+
***
22+
23+
### .spec.deployment.job.gpu.pullSecrets
24+
25+
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
26+
27+
PullSecrets define Secrets used to pull Image from registry
28+
29+
***
30+
31+
### .spec.deployment.job.image.image
32+
33+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
34+
35+
Image define image details
36+
37+
***
38+
39+
### .spec.deployment.job.image.pullPolicy
40+
41+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L35)</sup>
42+
43+
PullPolicy define Image pull policy
44+
45+
Default Value: `IfNotPresent`
46+
47+
***
48+
49+
### .spec.deployment.job.image.pullSecrets
50+
51+
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L38)</sup>
52+
53+
PullSecrets define Secrets used to pull Image from registry
54+
55+
***
56+
557
### .spec.deployment.prediction.image
658

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

docs/api/ArangoMLStorage.V1Alpha1.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,16 @@ Resources holds resource requests & limits for container
143143
Links:
144144
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#resourcerequirements-v1-core)
145145

146+
***
147+
148+
### .spec.mode.sidecar.shutdownListenPort
149+
150+
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>
151+
152+
ShutdownListenPort defines on which port the sidecar container will be listening for shutdown connections
153+
154+
Default Value: `9202`
155+
146156
## Status
147157

148158
### .status.conditions

pkg/api/shutdown/v1/operator.pb.go

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/shutdown/v1/operator.proto

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/shutdown/v1/operator_grpc.pb.go

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)