From 55a8fb046d074f20f713f943c7bb271d18b9b304 Mon Sep 17 00:00:00 2001 From: Lamine Date: Wed, 29 May 2024 14:18:48 +0200 Subject: [PATCH] Refactor/add-init-repo-and-resources (#78) * refactor: add init container based on persistent enabled and add resources * chore: add default values --- charts/doccano/templates/deployment.yaml | 20 +++++++++++++++++--- charts/doccano/values.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/charts/doccano/templates/deployment.yaml b/charts/doccano/templates/deployment.yaml index cd5eec9..54ee91e 100644 --- a/charts/doccano/templates/deployment.yaml +++ b/charts/doccano/templates/deployment.yaml @@ -54,21 +54,29 @@ spec: name: {{ .Values.service.targetPort }}{{ .Values.service.protocol | lower }} protocol: {{ .Values.service.protocol }} volumeMounts: + {{- if .Values.persistence.enabled }} - mountPath: {{ .Values.persistence.mountPath }} name: {{ .Values.persistence.volumeName }} + {{- end }} - mountPath: /config name: bootstrap + {{- if .Values.persistence.enabled }} initContainers: - args: - chown - "1000:1000" - {{ .Values.persistence.mountPath }} - image: busybox - imagePullPolicy: IfNotPresent - name: chmod + image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}" + imagePullPolicy: {{ .Values.init.image.pullPolicy }} + name: init volumeMounts: - mountPath: {{ .Values.persistence.mountPath }} name: {{ .Values.persistence.volumeName }} + {{- with .Values.init.resources }} + resources: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} volumes: - configMap: defaultMode: 0777 @@ -78,10 +86,16 @@ spec: name: {{ .Release.Name }}-conf optional: false name: bootstrap + {{- if .Values.persistence.enabled }} - name: {{ .Values.persistence.volumeName }} persistentVolumeClaim: claimName: "{{ .Release.Name }}-{{ .Values.persistence.volumeName }}" + {{- end }} {{- if .Values.image.deployRegistry }} imagePullSecrets: - name: "{{ .Values.image.name }}-{{ .Values.image.imagePullSecrets }}" {{- end }} + {{- with .Values.resources }} + resources: + {{- toYaml . | nindent 8 }} + {{- end }} \ No newline at end of file diff --git a/charts/doccano/values.yaml b/charts/doccano/values.yaml index 4395f25..245c8c8 100644 --- a/charts/doccano/values.yaml +++ b/charts/doccano/values.yaml @@ -13,6 +13,30 @@ env: ADMIN_EMAIL: admin@localhost ADMIN_USERNAME: admin +init: + image: + repository: busybox + tag: latest + pullPolicy: IfNotPresent + resources: + requests: + cpu: 50m + memory: 32M + limits: + cpu: 100m + memory: 64M + +extraEnv: + DEBUG: false + +resources: + requests: + cpu: 100m + memory: 1G + limits: + cpu: 500m + memory: 2G + deploySecret: true ADMIN_PASSWORD: password