validateEndpoints checks if 1. all the endpoint names are unique across components 2. endpoint port are unique across component containers ie; two component containers cannot have the same target port but two endpoints in a single component container can have the same target port
(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool)
| 24 | // ie; two component containers cannot have the same target port but two endpoints |
| 25 | // in a single component container can have the same target port |
| 26 | func validateEndpoints(endpoints []v1alpha2.Endpoint, processedEndPointPort map[int]bool, processedEndPointName map[string]bool) (errList []error) { |
| 27 | currentComponentEndPointPort := make(map[int]bool) |
| 28 | |
| 29 | errList = validateDuplicatedName(endpoints, processedEndPointName, currentComponentEndPointPort) |
| 30 | portErrorList := validateDuplicatedPort(processedEndPointPort, currentComponentEndPointPort) |
| 31 | errList = append(errList, portErrorList...) |
| 32 | |
| 33 | return errList |
| 34 | } |
| 35 | |
| 36 | func validateDuplicatedName(endpoints []v1alpha2.Endpoint, processedEndPointName map[string]bool, currentComponentEndPointPort map[int]bool) (errList []error) { |
| 37 | for _, endPoint := range endpoints { |