Set DeregisterCriticalServiceAfter
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
184aa66543
commit
2cc740cfaf
|
|
@ -141,6 +141,11 @@ func mapCheck(config *AgentServiceCheck) *consul.AgentServiceCheck {
|
|||
return nil
|
||||
}
|
||||
|
||||
// After 1 min of downtime, deregister the service automatically
|
||||
deregisterCriticalServiceAfter := "1m"
|
||||
if config.DeregisterCriticalServiceAfter != nil {
|
||||
deregisterCriticalServiceAfter = *config.DeregisterCriticalServiceAfter
|
||||
}
|
||||
return &consul.AgentServiceCheck{
|
||||
CheckID: config.CheckID,
|
||||
Name: config.Name,
|
||||
|
|
@ -161,7 +166,7 @@ func mapCheck(config *AgentServiceCheck) *consul.AgentServiceCheck {
|
|||
GRPCUseTLS: config.GRPCUseTLS,
|
||||
AliasNode: config.AliasNode,
|
||||
AliasService: config.AliasService,
|
||||
DeregisterCriticalServiceAfter: config.DeregisterCriticalServiceAfter,
|
||||
DeregisterCriticalServiceAfter: deregisterCriticalServiceAfter,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -369,7 +374,7 @@ type AgentServiceCheck struct {
|
|||
GRPC string
|
||||
AliasNode string
|
||||
AliasService string
|
||||
DeregisterCriticalServiceAfter string
|
||||
DeregisterCriticalServiceAfter *string
|
||||
Header map[string][]string
|
||||
TLSSkipVerify bool
|
||||
GRPCUseTLS bool
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
|
|
@ -262,7 +261,9 @@ func getRegistrationConfig(cfg configSpec, props map[string]string) (*consul.Age
|
|||
Name: "Dapr Health Status",
|
||||
CheckID: fmt.Sprintf("daprHealth:%s", id),
|
||||
Interval: "15s",
|
||||
HTTP: fmt.Sprintf("http://%s/v1.0/healthz", net.JoinHostPort(host, httpPort)),
|
||||
HTTP: fmt.Sprintf("http://%s:%s/v1.0/healthz", host, httpPort),
|
||||
// After 1 min of downtime, deregister the service automatically
|
||||
DeregisterCriticalServiceAfter: "1m",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue