Skip to content

Adding an optional deployment to increase AI pickup speed #688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

kubeagon
Copy link

@kubeagon kubeagon commented Jan 23, 2025

Description of the change

The aim of this PR is to add the process described in increasing AI pickup speed in a simple but functional way to the helm-chart.

It functions similarly to the cronjob sidecar by mounting the volumes under nextcloud-main.

Benefits

The deployment is completely optional as it only has relevance to those who want to use the nextcloud-assistant or other AI integrations. Additionally this method allows for scaling by increasing the number of replicas of the deployment. (This is why I decided against using a container withing the main pod).

It makes use of the same image and volumes as the main nextcloud pod, so I don't think it will require additional maintenance unless something about how AI Tasks are handled changes in the future. Maybe we won't even need this anymore who knows :)

Possible drawbacks

None that I can think of.

Applicable issues

I didn't find any open issues concerning this functionality.

Additional information

I created a modified version of the nextcloud.volumeMounts helper template to reduce the required volumes that need to be mounted to the pods as much as possible.

Checklist

dependabot bot and others added 4 commits January 23, 2025 21:20
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](helm/chart-testing-action@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] <[email protected]>
Signed-off-by: Daniel Hendricken <[email protected]>
Copy link
Member

@provokateurin provokateurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle this is a good idea, but the entire system is shifting away from being cron based, so I don't know how much sense it makes to add this now.

@kubeagon
Copy link
Author

kubeagon commented Jan 23, 2025

Alright no worries, I add these workers per kustomization myself at the moment. Works like a charm. I made the PR because I thought it might increase the ease of use for others that decide to use the assistant.

Ah and I forgot to mention that I tested it with both the apache and fpm-alpine images.

Copy link
Collaborator

@wrenix wrenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good first try.

volumeMounts:
{{- include "aiWorker.volumeMounts" . | trim | nindent 12 }}
volumes:
- name: nextcloud-main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should we move that into _helpers.tpl and reuse it with deployment of nextcloud.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So then we would divide the nextcloud.volumeMounts into for example:

  • nextcloud.volumeMounts
  • nextcloud.configMounts

Then include both for the nextcloud deployment and only nextcloud.volumeMounts for the ai-worker deployment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean to create a new one with nextcloud.volumes like i have done with: c7a0bc7



{{/*
Create volume mounts for the nextcloud-aiworker container.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it needed without the defaultConfigs and configs like in nextcloud.volumeMounts ?

I believe we should use the same setup then in the main deployment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that the required config is written to disk by the main deployment. As the ai-worker deployment is dependent on the main deployment being ready I thought mounting them would be unnecessary.

Copy link
Collaborator

@wrenix wrenix Jan 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all config are written down. The mounted one are read-only in the configmaps / secrets. So I believe you still need them.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright then I will make the adjustment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, now it uses nexcloud.volumeMounts. I also corrected some of the templating logic for the init-container.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you correct on templating logic?

…me suffix '-ai-worker'

Signed-off-by: Daniel Hendricken <[email protected]>

chore(ai-worker): changed componant label to ai-worker and removed name suffix '-ai-worker'
@kubeagon
Copy link
Author

kubeagon commented Feb 6, 2025

Hello, this is still on my todo list, I've been rather busy lately. I think I might have time on saturday to implement the suggested changes.

@kubeagon kubeagon requested a review from wrenix February 8, 2025 10:16
Signed-off-by: Daniel Hendricken <[email protected]>

chore: uncommented dependencies in Chart.yaml
@kubeagon
Copy link
Author

kubeagon commented Feb 8, 2025

I can provide the values I used to test, if that's helpful.

@wrenix wrenix force-pushed the main branch 2 times, most recently from b47e79a to c7a0bc7 Compare February 12, 2025 15:25
Copy link
Collaborator

@wrenix wrenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Could you check if my changes works?

  2. And maybe add your test-values in an test?

@kubeagon
Copy link
Author

  1. Could you check if my changes works?

    1. And maybe add your test-values in an test?

Tested your changes and added a test-case with values. Works like a charm :)

image

@kubeagon kubeagon requested a review from wrenix February 22, 2025 11:46
Copy link
Collaborator

@wrenix wrenix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the codequality is nice, now. (i rebase is needed to current nextcloud main).

What do you think @provokateurin ?

@wrenix wrenix requested a review from provokateurin February 24, 2025 11:10
- 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 }};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not know if it is better:

Suggested change
until curl -sf {{- if .Values.aiWorker.useHostName }}https://{{ .Values.nextcloud.host }}/status.php{{- else }}http://{{ template "nextcloud.fullname" . }}:{{ .Values.service.port }}/status.php{{- end }};
until curl -sf {{ ternary (printf "https://%s/status.php" .Values.nextcloud.host ) (printf "http://%s:%d/status.php" (template "nextcloud.fullname" .) .Values.service.port) .Values.aiWorker.useHostName }};

@kubeagon
Copy link
Author

I'll rebase once the we agree on the changes. I didn't get a chance to check your suggested change yet.

@wrenix wrenix added the 0. Needs triage Pending approval or rejection. This issue is pending approval. label Mar 22, 2025
Signed-off-by: Daniel Hendricken <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending approval or rejection. This issue is pending approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants