-
Notifications
You must be signed in to change notification settings - Fork 159
Add reconcile deployment job and River observability middleware #8093
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
Conversation
81ad2d7 to
63a5352
Compare
a532425 to
f4526b1
Compare
| case database.DeploymentStatusRunning: | ||
| // Check current status to either start or update the deployment | ||
| if depl.Status == database.DeploymentStatusRunning { | ||
| // Update the deployment status to updating | ||
| depl, err = w.admin.DB.UpdateDeploymentStatus(ctx, depl.ID, database.DeploymentStatusUpdating, "Updating...") | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // Update the deployment by updating its runtime instance and resources. | ||
| err := w.admin.UpdateDeploymentInner(ctx, depl) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| } else { | ||
| // Update the deployment status to pending | ||
| depl, err = w.admin.DB.UpdateDeploymentStatus(ctx, depl.ID, database.DeploymentStatusPending, "Provisioning...") | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // Initialize the deployment (by provisioning a runtime and creating an instance on it) | ||
| err := w.admin.StartDeploymentInner(ctx, depl) | ||
| if err != nil { | ||
| return err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the DeploymentStatusError need special handling here? Or is it safe to call StartDeploymentInner for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No special handling needed, it's safe since we go through the whole idempotent provisioning flow in StartDeploymentInner without assuming anything is already provisioned or otherwise healthy.
begelundmuller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This PR adds a background reconcile job for deployments and removes all automatic project resets.
There's also a new River queue middleware added for better observability instrumentation of the background jobs.
Checklist: