Skip to content

Commit

Permalink
Allow configuring requests/limits on node sidecars and staking-miner (#…
Browse files Browse the repository at this point in the history
…253)

Co-authored-by: Bulat Saifullin <[email protected]>
  • Loading branch information
bakhtin and BulatSaif authored Jun 5, 2023
1 parent a61f71e commit 464ae09
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 4.8.0
version: 4.9.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
7 changes: 7 additions & 0 deletions charts/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,10 @@ If you're running a collator node:
| `autoscaling.targetCPU` | The target average CPU utilization at which to scale up another pod | `""` |
| `autoscaling.targetMemory` | The target average memory utilization at which to scale up another pod | `""` |
| `autoscaling.additionalMetrics` | A list of additional metric types use to scale up | `{}` |
| `retrieveServiceInfo.resources` | Requests/Limits configuration for `retrieve-service-info` sidecar container | `{}` |
| `syncChainGCS.resources` | Requests/Limits configuration for `sync-chain-gcs` sidecar container | `{}` |
| `syncRelayChainGCS.resources` | Requests/Limits configuration for `sync-relay-chain-gcs` sidecar container | `{}` |
| `downloadChainspec.resources` | Requests/Limits configuration for `download-chainspec` sidecar container | `{}` |
| `downloadRuntime.resources` | Requests/Limits configuration for `download-runtime` sidecar container | `{}` |
| `persistGeneratedNodeKey.resources` | Requests/Limits configuration for `persist-generated-node-key` sidecar container | `{}` |
| `injectKeys.resources` | Requests/Limits configuration for `inject-*` sidecar containers | `{}` |
2 changes: 1 addition & 1 deletion charts/node/ci/kind-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ node:
chainKeystore:
storageClass: standard
image:
tag: v0.9.27
tag: v0.9.42
18 changes: 18 additions & 0 deletions charts/node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ spec:
env:
- name: CHAIN_PATH
value: {{ default .Values.node.chain .Values.node.chainData.chainPath }}
resources:
{{- toYaml .Values.syncChainGCS.resources | nindent 12 }}
volumeMounts:
- mountPath: /chain-data
name: chain-data
Expand Down Expand Up @@ -235,6 +237,8 @@ spec:
env:
- name: RELAY_CHAIN_PATH
value: {{ default .Values.node.collatorRelayChain.chain .Values.node.collatorRelayChain.chainData.chainPath }}
resources:
{{- toYaml .Values.syncRelayChainGCS.resources | nindent 12 }}
volumeMounts:
- mountPath: /relaychain-data
name: relaychain-data
Expand Down Expand Up @@ -270,6 +274,8 @@ spec:
fi
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.downloadChainspec.resources | nindent 12 }}
volumeMounts:
- mountPath: /chain-data
name: chain-data
Expand All @@ -290,6 +296,8 @@ spec:
set -eu -o pipefail {{ if .Values.initContainer.debug }}-x{{ end }}
mkdir -p {{ .Values.node.wasmRuntimeOverridesPath }}
wget -nc -P {{ .Values.node.wasmRuntimeOverridesPath }} {{ .Values.node.wasmRuntimeUrl }}
resources:
{{- toYaml .Values.downloadRuntime.resources | nindent 12 }}
volumeMounts:
- mountPath: /chain-data
name: chain-data
Expand All @@ -314,6 +322,8 @@ spec:
fi
NODE_PEER_ID="$({{ .Values.node.command }} key inspect-node-key --file ${NODE_KEY_PATH})"
echo "Node key present in ${NODE_KEY_PATH} with peer-id: ${NODE_PEER_ID}"
resources:
{{- toYaml .Values.persistGeneratedNodeKey.resources | nindent 12 }}
volumeMounts:
- mountPath: /keystore
name: chain-keystore
Expand Down Expand Up @@ -346,6 +356,8 @@ spec:
env:
- name: CHAIN
value: {{ .Values.node.chain }}
resources:
{{- toYaml .Values.injectKeys.resources | nindent 12 }}
volumeMounts:
- mountPath: /keystore
name: chain-keystore
Expand Down Expand Up @@ -377,6 +389,8 @@ spec:
env:
- name: CHAIN
value: {{ .Values.node.chain }}
resources:
{{- toYaml .Values.injectKeys.resources | nindent 12 }}
volumeMounts:
- mountPath: /keystore
name: chain-keystore
Expand Down Expand Up @@ -418,6 +432,8 @@ spec:
&& echo "Inserted key {{ .name }} (type={{ .type }}, scheme={{ .scheme }}) into Keystore" \
|| echo "Failed to insert key {{ .name }} (type={{ .type }}, scheme={{ .scheme }}) into Keystore."
{{- end }}
resources:
{{- toYaml .Values.injectKeys.resources | nindent 12 }}
env:
- name: CHAIN
value: {{ .Values.node.chain }}
Expand Down Expand Up @@ -460,6 +476,8 @@ spec:
echo "${EXTERNAL_IP}" > /chain-data/node_external_ip
echo "Retrieved external IP from {{ .Values.node.perNodeServices.ipRetrievalServiceUrl }}, saved ${EXTERNAL_IP} to /chain-data/node_external_ip"
{{- end }}
resources:
{{- toYaml .Values.retrieveServiceInfo.resources | nindent 12 }}
volumeMounts:
- mountPath: /chain-data
name: chain-data
Expand Down
23 changes: 23 additions & 0 deletions charts/node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ googleCloudSdk:
gsutilFlags: '-m -o "GSUtil:parallel_process_count=$(nproc --all)" -o "GSUtil:parallel_thread_count=2" -o "GSUtil:use_gcloud_storage=True"'
# serviceAccountKey: ""

## initContainers
retrieveServiceInfo:
resources: {}

syncChainGCS:
resources: {}

syncRelayChainGCS:
resources: {}

downloadChainspec:
resources: {}

downloadRuntime:
resources: {}

persistGeneratedNodeKey:
resources: {}

injectKeys:
resources: {}
##

## Reference to one or more secrets to be used when pulling images
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
##
Expand Down
2 changes: 1 addition & 1 deletion charts/staking-miner/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: staking-miner
description: A Helm chart to deploy staking miner (https://github.com/paritytech/staking-miner)
type: application
version: 1.3.2
version: 1.4.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
Expand Down
3 changes: 2 additions & 1 deletion charts/staking-miner/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ spec:
secretKeyRef:
name: {{ include "common.secrets.name" (dict "existingSecret" .Values.stakingMiner.existingSecret "context" $) }}
key: {{ include "common.secrets.key" (dict "existingSecret" .Values.stakingMiner.existingSecret "key" "config") }}
resources: {{- toYaml .Values.generateConfig.resources | nindent 12 }}
volumeMounts:
- name: configs
mountPath: "/config"
Expand All @@ -104,7 +105,7 @@ spec:
CMD="staking-miner info --uri $(cat /config/uri)"
$CMD
until $CMD | grep -B20 'Compatible: YES'
do
do
echo "VERSION MISMATCH: Waiting for correct runtime, retrying soon.."
sleep 60
done
Expand Down
2 changes: 2 additions & 0 deletions charts/staking-miner/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ stakingMiner:
## @param generateConfig.image.tag init-container image tag (immutable tags are recommended)
## @param generateConfig.image.pullPolicy init-container image pull policy
## @param generateConfig.image.pullSecrets init-container image pull secrets
## @param generateConfig.resources init-container requests/limits
generateConfig:
image:
registry: docker.io
Expand All @@ -91,6 +92,7 @@ generateConfig:
## - myRegistryKeySecretName
##
pullSecrets: []
resources: {}

## @param waitRuntimeUpgrade Wait until chain will have same spec version as staking miner.
##
Expand Down

0 comments on commit 464ae09

Please sign in to comment.