mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
@ -146,22 +146,21 @@ func (c Controller) reconcileTemplate(ctx context.Context, template database.Tem
|
||||
}
|
||||
|
||||
for _, result := range results {
|
||||
desired, actual, extraneous, inProgress := result.Desired, result.Actual, result.Extraneous, result.InProgress
|
||||
desired, actual, extraneous, starting, deleting := result.Desired, result.Actual, result.Extraneous, result.Starting, result.Deleting
|
||||
|
||||
// If the template has become deleted or deprecated since the last reconciliation, we need to ensure we
|
||||
// scale those prebuilds down to zero.
|
||||
if result.Deleted || result.Deprecated {
|
||||
if result.TemplateDeleted || result.TemplateDeprecated {
|
||||
desired = 0
|
||||
}
|
||||
|
||||
toCreate := math.Max(0, float64(desired-(actual+inProgress)))
|
||||
// TODO: we might need to get inProgress here by job type (i.e. create or destroy), then we wouldn't have this ambiguity
|
||||
toDestroy := math.Max(0, float64(extraneous-inProgress))
|
||||
toCreate := math.Max(0, float64(desired-(actual+starting)))
|
||||
toDestroy := math.Max(0, float64(extraneous-deleting))
|
||||
|
||||
c.logger.Info(innerCtx, "template prebuild state retrieved",
|
||||
slog.F("template_id", template.ID), slog.F("to_create", toCreate), slog.F("to_destroy", toDestroy),
|
||||
slog.F("desired", desired), slog.F("actual", actual),
|
||||
slog.F("extraneous", extraneous), slog.F("in_progress", inProgress))
|
||||
slog.F("extraneous", extraneous), slog.F("starting", starting), slog.F("deleting", deleting))
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user