From a7c42a6c2a3c63331170e2fee6ca1bc7bf6731e9 Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Fri, 20 Oct 2017 13:39:13 -0700 Subject: [PATCH] Expose SkipNodeUpdate field and some health check info in the http api --- agent/consul/catalog_endpoint.go | 2 +- agent/structs/structs.go | 5 +++++ api/agent.go | 4 ++++ api/catalog.go | 1 + api/health.go | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/agent/consul/catalog_endpoint.go b/agent/consul/catalog_endpoint.go index c6997fa702..75adf6cfd6 100644 --- a/agent/consul/catalog_endpoint.go +++ b/agent/consul/catalog_endpoint.go @@ -28,7 +28,7 @@ func (c *Catalog) Register(args *structs.RegisterRequest, reply *struct{}) error defer metrics.MeasureSince([]string{"catalog", "register"}, time.Now()) // Verify the args. - if args.Node == "" || args.Address == "" { + if args.Node == "" || (args.Address == "" && !args.SkipNodeUpdate) { return fmt.Errorf("Must provide node and address") } if args.ID != "" { diff --git a/agent/structs/structs.go b/agent/structs/structs.go index ca6628d130..cf8961f8bc 100644 --- a/agent/structs/structs.go +++ b/agent/structs/structs.go @@ -482,6 +482,11 @@ type HealthCheck struct { ServiceName string // optional service name ServiceTags []string // optional service tags + HTTP string `json:",omitempty"` + TCP string `json:",omitempty"` + Interval string `json:",omitempty"` + Timeout string `json:",omitempty"` + RaftIndex } diff --git a/api/agent.go b/api/agent.go index 533b245578..a53ab386eb 100644 --- a/api/agent.go +++ b/api/agent.go @@ -15,6 +15,10 @@ type AgentCheck struct { Output string ServiceID string ServiceName string + HTTP string + TCP string + Interval string + Timeout string } // AgentService represents a service known to the agent diff --git a/api/catalog.go b/api/catalog.go index babfc9a1df..08da6e16ea 100644 --- a/api/catalog.go +++ b/api/catalog.go @@ -42,6 +42,7 @@ type CatalogRegistration struct { Datacenter string Service *AgentService Check *AgentCheck + SkipNodeUpdate bool } type CatalogDeregistration struct { diff --git a/api/health.go b/api/health.go index 38c105fdb9..ebdd2a47d7 100644 --- a/api/health.go +++ b/api/health.go @@ -34,6 +34,11 @@ type HealthCheck struct { ServiceID string ServiceName string ServiceTags []string + + HTTP string + TCP string + Interval string + Timeout string } // HealthChecks is a collection of HealthCheck structs.