Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
8645d1d4
Kaydet (Commit)
8645d1d4
authored
Haz 16, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Haz 16, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1617 from docker/create-ingress-network
Add support for ingress in create_network
üst
0ac926b1
ff718f5d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
network.py
docker/api/network.py
+12
-1
networks.py
docker/models/networks.py
+2
-0
api_network_test.py
tests/integration/api_network_test.py
+8
-0
No files found.
docker/api/network.py
Dosyayı görüntüle @
8645d1d4
...
@@ -41,7 +41,8 @@ class NetworkApiMixin(object):
...
@@ -41,7 +41,8 @@ class NetworkApiMixin(object):
@minimum_version
(
'1.21'
)
@minimum_version
(
'1.21'
)
def
create_network
(
self
,
name
,
driver
=
None
,
options
=
None
,
ipam
=
None
,
def
create_network
(
self
,
name
,
driver
=
None
,
options
=
None
,
ipam
=
None
,
check_duplicate
=
None
,
internal
=
False
,
labels
=
None
,
check_duplicate
=
None
,
internal
=
False
,
labels
=
None
,
enable_ipv6
=
False
,
attachable
=
None
,
scope
=
None
):
enable_ipv6
=
False
,
attachable
=
None
,
scope
=
None
,
ingress
=
None
):
"""
"""
Create a network. Similar to the ``docker network create``.
Create a network. Similar to the ``docker network create``.
...
@@ -60,6 +61,8 @@ class NetworkApiMixin(object):
...
@@ -60,6 +61,8 @@ class NetworkApiMixin(object):
attachable (bool): If enabled, and the network is in the global
attachable (bool): If enabled, and the network is in the global
scope, non-service containers on worker nodes will be able to
scope, non-service containers on worker nodes will be able to
connect to the network.
connect to the network.
ingress (bool): If set, create an ingress network which provides
the routing-mesh in swarm mode.
Returns:
Returns:
(dict): The created network reference object
(dict): The created network reference object
...
@@ -129,6 +132,14 @@ class NetworkApiMixin(object):
...
@@ -129,6 +132,14 @@ class NetworkApiMixin(object):
)
)
data
[
'Attachable'
]
=
attachable
data
[
'Attachable'
]
=
attachable
if
ingress
is
not
None
:
if
version_lt
(
self
.
_version
,
'1.29'
):
raise
InvalidVersion
(
'ingress is not supported in API version < 1.29'
)
data
[
'Ingress'
]
=
ingress
url
=
self
.
_url
(
"/networks/create"
)
url
=
self
.
_url
(
"/networks/create"
)
res
=
self
.
_post_json
(
url
,
data
=
data
)
res
=
self
.
_post_json
(
url
,
data
=
data
)
return
self
.
_result
(
res
,
json
=
True
)
return
self
.
_result
(
res
,
json
=
True
)
...
...
docker/models/networks.py
Dosyayı görüntüle @
8645d1d4
...
@@ -111,6 +111,8 @@ class NetworkCollection(Collection):
...
@@ -111,6 +111,8 @@ class NetworkCollection(Collection):
labels (dict): Map of labels to set on the network. Default
labels (dict): Map of labels to set on the network. Default
``None``.
``None``.
enable_ipv6 (bool): Enable IPv6 on the network. Default ``False``.
enable_ipv6 (bool): Enable IPv6 on the network. Default ``False``.
ingress (bool): If set, create an ingress network which provides
the routing-mesh in swarm mode.
Returns:
Returns:
(:py:class:`Network`): The network that was created.
(:py:class:`Network`): The network that was created.
...
...
tests/integration/api_network_test.py
Dosyayı görüntüle @
8645d1d4
...
@@ -452,6 +452,14 @@ class TestNetworks(BaseAPIIntegrationTest):
...
@@ -452,6 +452,14 @@ class TestNetworks(BaseAPIIntegrationTest):
net
=
self
.
client
.
inspect_network
(
net_id
)
net
=
self
.
client
.
inspect_network
(
net_id
)
assert
net
[
'Attachable'
]
is
True
assert
net
[
'Attachable'
]
is
True
@requires_api_version
(
'1.29'
)
def
test_create_network_ingress
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
self
.
client
.
remove_network
(
'ingress'
)
_
,
net_id
=
self
.
create_network
(
driver
=
'overlay'
,
ingress
=
True
)
net
=
self
.
client
.
inspect_network
(
net_id
)
assert
net
[
'Ingress'
]
is
True
@requires_api_version
(
'1.25'
)
@requires_api_version
(
'1.25'
)
def
test_prune_networks
(
self
):
def
test_prune_networks
(
self
):
net_name
,
_
=
self
.
create_network
()
net_name
,
_
=
self
.
create_network
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment