Skip to content

Commit d7e7757

Browse files
Adjust ML extension deployment for ContainerTemplate and PodTemplate (#1534)
1 parent 041bae8 commit d7e7757

File tree

7 files changed

+776
-56
lines changed

7 files changed

+776
-56
lines changed

docs/api/ArangoMLExtension.V1Alpha1.md

Lines changed: 133 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,70 @@
22

33
## Spec
44

5+
### .spec.deployment.affinity
6+
7+
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L37)</sup>
8+
9+
Affinity defines scheduling constraints for workload
10+
11+
Links:
12+
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
13+
14+
***
15+
16+
### .spec.deployment.hostIPC
17+
18+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
19+
20+
HostIPC defines to use the host's ipc namespace.
21+
22+
Default Value: `false`
23+
24+
***
25+
26+
### .spec.deployment.hostNetwork
27+
28+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L27)</sup>
29+
30+
HostNetwork requests Host network for this pod. Use the host's network namespace.
31+
If this option is set, the ports that will be used must be specified.
32+
33+
Default Value: `false`
34+
35+
***
36+
37+
### .spec.deployment.hostPID
38+
39+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L30)</sup>
40+
41+
HostPID define to use the host's pid namespace.
42+
43+
Default Value: `false`
44+
45+
***
46+
47+
### .spec.deployment.nodeSelector
48+
49+
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L32)</sup>
50+
51+
NodeSelector is a selector that must be true for the workload to fit on a node.
52+
53+
Links:
54+
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
55+
56+
***
57+
58+
### .spec.deployment.podSecurityContext
59+
60+
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_pod.go#L29)</sup>
61+
62+
PodSecurityContext holds pod-level security attributes and common container settings.
63+
64+
Links:
65+
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
66+
67+
***
68+
569
### .spec.deployment.prediction.image
670

771
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
@@ -47,6 +111,17 @@ Links:
47111

48112
***
49113

114+
### .spec.deployment.prediction.securityContext
115+
116+
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
117+
118+
PodSecurityContext holds pod-level security attributes and common container settings.
119+
120+
Links:
121+
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
122+
123+
***
124+
50125
### .spec.deployment.project.image
51126

52127
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
@@ -92,16 +167,38 @@ Links:
92167

93168
***
94169

170+
### .spec.deployment.project.securityContext
171+
172+
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
173+
174+
PodSecurityContext holds pod-level security attributes and common container settings.
175+
176+
Links:
177+
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
178+
179+
***
180+
95181
### .spec.deployment.replicas
96182

97-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment.go#L32)</sup>
183+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment.go#L33)</sup>
98184

99185
Replicas defines the number of replicas running specified components. No replicas created if no components are defined.
100186

101187
Default Value: `1`
102188

103189
***
104190

191+
### .spec.deployment.schedulerName
192+
193+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L47)</sup>
194+
195+
SchedulerName specifies, the pod will be dispatched by specified scheduler.
196+
If not specified, the pod will be dispatched by default scheduler.
197+
198+
Default Value: `""`
199+
200+
***
201+
105202
### .spec.deployment.service.type
106203

107204
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>
@@ -119,6 +216,30 @@ Possible Values:
119216

120217
***
121218

219+
### .spec.deployment.shareProcessNamespace
220+
221+
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L39)</sup>
222+
223+
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
224+
When this is set containers will be able to view and signal processes from other containers
225+
in the same pod, and the first process in each container will not be assigned PID 1.
226+
HostPID and ShareProcessNamespace cannot both be set.
227+
228+
Default Value: `false`
229+
230+
***
231+
232+
### .spec.deployment.tolerations
233+
234+
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/scheduling.go#L42)</sup>
235+
236+
Tolerations defines tolerations
237+
238+
Links:
239+
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
240+
241+
***
242+
122243
### .spec.deployment.training.image
123244

124245
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>
@@ -164,6 +285,17 @@ Links:
164285

165286
***
166287

288+
### .spec.deployment.training.securityContext
289+
290+
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/security_container.go#L29)</sup>
291+
292+
PodSecurityContext holds pod-level security attributes and common container settings.
293+
294+
Links:
295+
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
296+
297+
***
298+
167299
### .spec.image
168300

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

pkg/apis/ml/v1alpha1/extension_spec_deployment.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package v1alpha1
2222

2323
import (
2424
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
25+
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
2526
"github.com/arangodb/kube-arangodb/pkg/util"
2627
"github.com/arangodb/kube-arangodb/pkg/util/errors"
2728
)
@@ -34,6 +35,9 @@ type ArangoMLExtensionSpecDeployment struct {
3435
// Service defines how components will be exposed
3536
Service *ArangoMLExtensionSpecDeploymentService `json:"service,omitempty"`
3637

38+
// PodTemplate defines base template for pods
39+
*sharedApi.PodTemplate
40+
3741
// Prediction defines how Prediction workload will be deployed
3842
Prediction *ArangoMLExtensionSpecDeploymentComponent `json:"prediction,omitempty"`
3943
// Training defines how Training workload will be deployed
@@ -49,6 +53,14 @@ func (s *ArangoMLExtensionSpecDeployment) GetReplicas() int32 {
4953
return *s.Replicas
5054
}
5155

56+
func (s *ArangoMLExtensionSpecDeployment) GetPodTemplate() *sharedApi.PodTemplate {
57+
if s == nil || s.PodTemplate == nil {
58+
return nil
59+
}
60+
61+
return s.PodTemplate
62+
}
63+
5264
func (s *ArangoMLExtensionSpecDeployment) GetPrediction() *ArangoMLExtensionSpecDeploymentComponent {
5365
if s == nil {
5466
return nil
@@ -108,6 +120,7 @@ func (s *ArangoMLExtensionSpecDeployment) Validate() error {
108120

109121
errs := []error{
110122
shared.PrefixResourceErrors("service", shared.ValidateOptional(s.GetService(), func(s ArangoMLExtensionSpecDeploymentService) error { return s.Validate() })),
123+
s.GetPodTemplate().Validate(),
111124
}
112125

113126
if s.GetReplicas() < 0 || s.GetReplicas() > 10 {

pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@ type ArangoMLExtensionSpecDeploymentComponent struct {
3030
// Port defines on which port the container will be listening for connections
3131
Port *int32 `json:"port,omitempty"`
3232

33-
// Image defines image used for the component
34-
*sharedApi.Image `json:",inline"`
35-
36-
// Resources holds resource requests & limits for container
37-
// If not specified, default values will be used
38-
*sharedApi.Resources `json:",inline"`
33+
// ContainerTemplate Keeps the information about Container configuration
34+
*sharedApi.ContainerTemplate `json:",inline"`
3935
}
4036

4137
func (s *ArangoMLExtensionSpecDeploymentComponent) GetPort() int32 {
@@ -45,20 +41,12 @@ func (s *ArangoMLExtensionSpecDeploymentComponent) GetPort() int32 {
4541
return *s.Port
4642
}
4743

48-
func (s *ArangoMLExtensionSpecDeploymentComponent) GetImage() *sharedApi.Image {
49-
if s == nil || s.Image == nil {
50-
return nil
51-
}
52-
53-
return s.Image
54-
}
55-
56-
func (s *ArangoMLExtensionSpecDeploymentComponent) GetResources() *sharedApi.Resources {
57-
if s == nil || s.Resources == nil {
44+
func (s *ArangoMLExtensionSpecDeploymentComponent) GetContainerTemplate() *sharedApi.ContainerTemplate {
45+
if s == nil || s.ContainerTemplate == nil {
5846
return nil
5947
}
6048

61-
return s.Resources
49+
return s.ContainerTemplate
6250
}
6351

6452
func (s *ArangoMLExtensionSpecDeploymentComponent) Validate() error {
@@ -73,8 +61,7 @@ func (s *ArangoMLExtensionSpecDeploymentComponent) Validate() error {
7361
}
7462

7563
err = append(err,
76-
shared.PrefixResourceErrors("resources", s.GetResources().Validate()),
77-
shared.PrefixResourceErrors("image", shared.ValidateRequired(s.GetImage(), func(obj sharedApi.Image) error { return obj.Validate() })),
64+
s.GetContainerTemplate().Validate(),
7865
)
7966

8067
return shared.WithErrors(err...)

pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)