mirror of https://github.com/docker/docs.git
Merge pull request #931 from vieux/add_ttl_discovery
add ttl placeholder to discovery
This commit is contained in:
commit
316f535936
|
|
@ -10,11 +10,11 @@ The discovery service is still in alpha stage and currently hosted at `https://d
|
||||||
`<- <token>`
|
`<- <token>`
|
||||||
|
|
||||||
#####Add new nodes to a cluster
|
#####Add new nodes to a cluster
|
||||||
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token> Request body: "<ip>:<port1>"`
|
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token>?ttl=<ttl> Request body: "<ip>:<port1>"`
|
||||||
|
|
||||||
`<- OK`
|
`<- OK`
|
||||||
|
|
||||||
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token> Request body: "<ip>:<port2>")`
|
`-> POST https://discovery-stage.hub.docker.com/v1/clusters/<token>?ttl=<ttl> Request body: "<ip>:<port2>")`
|
||||||
|
|
||||||
`<- OK`
|
`<- OK`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@ func (s *Discovery) Watch(stopCh <-chan struct{}) (<-chan discovery.Entries, <-c
|
||||||
func (s *Discovery) Register(addr string) error {
|
func (s *Discovery) Register(addr string) error {
|
||||||
buf := strings.NewReader(addr)
|
buf := strings.NewReader(addr)
|
||||||
|
|
||||||
resp, err := http.Post(fmt.Sprintf("%s/%s/%s", s.url,
|
resp, err := http.Post(fmt.Sprintf("%s/%s/%s?ttl=%d", s.url,
|
||||||
"clusters", s.token), "application/json", buf)
|
"clusters", s.token, uint64(s.ttl.Seconds())), "application/json", buf)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue