Skip to content

Commit

Permalink
tmp - adding generation/observedGeneration stuff
Browse files Browse the repository at this point in the history
Signed-off-by: Yoni Bettan <[email protected]>
  • Loading branch information
ybettan committed Oct 7, 2024
1 parent e897088 commit 239e675
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions docs/enhancements/0002-container-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ at ~100% automation for handlering images - everything the cluster does when pul

The new CRD will hold information regarding the existance of images mentioned in `Module` objects.
The cluster will contain a single `ModuleImagesConfig` per `Module` in the cluster.
The `generation` and `observedGeneration` are used to trigger the `ModuleImagesConfig` controller in some cases.

```yaml
apiVersion: kmm.sigs.x-k8s.io/v1beta1
kind: ModuleImagesConfig
metadata:
...
generation: 1 # default value
...
spec:
items:
- image: registry.example.com/org/kmod1:kver
Expand All @@ -50,6 +53,7 @@ spec:
...
- image: registry.example.com/org/kmod3:kver
status
obserevedGeneration: 1
items:
- image: registry.example.com/org/kmod1:kver
status: Exists
Expand All @@ -59,7 +63,8 @@ status
### Module-NMC controller's changes
* The only controller creating `ModuleImagesConfig` objects - one per `Module`
* The only controller creating or modifying `ModuleImagesConfig` objects - one per `Module`
* On the first creation the `generation` is set to `1` and increased by one on each `Module` reconciliation.
* Checking `ModuleImagesConfig`'s status to determine whether the defined image exists in the image
repository or not.
* Continues to create `NodeModulesConfig` objects as before.
Expand All @@ -84,16 +89,23 @@ flowchart TD
flowchart TD
MIC((ModuleImagesConfig)) -->|Reconcile| MICC(MIC controller)
MICC --> |Image has no status| J1((.))
J1 --> |No pull pod| POD((Pull Pod)) --> DONE(((Done)))
J1 --> |Pull pod exists| J2((.))
J2 --> |Succeed| A1{{Update status to 'Exists'}} --> DONE
J2 --> |Failed| A2{{Update status to 'DoesNotExist'}} --> DONE
J2 --> |Succeed| A1{{Update status to 'Exists' && observedGeneration++}}
A1 --> DELETE{{Delete the pod}}
DELETE --> DONE(((Done)))
J2 --> |Failed| A2{{Update status to 'DoesNotExist' && observedGeneration++}}
A2 --> DELETE
J1 --> |No pull pod| POD((Pull Pod)) --> DONE
MICC --> |status='Exists'| DONE
MICC --> |status='DoesNotExist'| J3((.))
J3 --> |Failed build pod exists or no build section| J4((.))
J4 --> |Succeed| A3{{Update status to 'Exists'}} --> DONE
J4 --> |Failed| DONE
J3 --> |No build pod| BUILD((Build Pod)) --> DONE
J3 --> |'generation'!='observedGeneration'| J1
J3 --> |'generation'=='observedGeneration'| J6((.))
J6 --> |Build section exists| J7((.))
J7 --> |No build pod| BUILD((Build Pod)) --> DONE
J7 --> |Build pod exist| J8((.))
J8 --> |Succeed| A1{{Update status to 'Exists'}}
J8 --> |Failed| DONE
J6 --> |No build section| DONE
```

## Addressing goals
Expand Down

0 comments on commit 239e675

Please sign in to comment.