code: func MakePortMappings(container *v1.Container) (ports []PortMapping) {
  	names := make(map[string]struct{})
  	for _, p := range container.Ports {
  		pm := PortMapping{
  			HostPort:      int(p.HostPort),
  			ContainerPort: int(p.ContainerPort),
  			Protocol:      p.Protocol,
  			HostIP:        p.HostIP,
  		}
  
  		// We need to create some default port name if it's not specified, since
  		// this is necessary for rkt.
  		// http://issue.k8s.io/7710
  		if p.Name == "" {
  			pm.Name = fmt.Sprintf("%s-%s:%d", container.Name, p.Protocol, p.ContainerPort)
  		} else {
  			pm.Name = fmt.Sprintf("%s-%s", container.Name, p.Name)
  		}
  
  		// Protect against exposing the same protocol-port 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)
  			continue
  		}
  		ports = append(ports, pm)
  		names[pm.Name] = struct{}{}
  	}
  	return
  }
docs: // MakePortMappings creates internal port mapping from api port mapping.