coder / coder/internal

prebuilds: hold off preset reconciliation in case of pending / canceled jobs

Aperta
#742 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
3
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

# Problem:

Given a template with multiple presets where one of these presets maps to a tagset defined via `coder_workspace_tags` that is not serviceable by any provisioner, example:

```
provider "coder" {}
data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

variable "cluster" {
type = string
default = "a"
}

data "coder_parameter" "cluster" {
name = "cluster"
type = "string"
default = var.cluster
}

data "coder_workspace_tags" "tags" {
tags = {
"cluster": data.coder_parameter.cluster.value
}
}

resource "null_resource" "foo" {}

data "coder_workspace_preset" "a" {
default = true
name = "a"
parameters = {
(data.coder_parameter.cluster.name) = "a"
}
prebuilds {
instances = 1
}
}

data "coder_workspace_preset" "doesnotexist" {
name = "doesnotexist"
parameters = {
(data.coder_parameter.cluster.name) = "doesnotexist"
}
prebuilds {
instances = 1
}
}

```

When you enable prebuilds on the preset `doesnotexist`, the provisioner jobs created by that preset will remain in a pending state, as expected.

If an admin cancels this job manually, the reconciler will create another.
If the job reaper cancles this job automatically, the reconciler will create another.

It's possible for this to continue indefinitely resulting in a large number of prebuilds that have to be cleaned up manually.

![Image](https://github.com/user-attachments/assets/4addc788-2f95-48ef-8aeb-ac1678ea28df)

# Suggested solution

Cancelling a workspace build is a good sign that something is wrong with the preset and needs to be manually investigated. The reconciler should check for this state and avoid creating new builds for a preset in this case.

cc @SasSwart

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia individuando il prebuild reconciler e la gestione dei provisioner jobs in attesa, annullati e recuperati descritta nell’issue. Verifica il comportamento con la configurazione fornita con più preset e tag non servibili; il lavoro è completato quando una build annullata impedisce al reconciler di crearne un’altra per quel preset.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
terraform
Ambito
devops, infrastructure
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.