func()

in internal/controller/teamcity_controller.go [159:172]


func (r *TeamcityReconciler) finalizeTeamCity(ctx context.Context, teamcity *TeamCity) error {
	log := log.FromContext(ctx)
	isOngoingUpdate := ongoingZeroDowntimeUpgrade(r, ctx, teamcity)
	if isOngoingUpdate {
		log.V(1).Info("Detected ongoing zero-downtime update. Cleaning up TeamCity's checkpoint object")
		currentCheckpoint := checkpoint.NewCheckpoint(r.Client, *teamcity)
		err := currentCheckpoint.Delete(ctx)
		if err != nil {
			return err
		}
	}
	log.V(1).Info("Ran finalizers TeamCity object successfully")
	return nil
}