From e3decf4d7823c5e71727941729186847c49d0993 Mon Sep 17 00:00:00 2001 From: t3mi Date: Fri, 27 Oct 2023 15:24:06 +0000 Subject: [PATCH] feat: add resources configuration for alpha init container Signed-off-by: t3mi --- charts/dgraph/README.md | 1 + charts/dgraph/templates/alpha/statefulset.yaml | 4 ++++ charts/dgraph/values.yaml | 12 +++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/charts/dgraph/README.md b/charts/dgraph/README.md index e505d705e..d5689a988 100644 --- a/charts/dgraph/README.md +++ b/charts/dgraph/README.md @@ -177,6 +177,7 @@ The following table lists the configurable parameters of the `dgraph` chart and | `alpha.initContainers.init.image.pullPolicy` | Alpha initContainer pull policy | `IfNotPresent` | | `alpha.initContainers.init.env` | Adds environment variables for the alpha init container | `[]` | | `alpha.initContainers.init.command` | Alpha initContainer command line to execute | See `values.yaml` for defaults | +| `alpha.initContainers.init.resources` | Alpha initContainer resource requests and/or limits | `{}` | | `ratel.name` | Ratel component name | `ratel` | | `ratel.enabled` | Ratel service enabled or disabled | `false` | | `ratel.extraAnnotations` | Specify annotations for template metadata | `{}` | diff --git a/charts/dgraph/templates/alpha/statefulset.yaml b/charts/dgraph/templates/alpha/statefulset.yaml index 6eec77c85..7ff0b3545 100644 --- a/charts/dgraph/templates/alpha/statefulset.yaml +++ b/charts/dgraph/templates/alpha/statefulset.yaml @@ -145,6 +145,10 @@ spec: {{- range .Values.alpha.initContainers.init.command }} - {{ . | quote }} {{- end }} + {{- with .Values.alpha.initContainers.init.resources }} + resources: + {{- toYaml . | nindent 10 }} + {{- end }} {{- if .Values.alpha.persistence.enabled }} volumeMounts: - name: datadir diff --git a/charts/dgraph/values.yaml b/charts/dgraph/values.yaml index c1198b9d3..16dd4afdb 100644 --- a/charts/dgraph/values.yaml +++ b/charts/dgraph/values.yaml @@ -470,7 +470,17 @@ alpha: - | trap "exit" SIGINT SIGTERM echo "Write to /dgraph/doneinit when ready." - until [ -f /dgraph/doneinit ]; do sleep 2; done + until [ -f /dgraph/doneinit ]; do sleep 2; done + ## Configure resource requests + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + ## resources: + ## requests: + ## memory: 256Mi + ## cpu: 250m + ## limits: + ## memory: 1Gi + ## cpu: 1 ratel: name: ratel