diff options
author | Paul Holzinger <pholzing@redhat.com> | 2021-08-24 23:04:25 +0200 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2021-09-15 20:00:28 +0200 |
commit | b906b9d8581c6fe745509e386c5324d9c76b8801 (patch) | |
tree | f901034d8f1c69d8c6c788551c182095743cf38b /cmd | |
parent | 85e8fbf7f33717ef6a0d6cf9e2143b52c874c2de (diff) | |
download | podman-b906b9d8581c6fe745509e386c5324d9c76b8801.tar.gz podman-b906b9d8581c6fe745509e386c5324d9c76b8801.tar.bz2 podman-b906b9d8581c6fe745509e386c5324d9c76b8801.zip |
Drop OCICNI dependency
We do not use the ocicni code anymore so let's get rid of it. Only the
port struct is used but we can copy this into libpod network types so
we can debloat the binary.
The next step is to remove the OCICNI port mapping form the container
config and use the better PortMapping struct everywhere.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/containers/port.go | 6 | ||||
-rw-r--r-- | cmd/podman/containers/ps.go | 18 |
2 files changed, 12 insertions, 12 deletions
diff --git a/cmd/podman/containers/port.go b/cmd/podman/containers/port.go index db66fc9a0..f309390c3 100644 --- a/cmd/podman/containers/port.go +++ b/cmd/podman/containers/port.go @@ -8,8 +8,8 @@ import ( "github.com/containers/podman/v3/cmd/podman/common" "github.com/containers/podman/v3/cmd/podman/registry" "github.com/containers/podman/v3/cmd/podman/validate" + "github.com/containers/podman/v3/libpod/network/types" "github.com/containers/podman/v3/pkg/domain/entities" - "github.com/cri-o/ocicni/pkg/ocicni" "github.com/pkg/errors" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -73,7 +73,7 @@ func port(_ *cobra.Command, args []string) error { var ( container string err error - userPort ocicni.PortMapping + userPort types.OCICNIPortMapping ) if len(args) == 0 && !portOpts.Latest && !portOpts.All { @@ -105,7 +105,7 @@ func port(_ *cobra.Command, args []string) error { if err != nil { return err } - userPort = ocicni.PortMapping{ + userPort = types.OCICNIPortMapping{ HostPort: 0, ContainerPort: int32(portNum), Protocol: fields[1], diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index a5b0795cd..ff792b78b 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -15,8 +15,8 @@ import ( "github.com/containers/podman/v3/cmd/podman/registry" "github.com/containers/podman/v3/cmd/podman/utils" "github.com/containers/podman/v3/cmd/podman/validate" + "github.com/containers/podman/v3/libpod/network/types" "github.com/containers/podman/v3/pkg/domain/entities" - "github.com/cri-o/ocicni/pkg/ocicni" "github.com/docker/go-units" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -469,7 +469,7 @@ func (l psReporter) UTS() string { // portsToString converts the ports used to a string of the from "port1, port2" // and also groups a continuous list of ports into a readable format. -func portsToString(ports []ocicni.PortMapping) string { +func portsToString(ports []types.OCICNIPortMapping) string { if len(ports) == 0 { return "" } @@ -478,8 +478,8 @@ func portsToString(ports []ocicni.PortMapping) string { return comparePorts(ports[i], ports[j]) }) - portGroups := [][]ocicni.PortMapping{} - currentGroup := []ocicni.PortMapping{} + portGroups := [][]types.OCICNIPortMapping{} + currentGroup := []types.OCICNIPortMapping{} for i, v := range ports { var prevPort, nextPort *int32 if i > 0 { @@ -492,17 +492,17 @@ func portsToString(ports []ocicni.PortMapping) string { port := v.ContainerPort // Helper functions - addToCurrentGroup := func(x ocicni.PortMapping) { + addToCurrentGroup := func(x types.OCICNIPortMapping) { currentGroup = append(currentGroup, x) } - addToPortGroup := func(x ocicni.PortMapping) { - portGroups = append(portGroups, []ocicni.PortMapping{x}) + addToPortGroup := func(x types.OCICNIPortMapping) { + portGroups = append(portGroups, []types.OCICNIPortMapping{x}) } finishCurrentGroup := func() { portGroups = append(portGroups, currentGroup) - currentGroup = []ocicni.PortMapping{} + currentGroup = []types.OCICNIPortMapping{} } // Single entry slice @@ -600,7 +600,7 @@ func portsToString(ports []ocicni.PortMapping) string { return strings.Join(portDisplay, ", ") } -func comparePorts(i, j ocicni.PortMapping) bool { +func comparePorts(i, j types.OCICNIPortMapping) bool { if i.ContainerPort != j.ContainerPort { return i.ContainerPort < j.ContainerPort } |