fix(loader): Allows multiple protocols on one port

This commit is contained in:
2025-12-26 11:05:12 +01:00
parent 890dcca877
commit 2fbb22f658
2 changed files with 19 additions and 1 deletions

View File

@ -116,7 +116,11 @@ func toServicePortConfigsMap(s any) (map[any]any, error) {
}
m := map[any]any{}
for _, p := range ports {
m[p.Published] = p
protocol := "tcp"
if p.Protocol != "" {
protocol = p.Protocol
}
m[fmt.Sprintf("%d%s", p.Published, protocol)] = p
}
return m, nil
}

View File

@ -848,6 +848,8 @@ func TestLoadMultipleConfigs(t *testing.T) {
"ports": []any{
"8080:80",
"9090:90",
"53:53/tcp",
"53:53/udp",
},
"labels": []any{
"foo=bar",
@ -925,6 +927,18 @@ func TestLoadMultipleConfigs(t *testing.T) {
},
},
Ports: []types.ServicePortConfig{
{
Mode: "ingress",
Target: 53,
Published: 53,
Protocol: "tcp",
},
{
Mode: "ingress",
Target: 53,
Published: 53,
Protocol: "udp",
},
{
Target: 81,
Published: 8080,