Skip to content
This repository was archived by the owner on Jun 22, 2026. It is now read-only.

chore: add --proxy flag to run local, do host discovery for service connect services - #5412

Merged
mergify[bot] merged 18 commits into
aws:mainlinefrom
dannyrandall:chore/host-discovery
Oct 26, 2023
Merged

mergify[bot] merged 18 commits into
aws:mainlinefrom
dannyrandall:chore/host-discovery

Conversation

@dannyrandall

Copy link
Copy Markdown
Contributor

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

@dannyrandall
dannyrandall requested a review from a team as a code owner October 25, 2023 18:13
@dannyrandall
dannyrandall requested review from Lou1415926 and removed request for a team October 25, 2023 18:13
@github-actions

github-actions Bot commented Oct 25, 2023 •

Copy link
Copy Markdown

🍕 Here are the new binary sizes!

Name New size (kiB) size (kiB) Delta (%)
macOS (amd) 52140 51976 +0.32
macOS (arm) 52992 52812 +0.34
linux (amd) 45868 45716 +0.33
linux (arm) 45124 45060 +0.14
windows (amd) 43312 43168 +0.33

@codecov-commenter

codecov-commenter commented Oct 25, 2023 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 65.71429% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.89%. Comparing base (ebe9289) to head (1ce1caf).
⚠️ Report is 217 commits behind head on mainline.

Files with missing lines Patch % Lines
internal/pkg/cli/run_local.go 44.30% 43 Missing and 1 partial ⚠️
internal/pkg/ecs/ecs.go 85.00% 2 Missing and 1 partial ⚠️
internal/pkg/cli/secret_init.go 0.00% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dannyrandall dannyrandall changed the title chore: add --proxy flag to run local, do host discovery to service connect services chore: add --proxy flag to run local, do host discovery for service connect services Oct 25, 2023

@Lou1415926 Lou1415926 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no complaint!

Comment thread internal/pkg/aws/ecs/ecs.go Resolved
Comment thread internal/pkg/ecs/ecs.go Resolved
Comment thread internal/pkg/ecs/ecs.go Resolved
Comment thread internal/pkg/cli/run_local.go Resolved
Comment thread internal/pkg/cli/run_local.go Resolved
Comment thread internal/pkg/cli/run_local.go Resolved
Comment thread internal/pkg/cli/run_local.go Resolved

@CaptainCarpensir CaptainCarpensir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the changes to the runLocalOpts it makes more sense to just create the orchestrator once!

@mergify
mergify Bot merged commit 9207cd3 into aws:mainline Oct 26, 2023
@dannyrandall
dannyrandall deleted the chore/host-discovery branch October 26, 2023 21:51
if aws.StringValue(service.ServiceName) == serviceName {
svc := Service(*service)
return &svc, nil
if aws.StringValue(svcs[0].ServiceName) != serviceName {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check the length just in case 🥺

Comment on lines +630 to +631
host: aws.StringValue(alias.DnsName),
port: strconv.Itoa(int(aws.Int64Value(alias.Port))),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Comment on lines +618 to +631
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))),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can we just move the logic into the ecs pkg? It seems to be less useful to return []awsecs.Service than the hosts.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants