feat: Add gateway_priority support for network endpoints #3339
+474
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for the
gateway_priorityparameter, allowing users to specify the gateway selection priority for a container's network endpoint. This feature corresponds to theGwPriorityfield in the Docker Engine API, available from version 1.48.Key Changes:
docker.types.networks.EndpointConfig:gw_priorityparameter to the constructor.docker.api.network.NetworkApiMixin.connect_container_to_network:gw_priorityparameter, which is passed toEndpointConfig.docker.api.container.ContainerApiMixin.create_endpoint_config:gw_priorityparameter, allowingcreate_containerto utilize this feature vianetworking_config.tests/unit/api_network_gw_priority_test.py) forEndpointConfigand theconnect_container_to_networkmethod's handling ofgw_priority.tests/unit/api_network_test.pyandtests/unit/api_container_test.py.tests/integration/api_network_test.pyandtests/integration/api_container_test.pyto verify functionality against a Docker daemon.gw_priority.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.