Repository navigation
[eno][tombstone-recovery 5/7] Record Ready-synthesis inventories as Secrets - #661
Ruinan Liu (ruinan-liu) wants to merge 8 commits into
Conversation
3a8ed81 to
d928400
Compare
cf3920f to
214fa64
Compare
| if !inventory.complete { | ||
| continue | ||
| } | ||
| if selected == nil || inventory.synthesized.After(selected.synthesized) { |
There was a problem hiding this comment.
selectNewestCompleteInventory only replaces the selected inventory when inventory.synthesized.After(selected.synthesized). If two complete snapshots have the same inventorySynthesizedAnnotation, the selected inventory depends on map/slice iteration order. This is plausible because timestamps are stored with time.RFC3339, which drops sub-second precision, so two syntheses in the same second become indistinguishable.
There was a problem hiding this comment.
Thanks for flagging this. A tie should be extremely unlikely: both syntheses must become Ready and have their inventories recorded within the same Synthesized second. A crash before cleanup can extend how long both snapshots coexist, but does not make a timestamp tie more likely.
Even if a tie occurs, either complete snapshot is safe. Recovery only creates tombstones for identities absent from the current synthesis, so it cannot remove currently wanted resources; selecting the older snapshot may only miss some cleanup. Treating the tie as InventoryInvalid would skip recovery entirely, which is less useful than either snapshot.
|
The secret or configmap has 1mb size limit. Does control-plane-core beyond this limit? I think it doesn't because we only store meta data. |
| inventories := make([]synthesisInventory, 0, len(secretsBySynthesisUUID)) | ||
| for synthesisUUID, inventorySecrets := range secretsBySynthesisUUID { | ||
| // Chunks of one synthesis are written together, so any chunk carries the snapshot timestamp. | ||
| synthesized, err := inventorySynthesized(&inventorySecrets[0]) |
There was a problem hiding this comment.
groupInventorySecretsBySynthesisUUID reads inventorySynthesizedAnnotation from inventorySecrets[0] and assumes all chunks for that synthesis share it. orderInventoryChunks validates index/count completeness but not that source metadata is consistent across chunks. A mixed/corrupted chunk set with the same synthesis UUID and consistent count can be treated as one complete snapshot even if chunks disagree on synthesized time.
Suggested fix: while ordering chunks, verify all chunks in the synthesis group have the same synthesized timestamp and expected labels/annotations, not just matching chunk count.
There was a problem hiding this comment.
Hey Allan, all chunks for a synthesis UUID are written fro mthe same Synthesized value under UUID-specific names, and writeInventoryChunck errors if an existing Secret's content don't match. So mismatched chunks can only come from someone manually editing the inventory Secrets in Kube-system so it should be covered once we merge the planned admission-policy followup
Yes, you are right. It won't hit the limit. Inventory only stores resource identity (group/version/kind/namespace/name), labels and the |
Ruinan Liu (ruinan-liu)
left a comment
There was a problem hiding this comment.
reply to comment
Summary
Add inventory recording to the tombstone recovery controller. Once an eligible Composition's current synthesis is Ready, save its resource inventory as Secrets in the downstream cluster's
kube-systemnamespace.Switch recovery from ConfigMap inventories to Secret snapshots.
Behavior
<comp-name>-<inventory-lineage>-<chunk-index>.[].Recovery and Safety
InventoryInvalid; do not generate tombstones from ambiguous history.Limitations and Scope