summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go.mod2
-rw-r--r--go.sum7
-rw-r--r--pkg/api/handlers/compat/containers.go29
-rw-r--r--vendor/modules.txt2
4 files changed, 25 insertions, 15 deletions
diff --git a/go.mod b/go.mod
index 47df9fecd..53c3fa8ef 100644
--- a/go.mod
+++ b/go.mod
@@ -64,7 +64,7 @@ require (
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299
gopkg.in/yaml.v2 v2.3.0
- k8s.io/api v0.18.4
+ k8s.io/api v0.18.5
k8s.io/apimachinery v0.18.5
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
)
diff --git a/go.sum b/go.sum
index a87652383..7e827b079 100644
--- a/go.sum
+++ b/go.sum
@@ -68,7 +68,6 @@ github.com/containernetworking/plugins v0.8.6 h1:npZTLiMa4CRn6m5P9+1Dz4O1j0UeFbm
github.com/containernetworking/plugins v0.8.6/go.mod h1:qnw5mN19D8fIwkqW7oHHYDHVlzhJpcY6TQxn/fUyDDM=
github.com/containers/buildah v1.15.0 h1:p9cYJwcQ5Fnv0iBeHAFwHR0K+kcv7LbyAjUtc+HjYsc=
github.com/containers/buildah v1.15.0/go.mod h1:j0AY2kWpmaOPPV5GKDJY9dMtekk5WMmMhcB+z0OW+vc=
-github.com/containers/common v0.14.0 h1:hiZFDPf6ajKiDmojN5f5X3gboKPO73NLrYb0RXfrQiA=
github.com/containers/common v0.14.0/go.mod h1:9olhlE+WhYof1npnMJdyRMX14/yIUint6zyHzcyRVAg=
github.com/containers/common v0.15.1 h1:ycIJf7ugHf0f2ag9uYFijQLbcrPu1KnOqdARgs2XbRU=
github.com/containers/common v0.15.1/go.mod h1:zJ/BLqK6INqFOCxN/gh9ae1qqWD/ghk2T0jAYqz/Xq4=
@@ -628,11 +627,9 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.0.0-20190620084959-7cf5895f2711/go.mod h1:TBhBqb1AWbBQbW3XRusr7n7E4v2+5ZY8r8sAMnyFC5A=
-k8s.io/api v0.18.4 h1:8x49nBRxuXGUlDlwlWd3RMY1SayZrzFfxea3UZSkFw4=
-k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=
+k8s.io/api v0.18.5 h1:fKbCxr+U3fu7k6jB+QeYPD/c6xKYeSJ2KVWmyUypuWM=
+k8s.io/api v0.18.5/go.mod h1:tN+e/2nbdGKOAH55NMV8oGrMG+3uRlA9GaRfvnCCSNk=
k8s.io/apimachinery v0.0.0-20190612205821-1799e75a0719/go.mod h1:I4A+glKBHiTgiEjQiCCQfCAIcIMFGt291SmsvcrFzJA=
-k8s.io/apimachinery v0.18.4 h1:ST2beySjhqwJoIFk6p7Hp5v5O0hYY6Gngq/gUYXTPIA=
-k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apimachinery v0.18.5 h1:Lh6tgsM9FMkC12K5T5QjRm7rDs6aQN5JHkA0JomULDM=
k8s.io/apimachinery v0.18.5/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/client-go v0.0.0-20190620085101-78d2af792bab h1:E8Fecph0qbNsAbijJJQryKu4Oi9QTp5cVpjTE+nqg6g=
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go
index b103e399d..5c76ab4f5 100644
--- a/pkg/api/handlers/compat/containers.go
+++ b/pkg/api/handlers/compat/containers.go
@@ -321,17 +321,17 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
stopTimeout := int(l.StopTimeout())
- ports := make(nat.PortSet)
- for p := range inspect.HostConfig.PortBindings {
- splitp := strings.SplitN(p, "/", 2)
+ exposedPorts := make(nat.PortSet)
+ for ep := range inspect.HostConfig.PortBindings {
+ splitp := strings.SplitN(ep, "/", 2)
if len(splitp) != 2 {
- return nil, errors.Errorf("PORT/PROTOCOL Format required for %q", p)
+ return nil, errors.Errorf("PORT/PROTOCOL Format required for %q", ep)
}
- port, err := nat.NewPort(splitp[1], splitp[0])
+ exposedPort, err := nat.NewPort(splitp[1], splitp[0])
if err != nil {
return nil, err
}
- ports[port] = struct{}{}
+ exposedPorts[exposedPort] = struct{}{}
}
config := container.Config{
@@ -341,7 +341,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
AttachStdin: inspect.Config.AttachStdin,
AttachStdout: inspect.Config.AttachStdout,
AttachStderr: inspect.Config.AttachStderr,
- ExposedPorts: ports,
+ ExposedPorts: exposedPorts,
Tty: inspect.Config.Tty,
OpenStdin: inspect.Config.OpenStdin,
StdinOnce: inspect.Config.StdinOnce,
@@ -371,6 +371,15 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
return nil, err
}
+ p, err := json.Marshal(inspect.NetworkSettings.Ports)
+ if err != nil {
+ return nil, err
+ }
+ ports := nat.PortMap{}
+ if err := json.Unmarshal(p, &ports); err != nil {
+ return nil, err
+ }
+
networkSettingsDefault := types.DefaultNetworkSettings{
EndpointID: "",
Gateway: "",
@@ -382,8 +391,12 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON,
MacAddress: l.Config().StaticMAC.String(),
}
+ networkSettingsBase := types.NetworkSettingsBase{
+ Ports: ports,
+ }
+
networkSettings := types.NetworkSettings{
- NetworkSettingsBase: types.NetworkSettingsBase{},
+ NetworkSettingsBase: networkSettingsBase,
DefaultNetworkSettings: networkSettingsDefault,
Networks: nil,
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index dd8d6266e..64d9a3a18 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -689,7 +689,7 @@ gopkg.in/tomb.v1
gopkg.in/yaml.v2
# gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
gopkg.in/yaml.v3
-# k8s.io/api v0.18.4
+# k8s.io/api v0.18.5
k8s.io/api/apps/v1
k8s.io/api/core/v1
# k8s.io/apimachinery v0.18.5