mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
4d1f9eda9d
* Add functionality for etcd snapshot/restore to and from S3 compatible backends. * Update etcd restore functionality to extract and write certificates and configs from snapshot.
43 lines
1.0 KiB
Go
43 lines
1.0 KiB
Go
package managed
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/rancher/k3s/pkg/clientaccess"
|
|
"github.com/rancher/k3s/pkg/daemons/config"
|
|
)
|
|
|
|
var (
|
|
defaultDriver string
|
|
drivers []Driver
|
|
)
|
|
|
|
type Driver interface {
|
|
IsInitialized(ctx context.Context, config *config.Control) (bool, error)
|
|
Register(ctx context.Context, config *config.Control, handler http.Handler) (http.Handler, error)
|
|
Reset(ctx context.Context, reboostrap func() error, cleanCerts func()) error
|
|
Start(ctx context.Context, clientAccessInfo *clientaccess.Info) error
|
|
Test(ctx context.Context) error
|
|
Restore(ctx context.Context) error
|
|
EndpointName() string
|
|
Snapshot(ctx context.Context, config *config.Control) error
|
|
GetMembersClientURLs(ctx context.Context) ([]string, error)
|
|
RemoveSelf(ctx context.Context) error
|
|
}
|
|
|
|
func RegisterDriver(d Driver) {
|
|
drivers = append(drivers, d)
|
|
}
|
|
|
|
func Registered() []Driver {
|
|
return drivers
|
|
}
|
|
|
|
func Default() string {
|
|
if defaultDriver == "" && len(drivers) == 1 {
|
|
return drivers[0].EndpointName()
|
|
}
|
|
return defaultDriver
|
|
}
|