fix: deduplicate container ports by (port, protocol)

Compose files with both "8001" (TCP) and "8001/udp" produce separate
V1ContainerPort entries that k8s rejects as duplicates. Deduplicate
after parsing by (container_port, protocol) key.

This was blocking biscayne's agave deployment — the spec has both
TCP 8001 (ip_echo) and UDP 8001 (gossip), which generated two UDP
8001 entries.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pull/740/head
A. F. Dudley 2026-04-02 05:18:10 +00:00
parent ae1eae5b9b
commit 63325f68a7
1 changed files with 11 additions and 0 deletions

View File

@ -563,6 +563,17 @@ class ClusterInfo:
container_port=port, protocol=protocol container_port=port, protocol=protocol
) )
) )
# Deduplicate by (port, protocol) — compose files with
# both "8001" and "8001/udp" produce separate entries
# that k8s rejects as duplicates.
seen = set()
deduped = []
for cp in container_ports:
key = (cp.container_port, cp.protocol)
if key not in seen:
seen.add(key)
deduped.append(cp)
container_ports = deduped
if opts.o.debug: if opts.o.debug:
print(f"image: {image}") print(f"image: {image}")
print(f"service ports: {container_ports}") print(f"service ports: {container_ports}")