fix(docker): wildcard labels not applying properly for YAML style values and alias without labels

This commit is contained in:
yusing
2025-06-13 23:02:25 +08:00
parent 880d66c75e
commit f8c57d930f
4 changed files with 113 additions and 27 deletions

View File

@@ -124,7 +124,7 @@ func (p *DockerProvider) routesFromContainerLabels(container *docker.Container)
errs := gperr.NewBuilder("label errors")
m, err := docker.ParseLabels(container.Labels)
m, err := docker.ParseLabels(container.Labels, container.Aliases...)
errs.Add(err)
for alias, entryMapAny := range m {

View File

@@ -4,7 +4,6 @@ import (
"testing"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
D "github.com/yusing/go-proxy/internal/docker"
@@ -319,7 +318,7 @@ func TestStreamDefaultValues(t *testing.T) {
},
},
},
Ports: []types.Port{
Ports: []container.Port{
{Type: "udp", PrivatePort: privPort, PublicPort: pubPort},
},
}
@@ -372,7 +371,7 @@ func TestImplicitExcludeDatabase(t *testing.T) {
t.Run("exposed port detection", func(t *testing.T) {
r, ok := makeRoutes(&container.SummaryTrimmed{
Names: dummyNames,
Ports: []types.Port{
Ports: []container.Port{
{Type: "tcp", PrivatePort: 5432, PublicPort: 5432},
},
})["a"]