Change default for LAMBDA_DEV_PORT_EXPOSE on macOS in host mode - #11280
Conversation
|
Nice change! Tested locally running on host mode (without explicitly enabling the flag) on 💻 I'm running |
dfangl
left a comment
There was a problem hiding this comment.
is_in_docker will also be True if in kubernetes, it is really just a variable whether we are running in a container or not.
I think the taken approach is fine, but there are now some duplicated methods with utils/platform.py. I understand it is not that easy to use them, but it might be worth consolidating them anyway in the future.
Yeah, I know, and also small inconsistencies (e.g., |
simonrw
left a comment
There was a problem hiding this comment.
I think this change is sensible.
Regarding k8s behaviour: I think the same problem will be true for k8s as it is in Docker, but only when LS is being run in host mode. E.g. for kind the k8s "nodes" are Docker containers, therefore the same problem.
However we implicitly not really supporting that use case right now. We are focused on when LS is deployed in the k8s cluster as a pod, in which case there is no problem as all pods ports are accessible by other pods (with minor restrictions).
So in summary: I think we don't have to account for k8s behaviour specifically here.
Motivation
Lambda won't work in host mode on macOS without setting
LAMBDA_DEV_PORT_EXPOSE=1(introduced in #7367), which is a bad developer experience.So far, we opted for explicit configuration developer documentation here to unblock developers on macOS in host mode.
Several contributors hit this issue, and it was suggested that we set it by default if we detect LocalStack running in host mode on macOS. The Lambda service owners also discussed this in the last Lambda Service Owner Sync (2024-07-15).
Changes
Testing
Our test suite should capture any regressions. Anything else to consider? Is there a special environment where the assumption
not is_in_docker == host modedoes not apply (e.g., K8) @dfangl @simonrw?Discussion
Options considered:
not is_in_docker == host mode.