mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
remove legacy leftovers of portmapping functionality that was moved to CNI
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user