|
|
@ -3,6 +3,7 @@ package cluster
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"context"
|
|
|
|
"net/url"
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"runtime"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/k3s-io/kine/pkg/endpoint"
|
|
|
|
"github.com/k3s-io/kine/pkg/endpoint"
|
|
|
@ -102,15 +103,22 @@ func (c *Cluster) Start(ctx context.Context) (<-chan struct{}, error) {
|
|
|
|
// snapshots will be empty.
|
|
|
|
// snapshots will be empty.
|
|
|
|
if c.managedDB != nil {
|
|
|
|
if c.managedDB != nil {
|
|
|
|
go func() {
|
|
|
|
go func() {
|
|
|
|
for range ready {
|
|
|
|
for {
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
|
|
|
case <-ready:
|
|
|
|
if err := c.save(ctx); err != nil {
|
|
|
|
if err := c.save(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := c.managedDB.StoreSnapshotData(ctx); err != nil {
|
|
|
|
if err := c.managedDB.StoreSnapshotData(ctx); err != nil {
|
|
|
|
logrus.Errorf("Failed to record snapshots for cluster: %v", err)
|
|
|
|
logrus.Errorf("Failed to record snapshots for cluster: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
runtime.Gosched()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|