Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces quite significant changes in how
Pod -> Container -> Container_{*}
are synced. Namely, all container related, likeContainerDevices
,ContainerMounts
etc. are now no longer pod event driven being synced, but rather the respective containers. Specifically, this means that the containers themselves are no longer allowed to be automatically deleted cascading. Instead, the container events are now processed separately. Towards this end, this PR introduces two new sync channelsupsertPods
anddeletePods
. These operate roughly like the following:main()
invokes theschemav1#SyncContainers()
function and passes through the two new chans, which are then polled simultaneously.For all uploaded
v1.Pod
s, this function goes over each of their containers and schedules/cancels the container log synchronisation depending on the container state. These jobs are currently rescheduled every 5 minutes for each individual container and are allowed to run a maximum of60
jobs at a time. These numbers are randomly chosen by me and will certainly change or become configurable in the future.However, for all deleted
v1.Pod
s, the flow control looks a bit different. Since we are just passing through the entity checksums for all the deletion streams, we first need to load all the containers for each streamed pod ID from the database. This process is done concurrently for each pod ID, and thereafter the containers are passed to the next stage where the deletion stream is triggered for them. This deletion process first removes all container references such asContainer_{device, mounts, logs}
from the database before deleting the container itself.