Proxy returns 500 on image HEAD requests when CachedImage does not exist
dennislapchenko opened this issue · comments
![Image 2024-05-28 12 PM-11-02](https://private-user-images.githubusercontent.com/17194644/334344148-9f5d68e7-7f51-498d-898f-3acbf6211457.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNjU4MDYsIm5iZiI6MTcxOTA2NTUwNiwicGF0aCI6Ii8xNzE5NDY0NC8zMzQzNDQxNDgtOWY1ZDY4ZTctN2Y1MS00OThkLTg5OGYtM2FjYmY2MjExNDU3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDE0MTE0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmMjc5ZDVlZmRlMjFlOWY1OGE3NWQ0NTdmNjNiMjA1NzdhMTVlYjE0ODcwOGRjODlhOGZlMDJmZWI5MmUyNzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.WEnC29syKNWXuqa1nAOYeqePQ8MqB_kIdOYRCFw2bXs)
Currently have built own version which checks if image is cached during pod mutation, if not - no mutation happens. This solves gitlab job issues, but not sure if this is a solution that should be merged into master with a feature flag. LMK
Perhaps there is a more elegant solution to NOT return 500
to HEAD requests when image is going to be proxied from remote origin.
Your issue here is that there is no CachedImage for this repository, as the first line states. This is most probably because of your patch, indeed, if you don't mutate the pod, the CachedImage is not created, and with your patch, if it is not created, the pod is not mutated. So basically you just prevented kuik to ever work.
I'm closing the issue since the bug most probably comes from this patch. If you're sure it doesn't, feel free to re-open it with a minimal reproductible example.
@paullaffitte the log screenshot is before the patch. It does seem this 500 always happens on first image appearance.
But what you are saying is that without mutation, which includes new labels - the image never turns to CachedImage?
Is there a reason the (unpatched) controller is returning 500 on initial CachedImage nonexistence?
I will try to come up with an easily reproducible behaviour but it does seem any fresh image in the cluster produces this