diff --git a/docs/enhancements/0002-container-runtime.md b/docs/enhancements/0002-container-runtime.md index 492c1ffee..d5a13d034 100644 --- a/docs/enhancements/0002-container-runtime.md +++ b/docs/enhancements/0002-container-runtime.md @@ -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 @@ -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 @@ -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. @@ -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