fix: prevent layer overwrites in image resulting in BLOB_UNKNOWN error #230
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.


Copied from coder/kaniko#35
Fixes GoogleContainerTools/kaniko#3431
Description
After enabling image streaming, we experienced issues in GCP with pods failing to start with the error message
See https://cloud.google.com/kubernetes-engine/docs/troubleshooting/known-issues#image-screaming-too-many-links
This error was caused by duplicated layers in the image, specifically empty layers in the form
Prior to v1.25.0 our kaniko implementation was targetting legacy docker, which means we avoided emitting empty layers altogether. So we were able to workaround the above issue by kaniko not emitting those layers. But starting in v1.25.0 our target implementation was switched to buildkit #81 This means empty layers are now emitted and there is no way for the user to deactivate this behaviour.
I'm not sure this is the best solution, as there is the very very slim chance for a hash collision and therefore confusion of layers. I have not yet investigated how buildkit handles this situation, but in our deployment this approach resolves the issue at hand.
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Reviewer Notes
Release Notes
Describe any changes here so maintainer can include it in the release notes, or delete this block.