1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] [ML] Container Envs (#1550)

This commit is contained in:
Adam Janikowski 2023-12-22 13:21:44 +01:00 committed by GitHub
parent de4def4693
commit a496add11c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 993 additions and 0 deletions

View file

@ -38,6 +38,7 @@
- (Feature) (ML) Port adjustments
- (Feature) (ML) Support for deployments with JWT auth enabled
- (Feature) (ML) GPU Jobs
- (Feature) (ML) Container Envs
## [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

View file

@ -66,6 +66,28 @@ Links:
***
### .spec.deployment.prediction.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.deployment.prediction.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.deployment.prediction.gpu
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:
***
### .spec.deployment.project.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.deployment.project.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.deployment.project.gpu
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:
***
### .spec.deployment.training.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.deployment.training.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.deployment.training.gpu
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:
***
### .spec.init.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.init.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.init.hostIPC
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:
***
### .spec.jobsTemplates.prediction.cpu.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.jobsTemplates.prediction.cpu.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.jobsTemplates.prediction.cpu.hostIPC
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:
***
### .spec.jobsTemplates.prediction.gpu.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.jobsTemplates.prediction.gpu.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.jobsTemplates.prediction.gpu.hostIPC
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:
***
### .spec.jobsTemplates.training.cpu.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.jobsTemplates.training.cpu.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.jobsTemplates.training.cpu.hostIPC
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:
***
### .spec.jobsTemplates.training.gpu.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.jobsTemplates.training.gpu.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.jobsTemplates.training.gpu.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/container_namespace.go#L33)</sup>

View file

@ -98,6 +98,28 @@ Default Value: `/`
***
### .spec.mode.sidecar.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L33)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core)
***
### .spec.mode.sidecar.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/envs.go#L38)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core)
***
### .spec.mode.sidecar.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/image.go#L31)</sup>

View file

@ -33,6 +33,9 @@ type ContainerTemplate struct {
// SecurityContainer keeps the security settings for Container
*SecurityContainer `json:",inline"`
// Environments keeps the environment variables for Container
*Environments `json:",inline"`
}
func (a *ContainerTemplate) With(other *ContainerTemplate) *ContainerTemplate {
@ -52,6 +55,7 @@ func (a *ContainerTemplate) With(other *ContainerTemplate) *ContainerTemplate {
Image: a.GetImage().With(other.GetImage()),
Resources: a.GetResources().With(other.GetResources()),
SecurityContainer: a.GetSecurityContainer().With(other.GetSecurityContainer()),
Environments: a.GetEnvironments().With(other.GetEnvironments()),
}
}
@ -71,6 +75,14 @@ func (a *ContainerTemplate) GetSecurityContainer() *SecurityContainer {
return a.SecurityContainer
}
func (a *ContainerTemplate) GetEnvironments() *Environments {
if a == nil || a.Environments == nil {
return nil
}
return a.Environments
}
func (a *ContainerTemplate) GetResources() *Resources {
if a == nil || a.Resources == nil {
return nil
@ -87,5 +99,6 @@ func (a *ContainerTemplate) Validate() error {
a.GetImage().Validate(),
a.GetResources().Validate(),
a.GetSecurityContainer().Validate(),
a.GetEnvironments().Validate(),
)
}

View file

@ -0,0 +1,62 @@
//
// 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 v1
import (
core "k8s.io/api/core/v1"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/envs"
)
type Environments struct {
// Env keeps the information about environment variables provided to the container
// +doc/type: core.EnvVar
// +doc/link: Kubernetes Docs|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envvar-v1-core
Env []core.EnvVar `json:"env,omitempty"`
// EnvFrom keeps the information about environment variable sources provided to the container
// +doc/type: core.EnvFromSource
// +doc/link: Kubernetes Docs|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#envfromsource-v1-core
EnvFrom []core.EnvFromSource `json:"envFrom,omitempty"`
}
func (e *Environments) With(other *Environments) *Environments {
if e == nil && other == nil {
return nil
}
if e == nil {
return other.DeepCopy()
}
if other == nil {
return e.DeepCopy()
}
return &Environments{
Env: envs.MergeEnvs(e.Env, other.Env...),
EnvFrom: envs.MergeEnvFrom(e.EnvFrom, other.EnvFrom...),
}
}
func (e *Environments) Validate() error {
return nil
}

View file

@ -69,6 +69,11 @@ func (in *ContainerTemplate) DeepCopyInto(out *ContainerTemplate) {
*out = new(SecurityContainer)
(*in).DeepCopyInto(*out)
}
if in.Environments != nil {
in, out := &in.Environments, &out.Environments
*out = new(Environments)
(*in).DeepCopyInto(*out)
}
return
}
@ -82,6 +87,36 @@ func (in *ContainerTemplate) DeepCopy() *ContainerTemplate {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Environments) DeepCopyInto(out *Environments) {
*out = *in
if in.Env != nil {
in, out := &in.Env, &out.Env
*out = make([]corev1.EnvVar, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.EnvFrom != nil {
in, out := &in.EnvFrom, &out.EnvFrom
*out = make([]corev1.EnvFromSource, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Environments.
func (in *Environments) DeepCopy() *Environments {
if in == nil {
return nil
}
out := new(Environments)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in HashList) DeepCopyInto(out *HashList) {
{

View file

@ -385,6 +385,75 @@ v1alpha1:
prediction:
description: Prediction defines how Prediction workload will be deployed
properties:
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
gpu:
description: GPU defined if GPU Jobs are enabled for component. In use only for ArangoMLExtensionSpecDeploymentComponentPrediction and ArangoMLExtensionSpecDeploymentComponentTraining
type: boolean
@ -479,6 +548,75 @@ v1alpha1:
project:
description: Project defines how Project workload will be deployed
properties:
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
gpu:
description: GPU defined if GPU Jobs are enabled for component. In use only for ArangoMLExtensionSpecDeploymentComponentPrediction and ArangoMLExtensionSpecDeploymentComponentTraining
type: boolean
@ -618,6 +756,75 @@ v1alpha1:
training:
description: Training defines how Training workload will be deployed
properties:
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
gpu:
description: GPU defined if GPU Jobs are enabled for component. In use only for ArangoMLExtensionSpecDeploymentComponentPrediction and ArangoMLExtensionSpecDeploymentComponentTraining
type: boolean
@ -1016,6 +1223,75 @@ v1alpha1:
type: array
type: object
type: object
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
hostIPC:
description: HostIPC defines to use the host's ipc namespace.
type: boolean
@ -1514,6 +1790,75 @@ v1alpha1:
type: array
type: object
type: object
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
hostIPC:
description: HostIPC defines to use the host's ipc namespace.
type: boolean
@ -2006,6 +2351,75 @@ v1alpha1:
type: array
type: object
type: object
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
hostIPC:
description: HostIPC defines to use the host's ipc namespace.
type: boolean
@ -2502,6 +2916,75 @@ v1alpha1:
type: array
type: object
type: object
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
hostIPC:
description: HostIPC defines to use the host's ipc namespace.
type: boolean
@ -2994,6 +3477,75 @@ v1alpha1:
type: array
type: object
type: object
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
hostIPC:
description: HostIPC defines to use the host's ipc namespace.
type: boolean

View file

@ -68,6 +68,75 @@ v1alpha1:
sidecar:
description: Sidecar mode runs the storage implementation as a sidecar
properties:
env:
description: Env keeps the information about environment variables provided to the container
items:
properties:
name:
type: string
value:
type: string
valueFrom:
properties:
configMapKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
fieldRef:
properties:
apiVersion:
type: string
fieldPath:
type: string
type: object
resourceFieldRef:
properties:
containerName:
type: string
divisor:
type: string
resource:
type: string
type: object
secretKeyRef:
properties:
key:
type: string
name:
type: string
optional:
type: boolean
type: object
type: object
type: object
type: array
envFrom:
description: EnvFrom keeps the information about environment variable sources provided to the container
items:
properties:
configMapRef:
properties:
name:
type: string
optional:
type: boolean
type: object
prefix:
type: string
secretRef:
properties:
name:
type: string
optional:
type: boolean
type: object
type: object
type: array
image:
description: Image define image details
type: string

View file

@ -0,0 +1,57 @@
//
// 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 envs
import core "k8s.io/api/core/v1"
func MergeEnvs(in []core.EnvVar, envs ...core.EnvVar) []core.EnvVar {
out := append([]core.EnvVar{}, in...)
for _, env := range envs {
var envCopy core.EnvVar
env.DeepCopyInto(&envCopy)
if id := EnvId(out, envCopy.Name); id == -1 {
out = append(out, envCopy)
} else {
out[id] = envCopy
}
}
return out
}
func MergeEnvFrom(in []core.EnvFromSource, envs ...core.EnvFromSource) []core.EnvFromSource {
out := append([]core.EnvFromSource{}, in...)
out = append(out, envs...)
return out
}
func EnvId(in []core.EnvVar, name string) int {
for id := range in {
if in[id].Name == name {
return id
}
}
return -1
}

View file

@ -44,6 +44,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/globals"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/envs"
podv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/pod/v1"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/interfaces"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
@ -810,6 +811,11 @@ func InjectContainerTemplate(spec *sharedApi.ContainerTemplate, pod *core.PodTem
container.SecurityContext = security.SecurityContext.DeepCopy()
}
if environments := spec.GetEnvironments(); environments != nil {
container.Env = envs.MergeEnvs(container.Env, environments.Env...)
container.EnvFrom = envs.MergeEnvFrom(container.EnvFrom, environments.EnvFrom...)
}
return nil
}