mirror of
https://github.com/tailscale/tailscale.git
synced 2025-07-30 07:43:42 +00:00
HealthV2 prototype WIP do not merge
This commit is contained in:
parent
e78055eb01
commit
a9a846fcf1
@ -86,6 +86,7 @@ type mapSession struct {
|
|||||||
lastDomain string
|
lastDomain string
|
||||||
lastDomainAuditLogID string
|
lastDomainAuditLogID string
|
||||||
lastHealth []string
|
lastHealth []string
|
||||||
|
lastHealthV2 []tailcfg.Health
|
||||||
lastPopBrowserURL string
|
lastPopBrowserURL string
|
||||||
lastTKAInfo *tailcfg.TKAInfo
|
lastTKAInfo *tailcfg.TKAInfo
|
||||||
lastNetmapSummary string // from NetworkMap.VeryConcise
|
lastNetmapSummary string // from NetworkMap.VeryConcise
|
||||||
@ -383,6 +384,9 @@ func (ms *mapSession) updateStateFromResponse(resp *tailcfg.MapResponse) {
|
|||||||
if resp.Health != nil {
|
if resp.Health != nil {
|
||||||
ms.lastHealth = resp.Health
|
ms.lastHealth = resp.Health
|
||||||
}
|
}
|
||||||
|
if resp.HealthV2 != nil {
|
||||||
|
ms.lastHealthV2 = resp.HealthV2
|
||||||
|
}
|
||||||
if resp.TKAInfo != nil {
|
if resp.TKAInfo != nil {
|
||||||
ms.lastTKAInfo = resp.TKAInfo
|
ms.lastTKAInfo = resp.TKAInfo
|
||||||
}
|
}
|
||||||
@ -802,6 +806,14 @@ func (ms *mapSession) sortedPeers() []tailcfg.NodeView {
|
|||||||
func (ms *mapSession) netmap() *netmap.NetworkMap {
|
func (ms *mapSession) netmap() *netmap.NetworkMap {
|
||||||
peerViews := ms.sortedPeers()
|
peerViews := ms.sortedPeers()
|
||||||
|
|
||||||
|
var healths []tailcfg.Health
|
||||||
|
for _, h := range ms.lastHealth {
|
||||||
|
healths = append(healths, tailcfg.Health{ID: "legacy", Title: "(debugging) legacy warning", Text: h})
|
||||||
|
}
|
||||||
|
for _, h := range ms.lastHealthV2 {
|
||||||
|
healths = append(healths, h)
|
||||||
|
}
|
||||||
|
|
||||||
nm := &netmap.NetworkMap{
|
nm := &netmap.NetworkMap{
|
||||||
NodeKey: ms.publicNodeKey,
|
NodeKey: ms.publicNodeKey,
|
||||||
PrivateKey: ms.privateNodeKey,
|
PrivateKey: ms.privateNodeKey,
|
||||||
@ -816,7 +828,7 @@ func (ms *mapSession) netmap() *netmap.NetworkMap {
|
|||||||
SSHPolicy: ms.lastSSHPolicy,
|
SSHPolicy: ms.lastSSHPolicy,
|
||||||
CollectServices: ms.collectServices,
|
CollectServices: ms.collectServices,
|
||||||
DERPMap: ms.lastDERPMap,
|
DERPMap: ms.lastDERPMap,
|
||||||
ControlHealth: ms.lastHealth,
|
ControlHealth: healths,
|
||||||
TKAEnabled: ms.lastTKAInfo != nil && !ms.lastTKAInfo.Disabled,
|
TKAEnabled: ms.lastTKAInfo != nil && !ms.lastTKAInfo.Disabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ type Tracker struct {
|
|||||||
ipnWantRunning bool
|
ipnWantRunning bool
|
||||||
ipnWantRunningLastTrue time.Time // when ipnWantRunning last changed false -> true
|
ipnWantRunningLastTrue time.Time // when ipnWantRunning last changed false -> true
|
||||||
anyInterfaceUp opt.Bool // empty means unknown (assume true)
|
anyInterfaceUp opt.Bool // empty means unknown (assume true)
|
||||||
controlHealth []string
|
controlHealth []tailcfg.Health
|
||||||
lastLoginErr error
|
lastLoginErr error
|
||||||
localLogConfigErr error
|
localLogConfigErr error
|
||||||
tlsConnectionErrors map[string]error // map[ServerName]error
|
tlsConnectionErrors map[string]error // map[ServerName]error
|
||||||
@ -637,7 +637,7 @@ func (t *Tracker) updateLegacyErrorWarnableLocked(key Subsystem, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Tracker) SetControlHealth(problems []string) {
|
func (t *Tracker) SetControlHealth(problems []tailcfg.Health) {
|
||||||
if t.nil() {
|
if t.nil() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1151,9 +1151,15 @@ func (t *Tracker) updateBuiltinWarnablesLocked() {
|
|||||||
|
|
||||||
if len(t.controlHealth) > 0 {
|
if len(t.controlHealth) > 0 {
|
||||||
for _, s := range t.controlHealth {
|
for _, s := range t.controlHealth {
|
||||||
t.setUnhealthyLocked(controlHealthWarnable, Args{
|
t.setUnhealthyLocked(&Warnable{
|
||||||
ArgError: s,
|
Code: WarnableCode(s.ID),
|
||||||
})
|
Title: s.Title,
|
||||||
|
Text: func(args Args) string {
|
||||||
|
return s.Text
|
||||||
|
},
|
||||||
|
Severity: SeverityHigh,
|
||||||
|
ImpactsConnectivity: s.ImpactsConnectivity,
|
||||||
|
}, nil)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
t.setHealthyLocked(controlHealthWarnable)
|
t.setHealthyLocked(controlHealthWarnable)
|
||||||
|
@ -1987,7 +1987,8 @@ type MapResponse struct {
|
|||||||
// Note that this package's type, due its use of a slice and omitempty, is
|
// Note that this package's type, due its use of a slice and omitempty, is
|
||||||
// unable to marshal a zero-length non-nil slice. The control server needs
|
// unable to marshal a zero-length non-nil slice. The control server needs
|
||||||
// to marshal this type using a separate type. See MapResponse docs.
|
// to marshal this type using a separate type. See MapResponse docs.
|
||||||
Health []string `json:",omitempty"`
|
Health []string `json:",omitempty"`
|
||||||
|
HealthV2 []Health `json:",omitempty"`
|
||||||
|
|
||||||
// SSHPolicy, if non-nil, updates the SSH policy for how incoming
|
// SSHPolicy, if non-nil, updates the SSH policy for how incoming
|
||||||
// SSH connections should be handled.
|
// SSH connections should be handled.
|
||||||
@ -2032,6 +2033,14 @@ type MapResponse struct {
|
|||||||
DefaultAutoUpdate opt.Bool `json:",omitempty"`
|
DefaultAutoUpdate opt.Bool `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Health struct {
|
||||||
|
ID string
|
||||||
|
Title string
|
||||||
|
Text string
|
||||||
|
Link string
|
||||||
|
ImpactsConnectivity bool
|
||||||
|
}
|
||||||
|
|
||||||
// ClientVersion is information about the latest client version that's available
|
// ClientVersion is information about the latest client version that's available
|
||||||
// for the client (and whether they're already running it).
|
// for the client (and whether they're already running it).
|
||||||
//
|
//
|
||||||
|
@ -59,7 +59,7 @@ type NetworkMap struct {
|
|||||||
// If empty, there are no known problems from the control plane's
|
// If empty, there are no known problems from the control plane's
|
||||||
// point of view, but the node might know about its own health
|
// point of view, but the node might know about its own health
|
||||||
// check problems.
|
// check problems.
|
||||||
ControlHealth []string
|
ControlHealth []tailcfg.Health
|
||||||
|
|
||||||
// TKAEnabled indicates whether the tailnet key authority should be
|
// TKAEnabled indicates whether the tailnet key authority should be
|
||||||
// enabled, from the perspective of the control plane.
|
// enabled, from the perspective of the control plane.
|
||||||
|
@ -163,6 +163,7 @@ func mapResponseContainsNonPatchFields(res *tailcfg.MapResponse) bool {
|
|||||||
res.PacketFilters != nil ||
|
res.PacketFilters != nil ||
|
||||||
res.UserProfiles != nil ||
|
res.UserProfiles != nil ||
|
||||||
res.Health != nil ||
|
res.Health != nil ||
|
||||||
|
res.HealthV2 != nil ||
|
||||||
res.SSHPolicy != nil ||
|
res.SSHPolicy != nil ||
|
||||||
res.TKAInfo != nil ||
|
res.TKAInfo != nil ||
|
||||||
res.DomainDataPlaneAuditLogID != "" ||
|
res.DomainDataPlaneAuditLogID != "" ||
|
||||||
|
Loading…
x
Reference in New Issue
Block a user