Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 18 commits into from
Oct 26, 2023

Conversation

dannyrandall
Copy link
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
Copy link

github-actions bot commented Oct 25, 2023

🍕 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
Copy link

codecov-commenter commented Oct 25, 2023

Codecov Report

Attention: 48 lines in your changes are missing coverage. Please review.

Comparison is base (ebe9289) 69.88% compared to head (519363a) 69.89%.

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     
Files Coverage Δ
internal/pkg/aws/ecs/ecs.go 91.11% <100.00%> (+0.80%) ⬆️
internal/pkg/cli/flag.go 90.47% <ø> (ø)
internal/pkg/cli/job_run.go 38.00% <100.00%> (ø)
internal/pkg/template/env.go 52.63% <ø> (ø)
internal/pkg/cli/secret_init.go 57.63% <0.00%> (-0.13%) ⬇️
internal/pkg/ecs/ecs.go 85.38% <85.00%> (-0.03%) ⬇️
internal/pkg/cli/run_local.go 65.30% <44.30%> (-0.30%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@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
Copy link
Contributor

@Lou1415926 Lou1415926 left a comment

Choose a reason for hiding this comment

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

no complaint!

Copy link
Contributor

@CaptainCarpensir CaptainCarpensir left a comment

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
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
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
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants