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
c7b9cae0
Kaydet (Commit)
c7b9cae0
authored
Mar 31, 2019
tarafından
Hannes Ljungberg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add swarm support for data_addr_path
Signed-off-by:
Hannes Ljungberg
<
hannes@5monkeys.se
>
üst
992e0dcd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
8 deletions
+38
-8
swarm.py
docker/api/swarm.py
+29
-6
swarm.py
docker/models/swarm.py
+5
-2
api_swarm_test.py
tests/integration/api_swarm_test.py
+4
-0
No files found.
docker/api/swarm.py
Dosyayı görüntüle @
c7b9cae0
...
...
@@ -84,7 +84,8 @@ class SwarmApiMixin(object):
@utils.minimum_version
(
'1.24'
)
def
init_swarm
(
self
,
advertise_addr
=
None
,
listen_addr
=
'0.0.0.0:2377'
,
force_new_cluster
=
False
,
swarm_spec
=
None
,
default_addr_pool
=
None
,
subnet_size
=
None
):
default_addr_pool
=
None
,
subnet_size
=
None
,
data_path_addr
=
None
):
"""
Initialize a new Swarm using the current connected engine as the first
node.
...
...
@@ -115,6 +116,8 @@ class SwarmApiMixin(object):
Default: None
subnet_size (int): SubnetSize specifies the subnet size of the
networks created from the default subnet pool. Default: None
data_path_addr (string): Address or interface to use for data path
traffic. For example, 192.168.1.1, or an interface, like eth0.
Returns:
``True`` if successful.
...
...
@@ -154,6 +157,15 @@ class SwarmApiMixin(object):
'ForceNewCluster'
:
force_new_cluster
,
'Spec'
:
swarm_spec
,
}
if
data_path_addr
is
not
None
:
if
utils
.
version_lt
(
self
.
_version
,
'1.30'
):
raise
errors
.
InvalidVersion
(
'Data address path is only available for '
'API version >= 1.30'
)
data
[
'DataPathAddr'
]
=
data_path_addr
response
=
self
.
_post_json
(
url
,
data
=
data
)
self
.
_raise_for_status
(
response
)
return
True
...
...
@@ -194,7 +206,7 @@ class SwarmApiMixin(object):
@utils.minimum_version
(
'1.24'
)
def
join_swarm
(
self
,
remote_addrs
,
join_token
,
listen_addr
=
'0.0.0.0:2377'
,
advertise_addr
=
None
):
advertise_addr
=
None
,
data_path_addr
=
None
):
"""
Make this Engine join a swarm that has already been created.
...
...
@@ -213,6 +225,8 @@ class SwarmApiMixin(object):
the port number from the listen address is used. If
AdvertiseAddr is not specified, it will be automatically
detected when possible. Default: ``None``
data_path_addr (string): Address or interface to use for data path
traffic. For example, 192.168.1.1, or an interface, like eth0.
Returns:
``True`` if the request went through.
...
...
@@ -222,11 +236,20 @@ class SwarmApiMixin(object):
If the server returns an error.
"""
data
=
{
"RemoteAddrs"
:
remote_addrs
,
"ListenAddr"
:
listen_addr
,
"JoinToken"
:
join_token
,
"AdvertiseAddr"
:
advertise_addr
,
'RemoteAddrs'
:
remote_addrs
,
'ListenAddr'
:
listen_addr
,
'JoinToken'
:
join_token
,
'AdvertiseAddr'
:
advertise_addr
,
}
if
data_path_addr
is
not
None
:
if
utils
.
version_lt
(
self
.
_version
,
'1.30'
):
raise
errors
.
InvalidVersion
(
'Data address path is only available for '
'API version >= 1.30'
)
data
[
'DataPathAddr'
]
=
data_path_addr
url
=
self
.
_url
(
'/swarm/join'
)
response
=
self
.
_post_json
(
url
,
data
=
data
)
self
.
_raise_for_status
(
response
)
...
...
docker/models/swarm.py
Dosyayı görüntüle @
c7b9cae0
...
...
@@ -35,7 +35,7 @@ class Swarm(Model):
def
init
(
self
,
advertise_addr
=
None
,
listen_addr
=
'0.0.0.0:2377'
,
force_new_cluster
=
False
,
default_addr_pool
=
None
,
subnet_size
=
None
,
**
kwargs
):
subnet_size
=
None
,
data_path_addr
=
None
,
**
kwargs
):
"""
Initialize a new swarm on this Engine.
...
...
@@ -63,6 +63,8 @@ class Swarm(Model):
Default: None
subnet_size (int): SubnetSize specifies the subnet size of the
networks created from the default subnet pool. Default: None
data_path_addr (string): Address or interface to use for data path
traffic. For example, 192.168.1.1, or an interface, like eth0.
task_history_retention_limit (int): Maximum number of tasks
history stored.
snapshot_interval (int): Number of logs entries between snapshot.
...
...
@@ -117,7 +119,8 @@ class Swarm(Model):
'listen_addr'
:
listen_addr
,
'force_new_cluster'
:
force_new_cluster
,
'default_addr_pool'
:
default_addr_pool
,
'subnet_size'
:
subnet_size
'subnet_size'
:
subnet_size
,
'data_path_addr'
:
data_path_addr
,
}
init_kwargs
[
'swarm_spec'
]
=
self
.
client
.
api
.
create_swarm_spec
(
**
kwargs
)
self
.
client
.
api
.
init_swarm
(
**
init_kwargs
)
...
...
tests/integration/api_swarm_test.py
Dosyayı görüntüle @
c7b9cae0
...
...
@@ -233,3 +233,7 @@ class SwarmTest(BaseAPIIntegrationTest):
self
.
client
.
remove_node
(
node_id
,
True
)
assert
e
.
value
.
response
.
status_code
>=
400
@requires_api_version
(
'1.30'
)
def
test_init_swarm_data_path_addr
(
self
):
assert
self
.
init_swarm
(
data_path_addr
=
'eth0'
)
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