mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 10:18:39 +00:00
This patch implements external monitoring of the Kube-OVN cluster. A new reconciler timed to run its reconcile loop at a fixed interval execs into the ovn-central pods and collects their cluster info. If the members' opinions about the cluster disagree, an alert is raised. Other issues with the distributed consensus are also highlighted. ```release-note [kubeovn,cozystack-controller] Implement the KubeOVN plunger, an external monitoring agent for the ovn-central cluster. ``` Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
32 lines
655 B
Go
32 lines
655 B
Go
package kubeovnplunger
|
||
|
||
import "github.com/cozystack/cozystack/pkg/ovnstatus"
|
||
|
||
func b2f(b bool) float64 {
|
||
if b {
|
||
return 1
|
||
}
|
||
return 0
|
||
}
|
||
|
||
// Pull a cluster UUID (cid) from any snapshots’ Local.CID (falls back to "")
|
||
func cidFromSnaps(snaps []ovnstatus.HealthSnapshot) string {
|
||
for _, s := range snaps {
|
||
if s.Local.CID != "" {
|
||
return s.Local.CID
|
||
}
|
||
}
|
||
return ""
|
||
}
|
||
|
||
// Map SID -> last local index to compute gaps (optional)
|
||
func leaderIndex(snaps []ovnstatus.HealthSnapshot, leaderSID string) (idx *int64) {
|
||
for _, s := range snaps {
|
||
if s.Local.SID == leaderSID && s.Local.Index > 0 {
|
||
v := s.Local.Index
|
||
return &v
|
||
}
|
||
}
|
||
return nil
|
||
}
|