diff --git a/charts/tezos/templates/_containers.tpl b/charts/tezos/templates/_containers.tpl index bda72f5a2..60eeca78e 100644 --- a/charts/tezos/templates/_containers.tpl +++ b/charts/tezos/templates/_containers.tpl @@ -43,6 +43,8 @@ * with_config bring in the configMap defaults true only on utils. * with_secret bring in the secrets map including the identities. * localvars set env vars MY_* Defaults to true only on utils. + * resources set container resources management, i.e. request + * and limit, default value is an empty dict. */ -}} {{- define "tezos.generic_container" }} @@ -75,6 +77,9 @@ {{- $_ := set . "args" (list .type) }} {{- end }} {{- end }} +{{- if not (hasKey . "resources") }} + {{- $_ := set . "resources" dict }} +{{- end }} {{- /* * And, now, we generate the YAML: @@ -164,6 +169,10 @@ port: 31732 {{- end }} {{- end }} +{{- if .resources }} + resources: +{{ toYaml .resources | indent 4 }} +{{- end }} {{- end }} @@ -237,9 +246,11 @@ {{- define "tezos.container.sidecar" }} {{- if or (not (hasKey $.node_vals "readiness_probe")) $.node_vals.readiness_probe }} - {{- include "tezos.generic_container" (dict "root" $ - "type" "sidecar" - "image" "utils" + {{- $sidecarResources := dict "requests" (dict "memory" "80Mi") "limits" (dict "memory" "100Mi") -}} + {{- include "tezos.generic_container" (dict "root" $ + "type" "sidecar" + "image" "utils" + "resources" $sidecarResources ) | nindent 0 }} {{- end }} {{- end }} @@ -249,6 +260,7 @@ "type" "octez-node" "image" "octez" "with_config" 0 + "resources" $.node_vals.resources ) | nindent 0 }} {{- end }} diff --git a/charts/tezos/values.yaml b/charts/tezos/values.yaml index 884b7ea98..d2cfaa92a 100644 --- a/charts/tezos/values.yaml +++ b/charts/tezos/values.yaml @@ -113,6 +113,9 @@ should_generate_unsafe_deterministic_data: false # bakers and accusers, so "baker-011-pthangz2" is configured # using just "baker". # - "storage_size": the size of the PV +# - "resources": resources specifications for the node. +# Optionally set resources and limits for octez node +# See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ # - "images": Optional specification of images to use for the tezos node and # baker. Options are "octez" with a tezos/tezos image. # If no images are provided, the containers will default to the images @@ -187,6 +190,11 @@ should_generate_unsafe_deterministic_data: false # runs: # - octez_node # - baker +# resources: +# requests: +# memory: 16192Mi +# limits: +# memory: 16192Mi # instances: # - bake_using_account: baker0 # is_bootstrap_node: true diff --git a/test/charts/mainnet.expect.yaml b/test/charts/mainnet.expect.yaml index 4a354b348..d36c25768 100644 --- a/test/charts/mainnet.expect.yaml +++ b/test/charts/mainnet.expect.yaml @@ -198,7 +198,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-init image: "tezos/tezos:v15-release" diff --git a/test/charts/mainnet2.expect.yaml b/test/charts/mainnet2.expect.yaml index be4a18332..ad1069047 100644 --- a/test/charts/mainnet2.expect.yaml +++ b/test/charts/mainnet2.expect.yaml @@ -90,6 +90,14 @@ data: } } ], + "resources": { + "limits": { + "memory": "16192Mi" + }, + "requests": { + "memory": "16192Mi" + } + }, "runs": [ "octez_node", "logger", @@ -293,7 +301,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-init image: "tezos/tezos:v15-release" @@ -586,7 +599,12 @@ spec: readinessProbe: httpGet: path: /is_synced - port: 31732 + port: 31732 + resources: + limits: + memory: 16192Mi + requests: + memory: 16192Mi - name: logger image: "ghcr.io/oxheadalpha/tezos-k8s-utils:master" imagePullPolicy: IfNotPresent @@ -646,7 +664,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-init image: "tezos/tezos:v15-release" diff --git a/test/charts/mainnet2.in.yaml b/test/charts/mainnet2.in.yaml index 9d521bff4..c73b77392 100644 --- a/test/charts/mainnet2.in.yaml +++ b/test/charts/mainnet2.in.yaml @@ -16,6 +16,11 @@ nodes: images: octez: tezos/tezos:v15-release runs: [ octez_node, logger, metrics ] + resources: + requests: + memory: 16192Mi + limits: + memory: 16192Mi instances: - config: shell: {history_mode: rolling} diff --git a/test/charts/private-chain.expect.yaml b/test/charts/private-chain.expect.yaml index 3d1f253c1..3479868c0 100644 --- a/test/charts/private-chain.expect.yaml +++ b/test/charts/private-chain.expect.yaml @@ -375,7 +375,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-generator image: "ghcr.io/oxheadalpha/tezos-k8s-utils:master" @@ -665,7 +670,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-generator image: "ghcr.io/oxheadalpha/tezos-k8s-utils:master" @@ -926,7 +936,12 @@ spec: - mountPath: /etc/tezos name: config-volume - mountPath: /var/tezos - name: var-volume + name: var-volume + resources: + limits: + memory: 100Mi + requests: + memory: 80Mi initContainers: - name: config-generator image: "ghcr.io/oxheadalpha/tezos-k8s-utils:master"