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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// After 1 min of downtime, deregister the service automatically
|
||||||
|
deregisterCriticalServiceAfter := "1m"
|
||||||
|
if config.DeregisterCriticalServiceAfter != nil {
|
||||||
|
deregisterCriticalServiceAfter = *config.DeregisterCriticalServiceAfter
|
||||||
|
}
|
||||||
return &consul.AgentServiceCheck{
|
return &consul.AgentServiceCheck{
|
||||||
CheckID: config.CheckID,
|
CheckID: config.CheckID,
|
||||||
Name: config.Name,
|
Name: config.Name,
|
||||||
|
|
@ -161,7 +166,7 @@ func mapCheck(config *AgentServiceCheck) *consul.AgentServiceCheck {
|
||||||
GRPCUseTLS: config.GRPCUseTLS,
|
GRPCUseTLS: config.GRPCUseTLS,
|
||||||
AliasNode: config.AliasNode,
|
AliasNode: config.AliasNode,
|
||||||
AliasService: config.AliasService,
|
AliasService: config.AliasService,
|
||||||
DeregisterCriticalServiceAfter: config.DeregisterCriticalServiceAfter,
|
DeregisterCriticalServiceAfter: deregisterCriticalServiceAfter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,7 +374,7 @@ type AgentServiceCheck struct {
|
||||||
GRPC string
|
GRPC string
|
||||||
AliasNode string
|
AliasNode string
|
||||||
AliasService string
|
AliasService string
|
||||||
DeregisterCriticalServiceAfter string
|
DeregisterCriticalServiceAfter *string
|
||||||
Header map[string][]string
|
Header map[string][]string
|
||||||
TLSSkipVerify bool
|
TLSSkipVerify bool
|
||||||
GRPCUseTLS bool
|
GRPCUseTLS bool
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
|
@ -262,7 +261,9 @@ func getRegistrationConfig(cfg configSpec, props map[string]string) (*consul.Age
|
||||||
Name: "Dapr Health Status",
|
Name: "Dapr Health Status",
|
||||||
CheckID: fmt.Sprintf("daprHealth:%s", id),
|
CheckID: fmt.Sprintf("daprHealth:%s", id),
|
||||||
Interval: "15s",
|
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