10000 Add Lambda runtime parity configuration for ulimit by joe4dev · Pull Request #7871 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

Add Lambda runtime parity configuration for ulimit #7871

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 14 commits into from
Mar 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Order flags alphabetically
  • Loading branch information
joe4dev committed Mar 20, 2023
commit 7e5d650e9b2c740e3a7926479b9e7cbc449a451b
60 changes: 31 additions & 29 deletions localstack/utils/container_utils/container_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,46 +933,48 @@ def parse_additional_flags(

flags = shlex.split(additional_flags)

# TODO: order parser setup alphabetically
# Configure parser
parser = NoExitArgumentParser(description="Docker run flags parser")
parser.add_argument(
"--platform",
type=DockerPlatform,
help="Docker platform (e.g., linux/amd64 or linux/arm64)",
"--add-host",
help="Add a custom host-to-IP mapping (host:ip)",
dest="add_hosts",
action="append",
)
parser.add_argument(
"-l", "--label", help="Add container meta data", dest="labels", action="append"
"--env", "-e", help="Set environment variables", dest="envs", action="append"
)
parser.add_argument("-u", "--user", help="Username or UID to execute first process")
parser.add_argument(
"-e", "--env", help="Set environment variables", dest="envs", action="append"
"--label", "-l", help="Add container meta data", dest="labels", action="append"
)
parser.add_argument("--network", help="Connect a container to a network")
parser.add_argument(
"-v", "--volume", help="Bind mount a volume", dest="volumes", action="append"
"--platform",
type=DockerPlatform,
help="Docker platform (e.g., linux/amd64 or linux/arm64)",
)
parser.add_argument(
"-p",
"--publish",
help="Publish container port(s) to the host",
dest="ports",
action="append",
"--privileged",
type=bool,
help="Give extended privileges to this container",
action=BooleanOptionalAction,
)
parser.add_argument(
"--add-host",
help="Add a custom host-to-IP mapping (host:ip)",
dest="add_hosts",
"--publish",
"-p",
help="Publish container port(s) to the host",
dest="publish_ports",
action="append",
)
parser.add_argument("--network", help="Connect a container to a network")
parser.add_argument("--user", "-u", help="Username or UID to execute first process")
parser.add_argument(
"--privileged",
type=bool,
help="Give extended privileges to this container",
action=BooleanOptionalAction,
"--volume", "-v", help="Bind mount a volume", dest="volumes", action="append"
)

# Parse
args = parser.parse_args(flags)

# Post-process parsed flags
if args.add_hosts:
for add_host in args.add_hosts:
extra_hosts = extra_hosts if extra_hosts is not None else {}
Expand Down Expand Up @@ -1008,8 +1010,14 @@ def parse_additional_flags(
)
platform = args.platform

if args.ports:
for port_mapping in args.ports:
if args.privileged is not None:
LOG.warning(
f"Overwriting Docker container privileged flag {privileged} with new value {args.privileged}"
)
privileged = True

if args.publish_ports:
for port_mapping in args.publish_ports:
port_split = port_mapping.split(":")
protocol = "tcp"
if len(port_split) == 2:
Expand All @@ -1033,12 +1041,6 @@ def parse_additional_flags(
ports = ports if ports is not None else PortMappings()
ports.add(host_port, int(container_port), protocol)

if args.privileged is not None:
LOG.warning(
f"Overwriting Docker container privileged flag {privileged} with new value {args.privileged}"
)
privileged = True

if args.user:
LOG.warning(
"Overwriting Docker user '%s' with new value '%s'",
Expand Down
0