remove legacy leftovers of portmapping functionality that was moved to CNI

This commit is contained in:
Sergey Kanzhelev
2020-07-30 23:12:16 +00:00
parent 0c642b6ef0
commit d20fd40884
16 changed files with 41 additions and 987 deletions

View File

@@ -333,22 +333,18 @@ func MakePortMappings(container *v1.Container) (ports []PortMapping) {
}
}
// We need to create some default port name if it's not specified, since
// this is necessary for the dockershim CNI driver.
// https://github.com/kubernetes/kubernetes/pull/82374#issuecomment-529496888
if p.Name == "" {
pm.Name = fmt.Sprintf("%s-%s-%s:%d", container.Name, family, p.Protocol, p.ContainerPort)
} else {
pm.Name = fmt.Sprintf("%s-%s", container.Name, p.Name)
var name string = p.Name
if name == "" {
name = fmt.Sprintf("%s-%s:%d", family, p.Protocol, p.ContainerPort)
}
// Protect against a port name being used more than once in a container.
if _, ok := names[pm.Name]; ok {
klog.Warningf("Port name conflicted, %q is defined more than once", pm.Name)
if _, ok := names[name]; ok {
klog.Warningf("Port name conflicted, %q is defined more than once", name)
continue
}
ports = append(ports, pm)
names[pm.Name] = struct{}{}
names[name] = struct{}{}
}
return
}