senthilrch / kube-fledged

A kubernetes operator for creating and managing a cache of container images directly on the cluster worker nodes, so application pods start almost instantly
Apache License 2.0
1.26k stars 119 forks source link

feat: allow image list to be empty #210

Open konturn opened 1 year ago

konturn commented 1 year ago

My use case involves initializing an ImageCache resource out of band, and then having a separate service dynamically add and remove images from the cache. As part of this, I think it would be nice to have the option to initialize the ImageCache resource with CacheSpecs with empty Images lists.

senthilrch commented 1 year ago

This would be a useful feature.

The PR doesn't addresses actions taken by the controller on such ImageCache resources + the status update for such resources.

konturn commented 1 year ago

Is there any further change to the controller logic required? It looks like the loop here already accounts for the possibility of an empty image list.

senthilrch commented 1 year ago

The ImageCache status is updated to Processing in below code:- https://github.com/senthilrch/kube-fledged/blob/aadfdcd2648475be4d3159122aea3c24fd7c5f36/cmd/controller/app/controller.go#L507

If the ImageCache CR has an empty image list, the CR will get stuck in the Processing status. So updating the status should be skipped when image list is empty.

senthilrch commented 1 year ago

A more robust solution for this use case would be to implement something on the lines of Pod scheduling gates introduced in K8s 1.26.

https://kubernetes.io/blog/2022/12/26/pod-scheduling-readiness-alpha/

konturn commented 1 year ago

Ah I see--okay, I'll go ahead and make the necessary changes to the status processing logic