         #log("output of '#{s}' -- ", stdout, stderr)
         cb?(err, stdout + stderr)
 
-# Start a project running
-kubectl_start_project = (project_id, cb) ->
-    log 'kubectl_start_project ', project_id
-    if projects[project_id].starting?
-        projects[project_id].starting.push(cb)
-        return
-    projects[project_id].starting = [cb]
+write_deployment_yaml_file = (project_id, cb) ->
     info = storage_server = disk_size = resources = preemptible = undefined
     async.series([
         (cb) ->


# get changed to true when we first run reconcile_all
_reconcile_ready = false
reconcile = (project_id) ->
    if not _reconcile_ready
        return
    x = projects[project_id]
    if x.run
        if not x.kubernetes? or x.kubernetes.DESIRED != '1'
            log("starting because x = ", x)
            kubectl_start_project(project_id)
    else
        if x.kubernetes.DESIRED == '1'
            log("stopping because x = ", x)
            kubectl_stop_project(project_id)

reconcile_all = () ->
    _reconcile_ready = true

            if x.new_val
                project_id = x.new_val.project_id
                z = projects[project_id] ?= {}
                changed = {}
                for field in FIELDS
                    if z[field] != x.new_val[field]
                        z[field] = x.new_val[field]
                        changed[field] = true
                if state == 'ready' and z['run'] and not changed.run and (changed.resources or changed.preemptible or changed.disk_size)
                    # Currently running with no change to run state.
                    # Something changed which can be done via editing the deployment using kubectl
                    kubectl_update_project(project_id)
                    return
            else if x.old_val  # no new value -- removed from changefeed result, so now false.
                project_id = x.old_val.project_id
                z = projects[project_id] ?= {}
