Skip to content
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

Feature/kube event listener #114

Merged
merged 27 commits into from
Dec 15, 2023
Merged

Conversation

sandstromviktor
Copy link
Contributor

@sandstromviktor sandstromviktor commented Nov 29, 2023

Description

As you know, the current functionality for updating the app status is far from optimal. This PR proposes a remake of this functionality by introducing an event listener. Instead of asking K8s if there has been a change, we now receive notifications that a change has been made.

The event listener is added as a celery task and fires up when celery is ready. It updates the appinstance state if a change has been made that either changed the state or if the app was deleted.

I've tested it and it works

  • Locally using docker compose
  • Locally using Helm
  • On serve-dev

Checklist

If you're unsure about any of the items below, don't hesitate to ask. We're here to help!
This is simply a reminder of what we are going to look for before merging your code.

  • This pull request is against develop branch (not applicable for hotfixes)
  • I have included a link to the issue on GitHub or JIRA (if any)
  • I have included migration files (if there are changes to the model classes)
  • I have included, reviewed and executed tests (unit and end2end) to complement my changes
  • I have updated the related documentation (if necessary)
  • I have updated the release notes (releasenotes.md)
  • I have added a reviewer for this pull request
  • I have added myself as an author for this pull request
  • In the case I have modified settings.py, then I have also updated the studio-settings-configmap.yaml file in serve-charts

Further comments

Anything else you think we should know before merging your code!

@sandstromviktor sandstromviktor added the new feature A new feature label Nov 29, 2023
@sandstromviktor sandstromviktor requested a review from a team November 29, 2023 12:02
@sandstromviktor sandstromviktor self-assigned this Nov 29, 2023
@sandstromviktor sandstromviktor marked this pull request as ready for review November 30, 2023 09:53
apps/views.py Outdated Show resolved Hide resolved
apps/tasks.py Outdated Show resolved Hide resolved
apps/tasks.py Outdated Show resolved Hide resolved
apps/tasks.py Show resolved Hide resolved
apps/tasks.py Outdated Show resolved Hide resolved
apps/tasks.py Outdated Show resolved Hide resolved
apps/tasks.py Show resolved Hide resolved
apps/tasks.py Show resolved Hide resolved
apps/tasks.py Show resolved Hide resolved
@sandstromviktor sandstromviktor requested review from churnikov and a team December 1, 2023 08:22
Copy link
Contributor

@churnikov churnikov left a comment

Choose a reason for hiding this comment

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

Other than two comments, lgtm

apps/tasks.py Outdated Show resolved Hide resolved
apps/tasks.py Show resolved Hide resolved
_ = delete_and_deploy_resource.delay(appinstance.pk, new_release_name)
else:
# Otherwise, we update the resources in the same helm release
_ = deploy_resource.delay(appinstance.pk, "update")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I haven't tested this yet but .delay() here is supposed to add this as a task in the queue for celery and not using it might just run it in the studio pod instead. Would be good to test if this is the case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It adds the task to celery anyways, but the delay function just applies it asynchronously. But we should add delay here again. This is a mistake.

@sandstromviktor sandstromviktor merged commit 321d147 into develop Dec 15, 2023
2 checks passed
@sandstromviktor sandstromviktor deleted the feature/kube-event-controller branch December 15, 2023 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants