@@ -263,9 +263,28 @@ func arangodInitContainer(name, id, engine, alpineImage string, requireUUID bool
263263 return c
264264}
265265
266+ func filterStorageResourceRequirement (resources v1.ResourceRequirements ) v1.ResourceRequirements {
267+
268+ filterStorage := func (list v1.ResourceList ) v1.ResourceList {
269+ newlist := make (v1.ResourceList )
270+ for k , v := range list {
271+ if k == v1 .ResourceStorage {
272+ continue
273+ }
274+ newlist [k ] = v
275+ }
276+ return newlist
277+ }
278+
279+ return v1.ResourceRequirements {
280+ Limits : filterStorage (resources .Limits ),
281+ Requests : filterStorage (resources .Requests ),
282+ }
283+ }
284+
266285// arangodContainer creates a container configured to run `arangod`.
267286func arangodContainer (image string , imagePullPolicy v1.PullPolicy , args []string , env map [string ]EnvValue , livenessProbe * HTTPProbeConfig , readinessProbe * HTTPProbeConfig ,
268- lifecycle * v1.Lifecycle , lifecycleEnvVars []v1.EnvVar ) v1.Container {
287+ lifecycle * v1.Lifecycle , lifecycleEnvVars []v1.EnvVar , resources v1. ResourceRequirements ) v1.Container {
269288 c := v1.Container {
270289 Command : append ([]string {"/usr/sbin/arangod" }, args ... ),
271290 Name : ServerContainerName ,
@@ -279,6 +298,7 @@ func arangodContainer(image string, imagePullPolicy v1.PullPolicy, args []string
279298 Protocol : v1 .ProtocolTCP ,
280299 },
281300 },
301+ Resources : filterStorageResourceRequirement (resources ),
282302 VolumeMounts : arangodVolumeMounts (),
283303 }
284304 for k , v := range env {
@@ -434,7 +454,8 @@ func CreateArangodPod(kubecli kubernetes.Interface, developmentMode bool, deploy
434454 engine string , requireUUID bool , terminationGracePeriod time.Duration ,
435455 args []string , env map [string ]EnvValue , finalizers []string ,
436456 livenessProbe * HTTPProbeConfig , readinessProbe * HTTPProbeConfig , tolerations []v1.Toleration , serviceAccountName string ,
437- tlsKeyfileSecretName , rocksdbEncryptionSecretName string , clusterJWTSecretName string , nodeSelector map [string ]string ) error {
457+ tlsKeyfileSecretName , rocksdbEncryptionSecretName string , clusterJWTSecretName string , nodeSelector map [string ]string ,
458+ resources v1.ResourceRequirements ) error {
438459 // Prepare basic pod
439460 p := newPod (deployment .GetName (), deployment .GetNamespace (), role , id , podName , finalizers , tolerations , serviceAccountName , nodeSelector )
440461 terminationGracePeriodSeconds := int64 (math .Ceil (terminationGracePeriod .Seconds ()))
@@ -457,7 +478,7 @@ func CreateArangodPod(kubecli kubernetes.Interface, developmentMode bool, deploy
457478 }
458479
459480 // Add arangod container
460- c := arangodContainer (image , imagePullPolicy , args , env , livenessProbe , readinessProbe , lifecycle , lifecycleEnvVars )
481+ c := arangodContainer (image , imagePullPolicy , args , env , livenessProbe , readinessProbe , lifecycle , lifecycleEnvVars , resources )
461482 if tlsKeyfileSecretName != "" {
462483 c .VolumeMounts = append (c .VolumeMounts , tlsKeyfileVolumeMounts ()... )
463484 }
0 commit comments