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>`
|
||||
|
||||
#####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`
|
||||
|
||||
`-> 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`
|
||||
|
||||
|
|
|
@ -119,8 +119,8 @@ func (s *Discovery) Watch(stopCh <-chan struct{}) (<-chan discovery.Entries, <-c
|
|||
func (s *Discovery) Register(addr string) error {
|
||||
buf := strings.NewReader(addr)
|
||||
|
||||
resp, err := http.Post(fmt.Sprintf("%s/%s/%s", s.url,
|
||||
"clusters", s.token), "application/json", buf)
|
||||
resp, err := http.Post(fmt.Sprintf("%s/%s/%s?ttl=%d", s.url,
|
||||
"clusters", s.token, uint64(s.ttl.Seconds())), "application/json", buf)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue