feat: include target path hash in generated file names to prevent naming collisions#511
Open
ShantKhatri wants to merge 4 commits into
Open
feat: include target path hash in generated file names to prevent naming collisions#511ShantKhatri wants to merge 4 commits into
ShantKhatri wants to merge 4 commits into
Conversation
…ing collisions Signed-off-by: Prashantkumar Khatri <khatri2105104@st.jmi.ac.in>
…ross container collisions Signed-off-by: Prashantkumar Khatri <khatri2105104@st.jmi.ac.in>
Signed-off-by: Prashantkumar Khatri <khatri2105104@st.jmi.ac.in>
fa41169 to
90b5b34
Compare
Contributor
Author
|
Hi @mathieu-benoit @chris-stephenson , I wanna mention that previously, if two different containers (e.g., By injecting both the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR updates the host filename generation logic in
convertFilesIntoVolumes()to ensure strict uniqueness for injected container files.Previously, the host filename was generated using only the workload name and the file's basename (
%s-files-%s). This PR updates the format to include both the container name and an 8-character SHA-256 hash of the full target path:fmt.Sprintf("%s-%s-files-%s-%s", workloadName, containerName, hash[:8], filepath.Base(target))All associated tests have been updated to expect this new filename format.
What does this PR do?
This change is required because the previous logic caused two severe silent overwrite bugs on the host filesystem:
/etc/app/config.yamland/opt/app/config.yaml, the identical basenames caused them to resolve to the same host filename and silently overwrite each other./etc/config.yaml, the absence of the container name in the host filename caused them to silently overwrite each other.By combining the container name and the path hash, we guarantee that no two file mounts will ever generate the same host filename, while keeping the basename visible for human readability when debugging.
Fixes #506
Types of changes
Checklist: