Skip to content

feat: Add gateway_priority support for network endpoints #3339

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Adithya1331
Copy link

This pull request introduces support for the gateway_priority parameter, allowing users to specify the gateway selection priority for a container's network endpoint. This feature corresponds to the GwPriority field in the Docker Engine API, available from version 1.48.

Key Changes:

  • docker.types.networks.EndpointConfig:
    • Added gw_priority parameter to the constructor.
    • Includes validation for API version (>= 1.48) and integer type.
  • docker.api.network.NetworkApiMixin.connect_container_to_network:
    • Added optional gw_priority parameter, which is passed to EndpointConfig.
  • docker.api.container.ContainerApiMixin.create_endpoint_config:
    • Added optional gw_priority parameter, allowing create_container to utilize this feature via networking_config.
  • Tests:
    • Added new unit tests (tests/unit/api_network_gw_priority_test.py) for EndpointConfig and the connect_container_to_network method's handling of gw_priority.
    • Updated existing unit tests in tests/unit/api_network_test.py and tests/unit/api_container_test.py.
    • Added new integration tests in tests/integration/api_network_test.py and tests/integration/api_container_test.py to verify functionality against a Docker daemon.
  • Documentation:
    • Updated docstrings for all modified methods and classes to include gw_priority.
    • Added an entry to docs/change_log.md.

This implementation allows users to influence which network endpoint provides the default gateway for a container, as per the Docker API v1.48 specification.

Signed-off-by: Adithya1331 <adithyakokkirala@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant