func AccumulateUniqueHostPorts(containers []v1.Container, accumulator *sets.String, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}

	for ci, ctr := range containers {
		idxPath := fldPath.Index(ci)
		portsPath := idxPath.Child("ports")
		for pi := range ctr.Ports {
			idxPath := portsPath.Index(pi)
			port := ctr.Ports[pi].HostPort
			if port == 0 {
				continue
			}
			str := fmt.Sprintf("%d/%s", port, ctr.Ports[pi].Protocol)
			if accumulator.Has(str) {
				allErrs = append(allErrs, field.Duplicate(idxPath.Child("hostPort"), str))
			} else {
				accumulator.Insert(str)
			}
		}
	}
	return allErrs
}
// AccumulateUniqueHostPorts checks all the containers for duplicates ports. Any
// duplicate port will be returned in the ErrorList.
AccumulateUniqueHostPorts checks all the containers for duplicates ports. Any
duplicate port will be returned in the ErrorList.
// AccumulateUniqueHostPorts checks all the containers for duplicates ports . Any // duplicate port will be returned in the ErrorList .
func AccumulateUniqueHostPorts(containers []v1.Container, accumulator *sets.String, fldPath *field.Path) field.ErrorList {
	allErrs := field.ErrorList{}
	for ci, ctr := range containers {
		idxPath := fldPath.Index(ci)
		portsPath := idxPath.Child("ports")
		for pi := range ctr.Ports {
			idxPath := portsPath.Index(pi)
			port := ctr.Ports[pi].HostPort
			if port == 0 {
				continue
			}
			str := fmt.Sprintf("%d/%s", port, ctr.Ports[pi].Protocol)
			if accumulator.Has(str) {
				allErrs = append(allErrs, field.Duplicate(idxPath.Child("hostPort"), str))
			} else {
				accumulator.Insert(str)
			}
		}
	}
	return allErrs
}
func AccumulateUniqueHostPorts ( containers [ ] v1 . Container , accumulator * sets . String , fldPath * field . Path ) field . ErrorList { allErrs := field . ErrorList { } for ci , ctr := range containers { idxPath := fldPath . Index ( ci ) portsPath := idxPath . Child ( " " ) for pi := range ctr . Ports { idxPath := portsPath . Index ( pi ) port := ctr . Ports [ pi ] . HostPort if port == 0 { continue } str := fmt . Sprintf ( " " , port , ctr . Ports [ pi ] . Protocol ) if accumulator . Has ( str ) { allErrs = append ( allErrs , field . Duplicate ( idxPath . Child ( " " ) , str ) ) } else { accumulator . Insert ( str ) } } } return allErrs }
AccumulateUniqueHostPorts checks all the containers for duplicates ports.
AccumulateUniqueHostPorts checks all the containers for duplicates ports .