Skip to content

feat: allow image list to be empty#210

Open
konturn wants to merge 1 commit intosenthilrch:masterfrom
konturn:master
Open

feat: allow image list to be empty#210
konturn wants to merge 1 commit intosenthilrch:masterfrom
konturn:master

Conversation

@konturn
Copy link
Copy Markdown

@konturn konturn commented Mar 31, 2023

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
Copy link
Copy Markdown
Owner

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
Copy link
Copy Markdown
Author

konturn commented Apr 3, 2023

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
Copy link
Copy Markdown
Owner

The ImageCache status is updated to Processing in below code:-

if err = c.updateImageCacheStatus(imageCache, status); err != nil {

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
Copy link
Copy Markdown
Owner

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
Copy link
Copy Markdown
Author

konturn commented Apr 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants