From 8b450801084a62887967f177c9d4a72e181274f1 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Thu, 23 Jan 2025 21:08:20 +0100 Subject: [PATCH] chore(ai-worker): added more basic configuration options to the ai-worker deployment --- charts/nextcloud/Chart.yaml | 36 +++++++++---------- charts/nextcloud/README.md | 20 ++++++++--- .../templates/nextcloud-ai-worker.yaml | 8 +++++ charts/nextcloud/values.yaml | 10 ++++++ 4 files changed, 51 insertions(+), 23 deletions(-) diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index baacc221..712c0950 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -26,21 +26,21 @@ maintainers: url: https://wrenix.eu - name: jessebot url: https://jessebot.work -dependencies: - - name: postgresql - version: 15.5.0 - repository: oci://registry-1.docker.io/bitnamicharts - condition: postgresql.enabled - - name: mariadb - version: 18.2.0 - repository: oci://registry-1.docker.io/bitnamicharts - condition: mariadb.enabled - - name: redis - version: 19.6.4 - repository: oci://registry-1.docker.io/bitnamicharts - condition: redis.enabled - - name: collabora-online - version: 1.1.20 - repository: https://collaboraonline.github.io/online - condition: collabora.enabled - alias: collabora +# dependencies: +# - name: postgresql +# version: 15.5.0 +# repository: oci://registry-1.docker.io/bitnamicharts +# condition: postgresql.enabled +# - name: mariadb +# version: 18.2.0 +# repository: oci://registry-1.docker.io/bitnamicharts +# condition: mariadb.enabled +# - name: redis +# version: 19.6.4 +# repository: oci://registry-1.docker.io/bitnamicharts +# condition: redis.enabled +# - name: collabora-online +# version: 1.1.20 +# repository: https://collaboraonline.github.io/online +# condition: collabora.enabled +# alias: collabora diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 6fdf6809..5dc31cf6 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -770,11 +770,21 @@ We provide a deployment that filters and prioritizes background jobs for AI task Check out the [official Nextcloud backup docs](https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#improve-ai-task-pickup-speed) for more information. -| Parameter | Description | Default | -|------------------------|----------------------------------------------------------------------------------------|-------------------| -| `aiWorker.enabled` | Start the ai-worker deployment | false | -| `aiWorker.replicaCount`| Number of ai-worker pod replicas to deploy | 1 | -| `aiWorker.useHostName` | Set to `true` to use the host defined in nextcloud.host and `false` to use the service | false | +| Parameter | Description | Default | +|----------------------------------|----------------------------------------------------------------------------------------|-------------------| +| `aiWorker.enabled` | Start the ai-worker deployment | `false` | +| `aiWorker.replicaCount` | Number of ai-worker pod replicas to deploy | `1` | +| `aiWorker.useHostName` | Set to `true` to use the host defined in nextcloud.host and `false` to use the service | `false` | +| `aiWorker.resources` | ai-worker resources | `{}` | +| `aiWorker.securityContext` | Optional security context for the ai-worker container | `{}` | +| `aiWorker.podSecurityContext` | Optional security context for the ai-worker container | `{}` | +| `aiWorker.affinity` | ai-worker pod affinity | `{}` | +| `aiWorker.tolerations` | ai-worker pod tolerations | `[]` | +| `aiWorker.deploymentAnnotations` | ai-worker deployment annotations | `{}` | +| `aiWorker.deploymentLabels` | ai-worker deployment labels | `{}` | +| `aiWorker.podAnnotations` | ai-worker pod annotations | `{}` | +| `aiWorker.podLabels` | ai-worker pod labels | `{}` | + # Backups Check out the [official Nextcloud backup docs](https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html). For your files, if you're using persistent volumes, and you'd like to back up to s3 backed storage (such as minio), consider using [k8up](https://github.com/k8up-io/k8up) or [velero](https://github.com/vmware-tanzu/velero). diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/nextcloud-ai-worker.yaml index 78240a9f..80f41117 100644 --- a/charts/nextcloud/templates/nextcloud-ai-worker.yaml +++ b/charts/nextcloud/templates/nextcloud-ai-worker.yaml @@ -39,8 +39,14 @@ spec: spec: affinity: {{- toYaml .Values.aiWorker.affinity | nindent 8 }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} securityContext: {{- toYaml .Values.aiWorker.securityContext | nindent 8 }} + podSecurityContext: + {{- toYaml .Values.aiWorker.podSecurityContext | nindent 8 }} initContainers: - name: wait-for-service image: alpine/curl @@ -60,6 +66,8 @@ spec: - "-c" - |- set -e; while true; do php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done + resources: + {{- toYaml .Values.aiWorker.resources | nindent 12 }} volumeMounts: {{- include "aiWorker.volumeMounts" . | trim | nindent 12 }} volumes: diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index 4c2f06cf..10b8b8cb 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -699,6 +699,10 @@ aiWorker: # runAsNonRoot: true # readOnlyRootFilesystem: true + # Set podSecurityContext parameters. For example, you may need to define fsGroup directive + podSecurityContext: {} + # fsGroup: 33 + # Set affinity parameters. For example, you may need to define a podAffinity when using a storageClass that doesn't support ReadWriteMany affinity: {} # podAffinity: @@ -708,9 +712,15 @@ aiWorker: # app: nextcloud # topologyKey: "kubernetes.io/hostname" + # Set tolerations parameters. For example, you may need to define a toleration for a specific node taint + tolerations: [] + # Set to true to use the hostname to check nextcloud for readiness useHostName: true + # ai-worker resources + resources: {} + deploymentAnnotations: {} deploymentLabels: {}