cli/compose/loader: don't drop tcp port when udp uses same published port#7106
Open
UditDewan wants to merge 1 commit into
Open
cli/compose/loader: don't drop tcp port when udp uses same published port#7106UditDewan wants to merge 1 commit into
UditDewan wants to merge 1 commit into
Conversation
…port When merging multiple compose files, ports were keyed only by their published port, so a service publishing the same port on both tcp and udp (e.g. "443:443" and "443:443/udp") silently lost one of the two entries during the merge, even when the override file did not define any ports. Include the protocol in the merge key, treating an omitted protocol as tcp (the default for the long syntax), and make the merged order deterministic when the same published port is used for both protocols. Fixes docker#6223 Signed-off-by: uditDewan <udit.dewan21@gmail.com>
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.
- What I did
Fixed
docker stack config/docker stack deploysilently dropping a port entry when merging multiple compose files where a service publishes the same port on both tcp and udp (e.g.443:443and443:443/udp). The entry was lost even when the override file did not define any ports.Fixes #6223
- How I did it
During merge, ports were indexed by their published port only, so the tcp and udp entries for the same published port collided and the later one overwrote the earlier one. The merge key now includes the protocol (an omitted protocol is treated as tcp, matching the long-syntax default), and the sort of the merged result uses the protocol as a tie-breaker so the output order is deterministic.
- How to verify it
docker stack config -c compose.yaml -c compose.override.yamlnow returns all three ports; previously the443:443/tcpentry was missing. Regression tests added incli/compose/loader/merge_test.go(go test ./cli/compose/loader/ -run TestLoadMultipleServicePorts).- Human readable description for the release notes