Skip to content

Commit a496add

Browse files
authored
[Feature] [ML] Container Envs (#1550)
1 parent de4def4 commit a496add

File tree

10 files changed

+993
-0
lines changed

10 files changed

+993
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- (Feature) (ML) Port adjustments
3939
- (Feature) (ML) Support for deployments with JWT auth enabled
4040
- (Feature) (ML) GPU Jobs
41+
- (Feature) (ML) Container Envs
4142

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

docs/api/ArangoMLExtension.V1Alpha1.md

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,28 @@ Links:
6666

6767
***
6868

69+
### .spec.deployment.prediction.env
70+
71+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
72+
73+
Env keeps the information about environment variables provided to the container
74+
75+
Links:
76+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
77+
78+
***
79+
80+
### .spec.deployment.prediction.envFrom
81+
82+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
83+
84+
EnvFrom keeps the information about environment variable sources provided to the container
85+
86+
Links:
87+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
88+
89+
***
90+
6991
### .spec.deployment.prediction.gpu
7092

7193
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
@@ -132,6 +154,28 @@ Links:
132154

133155
***
134156

157+
### .spec.deployment.project.env
158+
159+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
160+
161+
Env keeps the information about environment variables provided to the container
162+
163+
Links:
164+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
165+
166+
***
167+
168+
### .spec.deployment.project.envFrom
169+
170+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
171+
172+
EnvFrom keeps the information about environment variable sources provided to the container
173+
174+
Links:
175+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
176+
177+
***
178+
135179
### .spec.deployment.project.gpu
136180

137181
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
@@ -260,6 +304,28 @@ Links:
260304

261305
***
262306

307+
### .spec.deployment.training.env
308+
309+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
310+
311+
Env keeps the information about environment variables provided to the container
312+
313+
Links:
314+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
315+
316+
***
317+
318+
### .spec.deployment.training.envFrom
319+
320+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
321+
322+
EnvFrom keeps the information about environment variable sources provided to the container
323+
324+
Links:
325+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
326+
327+
***
328+
263329
### .spec.deployment.training.gpu
264330

265331
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_spec_deployment_component.go#L31)</sup>
@@ -345,6 +411,28 @@ Links:
345411

346412
***
347413

414+
### .spec.init.env
415+
416+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
417+
418+
Env keeps the information about environment variables provided to the container
419+
420+
Links:
421+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
422+
423+
***
424+
425+
### .spec.init.envFrom
426+
427+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
428+
429+
EnvFrom keeps the information about environment variable sources provided to the container
430+
431+
Links:
432+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
433+
434+
***
435+
348436
### .spec.init.hostIPC
349437

350438
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
@@ -492,6 +580,28 @@ Links:
492580

493581
***
494582

583+
### .spec.jobsTemplates.prediction.cpu.env
584+
585+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
586+
587+
Env keeps the information about environment variables provided to the container
588+
589+
Links:
590+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
591+
592+
***
593+
594+
### .spec.jobsTemplates.prediction.cpu.envFrom
595+
596+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
597+
598+
EnvFrom keeps the information about environment variable sources provided to the container
599+
600+
Links:
601+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
602+
603+
***
604+
495605
### .spec.jobsTemplates.prediction.cpu.hostIPC
496606

497607
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
@@ -639,6 +749,28 @@ Links:
639749

640750
***
641751

752+
### .spec.jobsTemplates.prediction.gpu.env
753+
754+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
755+
756+
Env keeps the information about environment variables provided to the container
757+
758+
Links:
759+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
760+
761+
***
762+
763+
### .spec.jobsTemplates.prediction.gpu.envFrom
764+
765+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
766+
767+
EnvFrom keeps the information about environment variable sources provided to the container
768+
769+
Links:
770+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
771+
772+
***
773+
642774
### .spec.jobsTemplates.prediction.gpu.hostIPC
643775

644776
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
@@ -786,6 +918,28 @@ Links:
786918

787919
***
788920

921+
### .spec.jobsTemplates.training.cpu.env
922+
923+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
924+
925+
Env keeps the information about environment variables provided to the container
926+
927+
Links:
928+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
929+
930+
***
931+
932+
### .spec.jobsTemplates.training.cpu.envFrom
933+
934+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
935+
936+
EnvFrom keeps the information about environment variable sources provided to the container
937+
938+
Links:
939+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
940+
941+
***
942+
789943
### .spec.jobsTemplates.training.cpu.hostIPC
790944

791945
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>
@@ -933,6 +1087,28 @@ Links:
9331087

9341088
***
9351089

1090+
### .spec.jobsTemplates.training.gpu.env
1091+
1092+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
1093+
1094+
Env keeps the information about environment variables provided to the container
1095+
1096+
Links:
1097+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
1098+
1099+
***
1100+
1101+
### .spec.jobsTemplates.training.gpu.envFrom
1102+
1103+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
1104+
1105+
EnvFrom keeps the information about environment variable sources provided to the container
1106+
1107+
Links:
1108+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
1109+
1110+
***
1111+
9361112
### .spec.jobsTemplates.training.gpu.hostIPC
9371113

9381114
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>

docs/api/ArangoMLStorage.V1Alpha1.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,28 @@ Default Value: `/`
9898

9999
***
100100

101+
### .spec.mode.sidecar.env
102+
103+
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
104+
105+
Env keeps the information about environment variables provided to the container
106+
107+
Links:
108+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
109+
110+
***
111+
112+
### .spec.mode.sidecar.envFrom
113+
114+
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
115+
116+
EnvFrom keeps the information about environment variable sources provided to the container
117+
118+
Links:
119+
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
120+
121+
***
122+
101123
### .spec.mode.sidecar.image
102124

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

pkg/apis/shared/v1/core_container_spec.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ type ContainerTemplate struct {
3333

3434
// SecurityContainer keeps the security settings for Container
3535
*SecurityContainer `json:",inline"`
36+
37+
// Environments keeps the environment variables for Container
38+
*Environments `json:",inline"`
3639
}
3740

3841
func (a *ContainerTemplate) With(other *ContainerTemplate) *ContainerTemplate {
@@ -52,6 +55,7 @@ func (a *ContainerTemplate) With(other *ContainerTemplate) *ContainerTemplate {
5255
Image: a.GetImage().With(other.GetImage()),
5356
Resources: a.GetResources().With(other.GetResources()),
5457
SecurityContainer: a.GetSecurityContainer().With(other.GetSecurityContainer()),
58+
Environments: a.GetEnvironments().With(other.GetEnvironments()),
5559
}
5660
}
5761

@@ -71,6 +75,14 @@ func (a *ContainerTemplate) GetSecurityContainer() *SecurityContainer {
7175
return a.SecurityContainer
7276
}
7377

78+
func (a *ContainerTemplate) GetEnvironments() *Environments {
79+
if a == nil || a.Environments == nil {
80+
return nil
81+
}
82+
83+
return a.Environments
84+
}
85+
7486
func (a *ContainerTemplate) GetResources() *Resources {
7587
if a == nil || a.Resources == nil {
7688
return nil
@@ -87,5 +99,6 @@ func (a *ContainerTemplate) Validate() error {
8799
a.GetImage().Validate(),
88100
a.GetResources().Validate(),
89101
a.GetSecurityContainer().Validate(),
102+
a.GetEnvironments().Validate(),
90103
)
91104
}

pkg/apis/shared/v1/envs.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package v1
22+
23+
import (
24+
core "k8s.io/api/core/v1"
25+
26+
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/envs"
27+
)
28+
29+
type Environments struct {
30+
// Env keeps the information about environment variables provided to the container
31+
// +doc/type: core.EnvVar
32+
// +doc/link: Kubernetes Docs|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core
33+
Env []core.EnvVar `json:"env,omitempty"`
34+
35+
// EnvFrom keeps the information about environment variable sources provided to the container
36+
// +doc/type: core.EnvFromSource
37+
// +doc/link: Kubernetes Docs|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core
38+
EnvFrom []core.EnvFromSource `json:"envFrom,omitempty"`
39+
}
40+
41+
func (e *Environments) With(other *Environments) *Environments {
42+
if e == nil && other == nil {
43+
return nil
44+
}
45+
46+
if e == nil {
47+
return other.DeepCopy()
48+
}
49+
50+
if other == nil {
51+
return e.DeepCopy()
52+
}
53+
54+
return &Environments{
55+
Env: envs.MergeEnvs(e.Env, other.Env...),
56+
EnvFrom: envs.MergeEnvFrom(e.EnvFrom, other.EnvFrom...),
57+
}
58+
}
59+
60+
func (e *Environments) Validate() error {
61+
return nil
62+
}

0 commit comments

Comments
 (0)