From 7ab5457efdb489732c51520c53426976b651b85a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:29:48 +0000 Subject: [PATCH 01/14] chore(deps): bump helm/chart-testing-action from 2.6.1 to 2.7.0 Bumps [helm/chart-testing-action](https://github.com/helm/chart-testing-action) from 2.6.1 to 2.7.0. - [Release notes](https://github.com/helm/chart-testing-action/releases) - [Commits](https://github.com/helm/chart-testing-action/compare/v2.6.1...v2.7.0) --- updated-dependencies: - dependency-name: helm/chart-testing-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Signed-off-by: Daniel Hendricken --- .github/workflows/lint-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index d5d5caef..382687fa 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -42,7 +42,7 @@ jobs: helm repo add collabora-online https://collaboraonline.github.io/online - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.1 + uses: helm/chart-testing-action@v2.7.0 - name: Run chart-testing (list-changed) id: list-changed @@ -112,7 +112,7 @@ jobs: helm repo add collabora-online https://collaboraonline.github.io/online - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.1 + uses: helm/chart-testing-action@v2.7.0 - name: Run chart-testing (list-changed) id: list-changed From 483e707d93038926d1e2d6a52d36e11ad2ef3435 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Thu, 23 Jan 2025 19:46:29 +0100 Subject: [PATCH 02/14] feat(ai-worker): adding a deployment for AI background workers Signed-off-by: Daniel Hendricken --- charts/nextcloud/templates/_helpers.tpl | 34 ++++++++ .../templates/nextcloud-ai-worker.yaml | 79 +++++++++++++++++++ charts/nextcloud/values.yaml | 35 ++++++++ 3 files changed, 148 insertions(+) create mode 100644 charts/nextcloud/templates/nextcloud-ai-worker.yaml diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index 5efea5d1..2cef1ee3 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -398,3 +398,37 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con subPath: {{ $key }} {{- end }} {{- end -}} + + +{{/* +Create volume mounts for the nextcloud-aiworker container. +*/}} +{{- define "aiWorker.volumeMounts" -}} +- name: nextcloud-main + mountPath: /var/www/ + subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +- name: nextcloud-main + mountPath: /var/www/html + subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} +- name: nextcloud-data + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }} +{{- else }} +- name: nextcloud-main + mountPath: {{ .Values.nextcloud.datadir }} + subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }} +{{- end }} +- name: nextcloud-main + mountPath: /var/www/html/config + subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +- name: nextcloud-main + mountPath: /var/www/html/custom_apps + subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +- name: nextcloud-main + mountPath: /var/www/tmp + subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +- name: nextcloud-main + mountPath: /var/www/html/themes + subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +{{- end }} \ No newline at end of file diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/nextcloud-ai-worker.yaml new file mode 100644 index 00000000..78240a9f --- /dev/null +++ b/charts/nextcloud/templates/nextcloud-ai-worker.yaml @@ -0,0 +1,79 @@ +{{- if .Values.aiWorker.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nextcloud.fullname" . }}-ai-worker + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + helm.sh/chart: {{ include "nextcloud.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/component: app + {{- with .Values.aiWorker.deploymentLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.aiWorker.deploymentAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} +spec: + replicas: {{ .Values.aiWorker.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/component: app + {{- with .Values.aiWorker.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + annotations: + {{- with .Values.aiWorker.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + affinity: + {{- toYaml .Values.aiWorker.affinity | nindent 8 }} + securityContext: + {{- toYaml .Values.aiWorker.securityContext | nindent 8 }} + initContainers: + - name: wait-for-service + image: alpine/curl + command: + - sh + - -c + - >- + until curl -sf https://{{ if .Values.aiWorker.useHostName }}{{ .Values.nextcloud.host }}/status.php {{- else }} http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/status.php;{{- end }} + do echo waiting for service; sleep 5; + done + containers: + - name: nextcloud-aiworker + image: {{ include "nextcloud.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - sh + - "-c" + - |- + set -e; while true; do php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done + volumeMounts: + {{- include "aiWorker.volumeMounts" . | trim | nindent 12 }} + volumes: + - name: nextcloud-main + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} + {{- else }} + emptyDir: {} + {{- end }} + {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} + - name: nextcloud-data + persistentVolumeClaim: + claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} + {{- end }} + restartPolicy: Always +{{- end }} \ No newline at end of file diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index a0b9c7d2..4c2f06cf 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -682,6 +682,41 @@ dnsConfig: {} # - name: ndots # value: "1" + +## Deployment to execute nextcloud-assistant related background tasks +## ref: https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#improve-ai-task-pickup-speed +## +aiWorker: + enabled: false + + # Number of replicas to be deployed + replicaCount: 1 + + # Set securityContext parameters. For example, you may need to define runAsNonRoot directive + securityContext: {} + # runAsUser: 33 + # runAsGroup: 33 + # runAsNonRoot: true + # readOnlyRootFilesystem: true + + # Set affinity parameters. For example, you may need to define a podAffinity when using a storageClass that doesn't support ReadWriteMany + affinity: {} + # podAffinity: + # requiredDuringSchedulingIgnoredDuringExecution: + # - labelSelector: + # matchLabels: + # app: nextcloud + # topologyKey: "kubernetes.io/hostname" + + # Set to true to use the hostname to check nextcloud for readiness + useHostName: true + + + deploymentAnnotations: {} + deploymentLabels: {} + podAnnotations: {} + podLabels: {} + imaginary: # -- Start Imgaginary enabled: false From 7fa16418d4b02f1ed90729e9e313a4e4d496a3b5 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Thu, 23 Jan 2025 20:06:23 +0100 Subject: [PATCH 03/14] chore(ai-worker): updated readme with ai-worker values Signed-off-by: Daniel Hendricken --- charts/nextcloud/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 0bdbf83d..6fdf6809 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -41,6 +41,7 @@ helm install my-release nextcloud/nextcloud * [Running `occ` commands](#running-occ-commands) * [Putting Nextcloud into maintanence mode](#putting-nextcloud-into-maintanence-mode) * [Downloading models for recognize](#downloading-models-for-recognize) +* [Improve AI task pickup speed]() * [Backups](#backups) * [Upgrades](#upgrades) * [Troubleshooting](#troubleshooting) @@ -764,6 +765,16 @@ kubectl exec $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ maintenance:mo # $NEXTCLOUD_POD should be the name of *your* nextcloud pod :) kubectl exec $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ recognize:download-models" ``` +# Improve AI task pickup speed +We provide a deployment that filters and prioritizes background jobs for AI tasks. This results in faster task processing and can be scaled according to your needs by increasing the number of replicas in the deployment. + +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 | # 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). From 3c08ff122e3900daf4e524c81a73df7ad5b4cd30 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Thu, 23 Jan 2025 20:07:59 +0100 Subject: [PATCH 04/14] chore(ai-worker): incremented chart minor version Signed-off-by: Daniel Hendricken --- charts/nextcloud/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index 3ece1429..baacc221 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: nextcloud -version: 6.6.3 +version: 6.7.0 # renovate: image=docker.io/library/nextcloud appVersion: 30.0.5 description: A file sharing server that puts the control and security of your own data back into your hands. From 7e92817b5dc9522d69d4818e4ab0e0fcdbecbeb8 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Thu, 23 Jan 2025 21:08:20 +0100 Subject: [PATCH 05/14] chore(ai-worker): added more basic configuration options to the ai-worker deployment Signed-off-by: Daniel Hendricken --- charts/nextcloud/README.md | 20 ++++++++++++++----- .../templates/nextcloud-ai-worker.yaml | 8 ++++++++ charts/nextcloud/values.yaml | 10 ++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) 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: {} From 5985b81a542abaf81332c49c7fa08a03fcdaed64 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken <162698556+dhendricken@users.noreply.github.com> Date: Thu, 23 Jan 2025 21:44:41 +0100 Subject: [PATCH 06/14] corrected description of documentation link for AI tasks in readme Co-authored-by: Kate <26026535+provokateurin@users.noreply.github.com> Signed-off-by: Daniel Hendricken <162698556+dhendricken@users.noreply.github.com> --- charts/nextcloud/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 5dc31cf6..dd51f3d0 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -768,7 +768,7 @@ kubectl exec $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ recognize:down # Improve AI task pickup speed We provide a deployment that filters and prioritizes background jobs for AI tasks. This results in faster task processing and can be scaled according to your needs by increasing the number of replicas in the deployment. -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. +Check out the [official Nextcloud AI docs](https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#improve-ai-task-pickup-speed) for more information. | Parameter | Description | Default | |----------------------------------|----------------------------------------------------------------------------------------|-------------------| From 207ab613e4af607d84afc3105ac8afcdad15b36a Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Fri, 24 Jan 2025 19:02:19 +0100 Subject: [PATCH 07/14] chore(ai-worker): changed componant label to ai-worker and removed name suffix '-ai-worker' Signed-off-by: Daniel Hendricken chore(ai-worker): changed componant label to ai-worker and removed name suffix '-ai-worker' --- charts/nextcloud/templates/nextcloud-ai-worker.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/nextcloud-ai-worker.yaml index 80f41117..706bcc35 100644 --- a/charts/nextcloud/templates/nextcloud-ai-worker.yaml +++ b/charts/nextcloud/templates/nextcloud-ai-worker.yaml @@ -4,11 +4,11 @@ kind: Deployment metadata: name: {{ include "nextcloud.fullname" . }}-ai-worker labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + app.kubernetes.io/name: {{ include "nextcloud.name" . }} helm.sh/chart: {{ include "nextcloud.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} - app.kubernetes.io/component: app + app.kubernetes.io/component: ai-worker {{- with .Values.aiWorker.deploymentLabels }} {{- toYaml . | nindent 8 }} {{- end }} @@ -20,15 +20,15 @@ spec: replicas: {{ .Values.aiWorker.replicaCount }} selector: matchLabels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: app + app.kubernetes.io/component: ai-worker template: metadata: labels: - app.kubernetes.io/name: {{ include "nextcloud.name" . }}-ai-worker + app.kubernetes.io/name: {{ include "nextcloud.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} - app.kubernetes.io/component: app + app.kubernetes.io/component: ai-worker {{- with .Values.aiWorker.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} From 0c0a47e5793446045a83fd9b6c8bd846e5ad3275 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Fri, 24 Jan 2025 19:53:59 +0100 Subject: [PATCH 08/14] chore(ai-worker): made initContainer image configurable with values Signed-off-by: Daniel Hendricken --- charts/nextcloud/templates/nextcloud-ai-worker.yaml | 2 +- charts/nextcloud/values.yaml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/nextcloud-ai-worker.yaml index 706bcc35..40692eff 100644 --- a/charts/nextcloud/templates/nextcloud-ai-worker.yaml +++ b/charts/nextcloud/templates/nextcloud-ai-worker.yaml @@ -49,7 +49,7 @@ spec: {{- toYaml .Values.aiWorker.podSecurityContext | nindent 8 }} initContainers: - name: wait-for-service - image: alpine/curl + image: {{ .Values.aiWorker.image.repository }}:{{ .Values.aiWorker.image.tag }} command: - sh - -c diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index 10b8b8cb..c0c9bba4 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -689,6 +689,11 @@ dnsConfig: {} aiWorker: enabled: false + image: + repository: alpine/curl + tag: latest + pullPolicy: IfNotPresent + # Number of replicas to be deployed replicaCount: 1 From 2636c7e4bfdaa72d764f7aaebab35c0374aaff73 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Fri, 24 Jan 2025 20:52:11 +0100 Subject: [PATCH 09/14] chore(ai-worker): corrected the quick-link for ai-tasks Signed-off-by: Daniel Hendricken --- charts/nextcloud/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index dd51f3d0..415f3b46 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -41,7 +41,7 @@ helm install my-release nextcloud/nextcloud * [Running `occ` commands](#running-occ-commands) * [Putting Nextcloud into maintanence mode](#putting-nextcloud-into-maintanence-mode) * [Downloading models for recognize](#downloading-models-for-recognize) -* [Improve AI task pickup speed]() +* [Improve AI task pickup speed](#improve-ai-task-pickup-speed) * [Backups](#backups) * [Upgrades](#upgrades) * [Troubleshooting](#troubleshooting) From 81ba57b3f5aeef945ae6a3dcd3bc13ad31e94eb7 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Sat, 8 Feb 2025 11:13:59 +0100 Subject: [PATCH 10/14] chore(ai-worker): using nextcloud.volumeMounts for ai-worker deployment Signed-off-by: Daniel Hendricken --- charts/nextcloud/Chart.yaml | 36 ++++++------- charts/nextcloud/templates/_helpers.tpl | 36 +------------ .../templates/nextcloud-ai-worker.yaml | 52 +++++++++++++++---- 3 files changed, 61 insertions(+), 63 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/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index 2cef1ee3..afe82395 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -397,38 +397,4 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con mountPath: {{ $nginxEnabled | ternary (printf "/usr/local/etc/php-fpm.d/%s" $key | quote) (printf "/usr/local/etc/php/conf.d/%s" $key | quote) }} subPath: {{ $key }} {{- end }} -{{- end -}} - - -{{/* -Create volume mounts for the nextcloud-aiworker container. -*/}} -{{- define "aiWorker.volumeMounts" -}} -- name: nextcloud-main - mountPath: /var/www/ - subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -- name: nextcloud-main - mountPath: /var/www/html - subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} -- name: nextcloud-data - mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.nextcloudData.subPath) (empty .Values.persistence.nextcloudData.subPath) }} -{{- else }} -- name: nextcloud-main - mountPath: {{ .Values.nextcloud.datadir }} - subPath: {{ ternary "data" (printf "%s/data" .Values.persistence.subPath) (empty .Values.persistence.subPath) }} -{{- end }} -- name: nextcloud-main - mountPath: /var/www/html/config - subPath: {{ ternary "config" (printf "%s/config" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -- name: nextcloud-main - mountPath: /var/www/html/custom_apps - subPath: {{ ternary "custom_apps" (printf "%s/custom_apps" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -- name: nextcloud-main - mountPath: /var/www/tmp - subPath: {{ ternary "tmp" (printf "%s/tmp" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -- name: nextcloud-main - mountPath: /var/www/html/themes - subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} -{{- end }} \ No newline at end of file +{{- end -}} \ No newline at end of file diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/nextcloud-ai-worker.yaml index 40692eff..95508355 100644 --- a/charts/nextcloud/templates/nextcloud-ai-worker.yaml +++ b/charts/nextcloud/templates/nextcloud-ai-worker.yaml @@ -48,15 +48,15 @@ spec: podSecurityContext: {{- toYaml .Values.aiWorker.podSecurityContext | nindent 8 }} initContainers: - - name: wait-for-service - image: {{ .Values.aiWorker.image.repository }}:{{ .Values.aiWorker.image.tag }} - command: - - sh - - -c - - >- - until curl -sf https://{{ if .Values.aiWorker.useHostName }}{{ .Values.nextcloud.host }}/status.php {{- else }} http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/status.php;{{- end }} - do echo waiting for service; sleep 5; - done + - name: wait-for-service + image: {{ .Values.aiWorker.image.repository }}:{{ .Values.aiWorker.image.tag }} + command: + - sh + - -c + - >- + until curl -sf {{- if .Values.aiWorker.useHostName }}https://{{ .Values.nextcloud.host }}/status.php{{- else }}http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/status.php{{- end }}; + do echo waiting for service; sleep 5; + done containers: - name: nextcloud-aiworker image: {{ include "nextcloud.image" . }} @@ -69,7 +69,15 @@ spec: resources: {{- toYaml .Values.aiWorker.resources | nindent 12 }} volumeMounts: - {{- include "aiWorker.volumeMounts" . | trim | nindent 12 }} + {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} + {{- range $hook, $shell := .Values.nextcloud.hooks }} + {{- if $shell }} + - name: nextcloud-hooks + mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh + subPath: {{ $hook }}.sh + readOnly: true + {{- end }} + {{- end }} volumes: - name: nextcloud-main {{- if .Values.persistence.enabled }} @@ -83,5 +91,29 @@ spec: persistentVolumeClaim: claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} {{- end }} + {{- if .Values.nextcloud.configs }} + - name: nextcloud-config + configMap: + name: {{ template "nextcloud.fullname" . }}-config + {{- end }} + {{- if .Values.nextcloud.phpConfigs }} + - name: nextcloud-phpconfig + configMap: + name: {{ template "nextcloud.fullname" . }}-phpconfig + {{- end }} + {{- if .Values.nginx.enabled }} + - name: nextcloud-nginx-config + configMap: + name: {{ template "nextcloud.fullname" . }}-nginxconfig + {{- end }} + {{- if not (values .Values.nextcloud.hooks | compact | empty) }} + - name: nextcloud-hooks + configMap: + name: {{ template "nextcloud.fullname" . }}-hooks + defaultMode: 0o755 + {{- end }} + {{- with .Values.nextcloud.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} restartPolicy: Always {{- end }} \ No newline at end of file From 505a9b61a13bbd4e8eb4e8bdd1786c6033696c41 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Sat, 8 Feb 2025 11:22:02 +0100 Subject: [PATCH 11/14] chore(ai-worker): using nextcloud.volumeMounts for ai-worker deployment Signed-off-by: Daniel Hendricken chore: uncommented dependencies in Chart.yaml --- charts/nextcloud/Chart.yaml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index 712c0950..baacc221 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 From 939e5be6cb7c6ffdad5bfe9e878dab5d9ebb8be0 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Wed, 12 Feb 2025 16:02:17 +0100 Subject: [PATCH 12/14] chore: docs for helm-docs Signed-off-by: WrenIX --- charts/nextcloud/README.md | 2 +- charts/nextcloud/templates/_helpers.tpl | 2 +- charts/nextcloud/values.yaml | 38 +++++++++++++++++++------ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 415f3b46..c4afe9c3 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -781,7 +781,7 @@ Check out the [official Nextcloud AI docs](https://docs.nextcloud.com/server/lat | `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.deploymentLabels` | ai-worker deployment labels | `{}` | | `aiWorker.podAnnotations` | ai-worker pod annotations | `{}` | | `aiWorker.podLabels` | ai-worker pod labels | `{}` | diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index afe82395..5efea5d1 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -397,4 +397,4 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con mountPath: {{ $nginxEnabled | ternary (printf "/usr/local/etc/php-fpm.d/%s" $key | quote) (printf "/usr/local/etc/php/conf.d/%s" $key | quote) }} subPath: {{ $key }} {{- end }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index c0c9bba4..e9f3dacb 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -687,28 +687,40 @@ dnsConfig: {} ## ref: https://docs.nextcloud.com/server/latest/admin_manual/ai/overview.html#improve-ai-task-pickup-speed ## aiWorker: + # -- Start / Deploy Worker for AI + # @section -- AI Worker enabled: false image: + # -- + # @section -- AI Worker repository: alpine/curl + # -- + # @section -- AI Worker tag: latest + # -- + # @section -- AI Worker pullPolicy: IfNotPresent - # Number of replicas to be deployed + # -- Number of replicas to be deployed + # @section -- AI Worker replicaCount: 1 - # Set securityContext parameters. For example, you may need to define runAsNonRoot directive + # -- Set securityContext parameters. For example, you may need to define runAsNonRoot directive + # @section -- AI Worker securityContext: {} # runAsUser: 33 # runAsGroup: 33 # runAsNonRoot: true # readOnlyRootFilesystem: true - # Set podSecurityContext parameters. For example, you may need to define fsGroup directive + # -- Set podSecurityContext parameters. For example, you may need to define fsGroup directive + # @section -- AI Worker podSecurityContext: {} # fsGroup: 33 - # Set affinity parameters. For example, you may need to define a podAffinity when using a storageClass that doesn't support ReadWriteMany + # -- Set affinity parameters. For example, you may need to define a podAffinity when using a storageClass that doesn't support ReadWriteMany + # @section -- AI Worker affinity: {} # podAffinity: # requiredDuringSchedulingIgnoredDuringExecution: @@ -717,19 +729,29 @@ aiWorker: # app: nextcloud # topologyKey: "kubernetes.io/hostname" - # Set tolerations parameters. For example, you may need to define a toleration for a specific node taint + # -- Set tolerations parameters. For example, you may need to define a toleration for a specific node taint + # @section -- AI Worker tolerations: [] - # Set to true to use the hostname to check nextcloud for readiness + # -- Set to true to use the hostname to check nextcloud for readiness + # @section -- AI Worker useHostName: true - # ai-worker resources + # -- ai-worker resources + # @section -- AI Worker resources: {} - + # -- Annotations on Deployment + # @section -- AI Worker deploymentAnnotations: {} + # -- Labels on Deployment + # @section -- AI Worker deploymentLabels: {} + # -- Annotations on Pod + # @section -- AI Worker podAnnotations: {} + # -- Labels on Pod + # @section -- AI Worker podLabels: {} imaginary: From 081b74126e2caed97dc8ceb56bf67cee59cfb86e Mon Sep 17 00:00:00 2001 From: WrenIX Date: Wed, 12 Feb 2025 16:25:13 +0100 Subject: [PATCH 13/14] fix: move volumes to helpers Signed-off-by: WrenIX --- charts/nextcloud/templates/_helpers.tpl | 50 ++++++++++++++++--- ...extcloud-ai-worker.yaml => ai-worker.yaml} | 47 +---------------- charts/nextcloud/templates/deployment.yaml | 26 +--------- 3 files changed, 47 insertions(+), 76 deletions(-) rename charts/nextcloud/templates/{nextcloud-ai-worker.yaml => ai-worker.yaml} (58%) diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index 5efea5d1..ac71aa6e 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -343,6 +343,39 @@ Swift as primary object store env vars {{- end -}} +{{/* +Volumes for a pod, which needs access to nextcloud data. +*/}} +{{- define "nextcloud.volumes" -}} +- name: nextcloud-main + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} + {{- else }} + emptyDir: {} + {{- end }} +{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} +- name: nextcloud-data + persistentVolumeClaim: + claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} +{{- end }} +{{- if .Values.nextcloud.configs }} +- name: nextcloud-config + configMap: + name: {{ template "nextcloud.fullname" . }}-config +{{- end }} +{{- if .Values.nextcloud.phpConfigs }} +- name: nextcloud-phpconfig + configMap: + name: {{ template "nextcloud.fullname" . }}-phpconfig +{{- end }} +{{- with .Values.nextcloud.extraVolumes }} +{{- toYaml . }} +{{- end }} +{{- end -}} + + + {{/* Create volume mounts for the nextcloud container as well as the cron sidecar container. */}} @@ -374,11 +407,13 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con - name: nextcloud-main mountPath: /var/www/html/themes subPath: {{ ternary "themes" (printf "%s/themes" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} + {{- range $key, $value := .Values.nextcloud.configs }} - name: nextcloud-config mountPath: /var/www/html/config/{{ $key }} subPath: {{ $key }} -{{- end }} +{{- end }}{{/* end-range configs */}} + {{- if .Values.nextcloud.configs }} {{- range $key, $value := .Values.nextcloud.defaultConfigs }} {{- if $value }} @@ -387,14 +422,17 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con subPath: {{ $key }} {{- end }} {{- end }} -{{- end }} -{{- if .Values.nextcloud.extraVolumeMounts }} -{{ toYaml .Values.nextcloud.extraVolumeMounts }} -{{- end }} +{{- end }}{{/* end-if .configs (also defaultConfigs beside config, see above) */}} + +{{- with .Values.nextcloud.extraVolumeMounts }} +{{ toYaml . }} +{{- end }}{{/* end-with extraVolumes*/}} + {{- $nginxEnabled := .Values.nginx.enabled -}} {{- range $key, $value := .Values.nextcloud.phpConfigs }} - name: nextcloud-phpconfig mountPath: {{ $nginxEnabled | ternary (printf "/usr/local/etc/php-fpm.d/%s" $key | quote) (printf "/usr/local/etc/php/conf.d/%s" $key | quote) }} subPath: {{ $key }} -{{- end }} +{{- end }}{{/* end-range phpconfig (with nginx) */}} + {{- end -}} diff --git a/charts/nextcloud/templates/nextcloud-ai-worker.yaml b/charts/nextcloud/templates/ai-worker.yaml similarity index 58% rename from charts/nextcloud/templates/nextcloud-ai-worker.yaml rename to charts/nextcloud/templates/ai-worker.yaml index 95508355..ccbb87d7 100644 --- a/charts/nextcloud/templates/nextcloud-ai-worker.yaml +++ b/charts/nextcloud/templates/ai-worker.yaml @@ -70,50 +70,7 @@ spec: {{- toYaml .Values.aiWorker.resources | nindent 12 }} volumeMounts: {{- include "nextcloud.volumeMounts" . | trim | nindent 12 }} - {{- range $hook, $shell := .Values.nextcloud.hooks }} - {{- if $shell }} - - name: nextcloud-hooks - mountPath: /docker-entrypoint-hooks.d/{{ $hook }}/helm.sh - subPath: {{ $hook }}.sh - readOnly: true - {{- end }} - {{- end }} volumes: - - name: nextcloud-main - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} - {{- else }} - emptyDir: {} - {{- end }} - {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - - name: nextcloud-data - persistentVolumeClaim: - claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} - {{- end }} - {{- if .Values.nextcloud.configs }} - - name: nextcloud-config - configMap: - name: {{ template "nextcloud.fullname" . }}-config - {{- end }} - {{- if .Values.nextcloud.phpConfigs }} - - name: nextcloud-phpconfig - configMap: - name: {{ template "nextcloud.fullname" . }}-phpconfig - {{- end }} - {{- if .Values.nginx.enabled }} - - name: nextcloud-nginx-config - configMap: - name: {{ template "nextcloud.fullname" . }}-nginxconfig - {{- end }} - {{- if not (values .Values.nextcloud.hooks | compact | empty) }} - - name: nextcloud-hooks - configMap: - name: {{ template "nextcloud.fullname" . }}-hooks - defaultMode: 0o755 - {{- end }} - {{- with .Values.nextcloud.extraVolumes }} - {{- toYaml . | nindent 8 }} - {{- end }} + {{- include "nextcloud.volumes" . | trim | nindent 8 }} restartPolicy: Always -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index b3ada72e..bf94899f 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -348,28 +348,7 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - - name: nextcloud-main - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ if .Values.persistence.existingClaim }}{{ .Values.persistence.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud{{- end }} - {{- else }} - emptyDir: {} - {{- end }} - {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - - name: nextcloud-data - persistentVolumeClaim: - claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template "nextcloud.fullname" . }}-nextcloud-data{{- end }} - {{- end }} - {{- if .Values.nextcloud.configs }} - - name: nextcloud-config - configMap: - name: {{ template "nextcloud.fullname" . }}-config - {{- end }} - {{- if .Values.nextcloud.phpConfigs }} - - name: nextcloud-phpconfig - configMap: - name: {{ template "nextcloud.fullname" . }}-phpconfig - {{- end }} + {{- include "nextcloud.volumes" . | trim | nindent 8 }} {{- if .Values.nginx.enabled }} - name: nextcloud-nginx-config configMap: @@ -381,9 +360,6 @@ spec: name: {{ template "nextcloud.fullname" . }}-hooks defaultMode: 0o755 {{- end }} - {{- with .Values.nextcloud.extraVolumes }} - {{- toYaml . | nindent 8 }} - {{- end }} securityContext: {{- with .Values.securityContext }} {{- toYaml . | nindent 8 }} From 5e0abee5395c2250ea141ef8bdf0b71cba324c26 Mon Sep 17 00:00:00 2001 From: Daniel Hendricken Date: Sat, 22 Feb 2025 12:42:32 +0100 Subject: [PATCH 14/14] chore(ai-worker) added added test-case with values Signed-off-by: Daniel Hendricken --- .github/workflows/lint-test.yaml | 4 ++++ charts/nextcloud/templates/ai-worker.yaml | 4 ++-- charts/nextcloud/test-values/ai-worker.yaml | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 charts/nextcloud/test-values/ai-worker.yaml diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 382687fa..5eac21d0 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -95,6 +95,10 @@ jobs: helm_args: --namespace nextcloud --skip-clean-up --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/imaginary.yaml" test: true + # test the helm chart with ai-worker enabled + - name: AI-Worker Enabled + helm_args: --namespace nextcloud --helm-extra-set-args "--create-namespace --values charts/nextcloud/test-values/ai-worker.yaml" + steps: - name: Checkout uses: actions/checkout@v4 diff --git a/charts/nextcloud/templates/ai-worker.yaml b/charts/nextcloud/templates/ai-worker.yaml index ccbb87d7..09eba0e9 100644 --- a/charts/nextcloud/templates/ai-worker.yaml +++ b/charts/nextcloud/templates/ai-worker.yaml @@ -44,8 +44,6 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} securityContext: - {{- toYaml .Values.aiWorker.securityContext | nindent 8 }} - podSecurityContext: {{- toYaml .Values.aiWorker.podSecurityContext | nindent 8 }} initContainers: - name: wait-for-service @@ -66,6 +64,8 @@ spec: - "-c" - |- set -e; while true; do php occ background-job:worker -v -t 60 "OC\TaskProcessing\SynchronousBackgroundJob"; done + securityContext: + {{- toYaml .Values.aiWorker.securityContext | nindent 12 }} resources: {{- toYaml .Values.aiWorker.resources | nindent 12 }} volumeMounts: diff --git a/charts/nextcloud/test-values/ai-worker.yaml b/charts/nextcloud/test-values/ai-worker.yaml new file mode 100644 index 00000000..661e174e --- /dev/null +++ b/charts/nextcloud/test-values/ai-worker.yaml @@ -0,0 +1,21 @@ +podLabels: + workload: nextcloud +internalDatabase: + enabled: true +persistence: + enabled: true +aiWorker: + enabled: true + replicaCount: 1 + securityContext: + runAsUser: 33 + runAsGroup: 33 + runAsNonRoot: false + useHostName: false + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchLabels: + workload: nextcloud + topologyKey: "kubernetes.io/hostname" \ No newline at end of file