chore: add --proxy flag to run local, do host discovery for service connect services#5412
Conversation
|
🍕 Here are the new binary sizes!
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## mainline #5412 +/- ##
============================================
+ Coverage 69.88% 69.89% +0.01%
============================================
Files 299 299
Lines 45374 45465 +91
Branches 295 295
============================================
+ Hits 31708 31780 +72
- Misses 12122 12140 +18
- Partials 1544 1545 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
--proxy flag to run local, do host discovery to service connect services--proxy flag to run local, do host discovery for service connect services
CaptainCarpensir
left a comment
There was a problem hiding this comment.
I like the changes to the runLocalOpts it makes more sense to just create the orchestrator once!
| if aws.StringValue(service.ServiceName) == serviceName { | ||
| svc := Service(*service) | ||
| return &svc, nil | ||
| if aws.StringValue(svcs[0].ServiceName) != serviceName { |
There was a problem hiding this comment.
Can we check the length just in case 🥺
| host: aws.StringValue(alias.DnsName), | ||
| port: strconv.Itoa(int(aws.Int64Value(alias.Port))), |
There was a problem hiding this comment.
My concern is: this might be too Copilot specific assuming we always set sc service through ClientAliases. We can refactor later but we probably should add a comment for what assumption we make for now 🤔
| for _, svc := range svcs { | ||
| // find the primary deployment with service connect enabled | ||
| idx := slices.IndexFunc(svc.Deployments, func(dep *sdkecs.Deployment) bool { | ||
| return aws.StringValue(dep.Status) == "PRIMARY" && aws.BoolValue(dep.ServiceConnectConfiguration.Enabled) | ||
| }) | ||
| if idx == -1 { | ||
| continue | ||
| } | ||
|
|
||
| for _, sc := range svc.Deployments[idx].ServiceConnectConfiguration.Services { | ||
| for _, alias := range sc.ClientAliases { | ||
| hosts = append(hosts, host{ | ||
| host: aws.StringValue(alias.DnsName), | ||
| port: strconv.Itoa(int(aws.Int64Value(alias.Port))), |
There was a problem hiding this comment.
Also can we just move the logic into the ecs pkg? It seems to be less useful to return []awsecs.Service than the hosts.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.