Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Migrate deprecated edge variables #9405

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

Merged
merged 8 commits into from
Nov 7, 2023

Conversation

joe4dev
Copy link
Member

@joe4dev joe4dev commented Oct 19, 2023

Depends on LOCALSTACK_HOST migration: #9390

Motivation

EDGE_PORT, EDGE_PORT_HTTP and EDGE_BIND_HOST are replaced by GATEWAY_LISTEN, and have been deprecated since version 2.0. These variables should be removed in a major version, and can be done in version 3.0.

Changes

  • Make EDGE_PORT read-only. Internal use is widespread and therefore we consider it as a shortcut for now with the semantics EDGE_PORT == GATEWAY_LISTEN[0].port. We also keep exposing EDGE_PORT in LocalStack compute services because we have not advertised a migration path yet.
  • Remove EDGE_PORT_HTTP
  • Remove EDGE_BIND_HOST

Background

Discussion

  • CORS is now more permissive (see localstack/aws/handlers/cors.py) and the tests required updates (tests/unit/test_cors.py). Is this ok?
  • Monkeypatching of GATEWAY_LISTEN needs to use typed [HostAndPort] rather than the user-facing string-based API. Does this work properly without side effects? Do we need to provide any guards when used with strings?
  • StepFunctions V1: Does anything depend on the environment variable EDGE_PORT_HTTP (generated in localstack.services.stepfunctions.stepfunctions_starter.StepFunctionsServer.generate_env_vars) used when starting the Java StepFunctionsLocal.jar ? (I would leave it for now as this StepFunctions implementation will be deprecated anyway).

TODO

Follow-up

  • Remove get_edge_port_http() (this refactoring can also be done post v3 to limit the impact; used 13x in LS + 13x in ext)

@joe4dev joe4dev added the semver: major Breaking changes which can be included in a major release only label Oct 19, 2023
@joe4dev joe4dev added this to the 3.0 milestone Oct 19, 2023
@joe4dev joe4dev self-assigned this Oct 19, 2023
@localstack-bot
Copy link
Contributor

Currently, only minor and patch changes are allowed on master. Your PR labels (semver: major) indicate that it cannot be merged into the master at this time.

@github-actions
Copy link

github-actions bot commented Oct 19, 2023

LocalStack Community integration with Pro

       2 files         2 suites   1h 3m 10s ⏱️
2 302 tests 2 006 ✔️ 296 💤 0
2 303 runs  2 006 ✔️ 297 💤 0

Results for commit e824f10.

♻️ This comment has been updated with latest results.

@joe4dev joe4dev force-pushed the remove-deprecated-edge-variables branch from fd4e0c1 to ee81471 Compare November 3, 2023 11:32
@joe4dev joe4dev changed the base branch from master to release/v3.0 November 3, 2023 11:36
@joe4dev joe4dev mentioned this pull request Nov 3, 2023
20 tasks
@joe4dev joe4dev changed the title Remove deprecated edge variables Migrate deprecated edge variables Nov 3, 2023
@alexrashed alexrashed force-pushed the release/v3.0 branch 2 times, most recently from fb5da7d to 99278b3 Compare November 4, 2023 13:46
@joe4dev joe4dev force-pushed the remove-deprecated-edge-variables branch from ee81471 to 8b28e56 Compare November 6, 2023 12:30
@coveralls
Copy link

coveralls commented Nov 6, 2023

Coverage Status

coverage: 84.244% (+0.02%) from 84.224%
when pulling d891ae6 on remove-deprecated-edge-variables
into dffe61f on release/v3.0.

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Excited to see these changes landing. It's been a while since 2.0 and the logic is much cleaner!

A few comments that I'd like to resolve before we merge, but nothing significant.

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Also a change I missed when updating GATEWAY_LISTEN: on config.py line 671 the type signature of GATEWAY_LISTEN should be UniqueHostAndPortList, not List. Is it ok to update this? (Or remove the dedicated type signature, since it should come from the signature of populate_legacy_edge_configuration.

@joe4dev
Copy link
Member Author

joe4dev commented Nov 7, 2023

Also a change I missed when updating GATEWAY_LISTEN: on config.py line 671 the type signature of GATEWAY_LISTEN should be UniqueHostAndPortList, not List. Is it ok to update this? (Or remove the dedicated type signature, since it should come from the signature of populate_legacy_edge_configuration.

I removed the typing. It seems clearer to rely on the correct signature from the function, especially given the tuple. The single typing appears rather confusing.

Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

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

Awesome stuff, nice work! I'm super happy to be migrating fully over to GATEWAY_LISTEN and it's more straightforward to have one variable than the three we used to have!

@joe4dev joe4dev force-pushed the remove-deprecated-edge-variables branch from d891ae6 to 3c270a6 Compare November 7, 2023 15:09
@joe4dev
Copy link
Member Author

joe4dev commented Nov 7, 2023

FYI: I rebased to resolve conflicts (mainly in config.py)

@joe4dev joe4dev force-pushed the remove-deprecated-edge-variables branch from 3c270a6 to 3acf501 Compare November 7, 2023 16:35
@joe4dev
Copy link
Member Author

joe4dev commented Nov 7, 2023

New conflicts streaming in 🏃 => new rebase

Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

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

Love it, finally getting rid of the confusing EDGE_PORT_HTTP :D

@joe4dev joe4dev merged commit 20b3517 into release/v3.0 Nov 7, 2023
@joe4dev joe4dev deleted the remove-deprecated-edge-variables branch November 7, 2023 19:20
alexrashed pushed a commit that referenced this pull request Nov 7, 2023
localstack-bot pushed a commit that referenced this pull request Nov 9, 2023
alexrashed pushed a commit that referenced this pull request Nov 9, 2023
alexrashed pushed a commit that referenced this pull request Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: major Breaking changes which can be included in a major release only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants