Skip to content

Commit

Permalink
fix: defer kube deployment deletion (#2646)
Browse files Browse the repository at this point in the history
We don't want to do this on startup, as we may not have all deployments
yet.
  • Loading branch information
stuartwdouglas authored Sep 11, 2024
1 parent 6bbcce8 commit 2583a7a
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions backend/controller/scaling/k8sscaling/deployment_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ func (r *DeploymentProvisioner) HandleSchemaChange(ctx context.Context, msg *ftl
return err
}
func (r *DeploymentProvisioner) handleSchemaChange(ctx context.Context, msg *ftlv1.PullSchemaResponse) error {
if !msg.More {
defer r.deleteMissingDeployments(ctx)
}
if msg.DeploymentKey == "" {
// Builtins don't have deployments
return nil
Expand Down Expand Up @@ -130,13 +127,8 @@ func (r *DeploymentProvisioner) handleSchemaChange(ctx context.Context, msg *ftl
}
case ftlv1.DeploymentChangeType_DEPLOYMENT_REMOVED:
delete(r.KnownModules, msg.ModuleName)
if deploymentExists {
logger.Infof("deleting deployment %s", msg.ModuleName)
err := deploymentClient.Delete(ctx, msg.ModuleName, v1.DeleteOptions{})
if err != nil {
return fmt.Errorf("failed to delete deployment %s: %w", msg.ModuleName, err)
}
}
logger.Infof("removing deployment %s", msg.ModuleName)
r.deleteMissingDeployments(ctx)
}
return nil
}
Expand Down

0 comments on commit 2583a7a

Please sign in to comment.