@@ -263,9 +263,29 @@ func arangodInitContainer(name, id, engine, alpineImage string, requireUUID bool
263263 return c
264264}
265265
266+ // filterStorageResourceRequirement filters resource requirements for Storage.
267+ func filterStorageResourceRequirement (resources v1.ResourceRequirements ) v1.ResourceRequirements {
268+
269+ filterStorage := func (list v1.ResourceList ) v1.ResourceList {
270+ newlist := make (v1.ResourceList )
271+ for k , v := range list {
272+ if k == v1 .ResourceStorage {
273+ continue
274+ }
275+ newlist [k ] = v
276+ }
277+ return newlist
278+ }
279+
280+ return v1.ResourceRequirements {
281+ Limits : filterStorage (resources .Limits ),
282+ Requests : filterStorage (resources .Requests ),
283+ }
284+ }
285+
266286// arangodContainer creates a container configured to run `arangod`.
267287func 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 {
288+ lifecycle * v1.Lifecycle , lifecycleEnvVars []v1.EnvVar , resources v1. ResourceRequirements ) v1.Container {
269289 c := v1.Container {
270290 Command : append ([]string {"/usr/sbin/arangod" }, args ... ),
271291 Name : ServerContainerName ,
@@ -279,6 +299,7 @@ func arangodContainer(image string, imagePullPolicy v1.PullPolicy, args []string
279299 Protocol : v1 .ProtocolTCP ,
280300 },
281301 },
302+ Resources : filterStorageResourceRequirement (resources ), // Storage is handled via pvcs
282303 VolumeMounts : arangodVolumeMounts (),
283304 }
284305 for k , v := range env {
@@ -434,7 +455,8 @@ func CreateArangodPod(kubecli kubernetes.Interface, developmentMode bool, deploy
434455 engine string , requireUUID bool , terminationGracePeriod time.Duration ,
435456 args []string , env map [string ]EnvValue , finalizers []string ,
436457 livenessProbe * HTTPProbeConfig , readinessProbe * HTTPProbeConfig , tolerations []v1.Toleration , serviceAccountName string ,
437- tlsKeyfileSecretName , rocksdbEncryptionSecretName string , clusterJWTSecretName string , nodeSelector map [string ]string ) error {
458+ tlsKeyfileSecretName , rocksdbEncryptionSecretName string , clusterJWTSecretName string , nodeSelector map [string ]string ,
459+ resources v1.ResourceRequirements ) error {
438460 // Prepare basic pod
439461 p := newPod (deployment .GetName (), deployment .GetNamespace (), role , id , podName , finalizers , tolerations , serviceAccountName , nodeSelector )
440462 terminationGracePeriodSeconds := int64 (math .Ceil (terminationGracePeriod .Seconds ()))
@@ -457,7 +479,7 @@ func CreateArangodPod(kubecli kubernetes.Interface, developmentMode bool, deploy
457479 }
458480
459481 // Add arangod container
460- c := arangodContainer (image , imagePullPolicy , args , env , livenessProbe , readinessProbe , lifecycle , lifecycleEnvVars )
482+ c := arangodContainer (image , imagePullPolicy , args , env , livenessProbe , readinessProbe , lifecycle , lifecycleEnvVars , resources )
461483 if tlsKeyfileSecretName != "" {
462484 c .VolumeMounts = append (c .VolumeMounts , tlsKeyfileVolumeMounts ()... )
463485 }
0 commit comments