in integration/scenarios/export_service.go [35:78]
func NewExportServiceScenario(cfg *aws.Config, nsName string, svcName string, portStr string, servicePortStr string, ips string) (ExportServiceScenario, error) {
endpts := make([]*model.Endpoint, 0)
port, parseError := strconv.ParseUint(portStr, 10, 16)
if parseError != nil {
return nil, parseError
}
servicePort, parseError := strconv.ParseUint(servicePortStr, 10, 16)
if parseError != nil {
return nil, parseError
}
for _, ip := range strings.Split(ips, ",") {
endpointPort := model.Port{
Port: int32(port),
Protocol: string(v1.ProtocolTCP),
}
endpts = append(endpts, &model.Endpoint{
Id: model.EndpointIdFromIPAddressAndPort(ip, endpointPort),
IP: ip,
ServicePort: model.Port{
Port: int32(servicePort),
TargetPort: portStr,
Protocol: string(v1.ProtocolTCP),
},
EndpointPort: endpointPort,
Attributes: make(map[string]string),
})
}
return &exportServiceScenario{
sdClient: cloudmap.NewServiceDiscoveryClientWithCustomCache(cfg,
&cloudmap.SdCacheConfig{
NsTTL: time.Second,
SvcTTL: time.Second,
EndptTTL: time.Second,
}),
expectedSvc: model.Service{
Namespace: nsName,
Name: svcName,
Endpoints: endpts,
},
}, nil
}