Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reources management for nodes #508

Merged
merged 3 commits into from
Dec 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions charts/tezos/templates/_containers.tpl
Original file line number Diff line number Diff line change
@@ -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 }}

8 changes: 8 additions & 0 deletions charts/tezos/values.yaml
Original file line number Diff line number Diff line change
@@ -113,6 +113,7 @@ 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.
# - "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 +188,13 @@ should_generate_unsafe_deterministic_data: false
# runs:
# - octez_node
# - baker
# # You can optionally set resources and limits for your octez node/baker
# # See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
# resources:
# requests:
# memory: 16192Mi
# limits:
# memory: 16192Mi
# instances:
# - bake_using_account: baker0
# is_bootstrap_node: true
7 changes: 6 additions & 1 deletion test/charts/mainnet.expect.yaml
Original file line number Diff line number Diff line change
@@ -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"
29 changes: 26 additions & 3 deletions test/charts/mainnet2.expect.yaml
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 5 additions & 0 deletions test/charts/mainnet2.in.yaml
Original file line number Diff line number Diff line change
@@ -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}
21 changes: 18 additions & 3 deletions test/charts/private-chain.expect.yaml
Original file line number Diff line number Diff line change
@@ -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"