Expose SkipNodeUpdate field and some health check info in the http api

This commit is contained in:
Kyle Havlovitz 2017-10-20 13:39:13 -07:00 committed by Frank Schroeder
parent b6de1f7446
commit a7c42a6c2a
No known key found for this signature in database
GPG Key ID: 4D65C6EAEC87DECD
5 changed files with 16 additions and 1 deletions

View File

@ -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 != "" {

View File

@ -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
}

View File

@ -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

View File

@ -42,6 +42,7 @@ type CatalogRegistration struct {
Datacenter string
Service *AgentService
Check *AgentCheck
SkipNodeUpdate bool
}
type CatalogDeregistration struct {

View File

@ -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.