chore: initialize containerized Go learning workbook (2026 DevOps/SRE)
This commit is contained in:
commit
84be3e5d77
64 files changed
+1382
No files matched your search
@@ -0,0 +1,18 @@
|
||||
# 04 — Mini-Reconciler w stylu Operatorów Kubernetes
|
||||
|
||||
Sercem każdego operatora Kubernetes jest **pętla uzgadniania (*reconciliation loop*)**:
|
||||
1. Odczytaj stan pożądany (*Desired State*) i stan aktualny (*Actual State*).
|
||||
2. Oblicz różnicę i wykonaj idempotentne akcje naprawcze (skalowanie w górę / w dół).
|
||||
3. Jeśli stan się zgadza — nie rób nic (*no-op*).
|
||||
|
||||
## Zadania (`reconciler.go`)
|
||||
Zaimplementuj `Reconcile(desired, actual int, actions Scaler) (int, error)`:
|
||||
* Gdy `actual < desired` -> wywołaj `actions.ScaleUp(desired - actual)` i zwróć `desired`.
|
||||
* Gdy `actual > desired` -> wywołaj `actions.ScaleDown(actual - desired)` i zwróć `desired`.
|
||||
* Gdy `actual == desired` -> nie wywołuj nic i zwróć `actual, nil`.
|
||||
* Gdy `desired < 0` -> zwróć błąd `ErrNegativeReplicas`.
|
||||
|
||||
## Uruchomienie testów
|
||||
```bash
|
||||
make test PKG=./exercises/03-ecosystems/04-k8s-style-reconciler
|
||||
```
|
||||
Reference in new issue
Block a user