Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterBackupStorageFactory(name string, factory Factory)
- type Config
- type Factory
- type Server
- func (bak *Server) CheckEqualIfDisabled(cluster *kstonev1alpha2.EtcdCluster) bool
- func (bak *Server) CheckEqualIfEnabled(cluster *kstonev1alpha2.EtcdCluster) bool
- func (bak *Server) CleanBackup(cluster *kstonev1alpha2.EtcdCluster) error
- func (bak *Server) CreateEtcdBackupByYaml(backup *backupapiv2.EtcdBackup) error
- func (bak *Server) DeleteEtcdBackup(name, namespace string) error
- func (bak *Server) Equal(cluster *kstonev1alpha2.EtcdCluster) bool
- func (bak *Server) GetEtcdBackup(name, namespace string) (*backupapiv2.EtcdBackup, error)
- func (bak *Server) SyncBackup(cluster *kstonev1alpha2.EtcdCluster) error
- func (bak *Server) UpdateEtcdBackup(backup *backupapiv2.EtcdBackup) (*backupapiv2.EtcdBackup, error)
- type Storage
- type StorageConfig
Constants ¶
const ( AnnoBackupConfig = "backup" BackupGroup = "etcd.database.coreos.com" BackupVersion = "v1beta2" BackupResource = "etcdbackups" BackupKind = "EtcdBackup" )
Variables ¶
var ( BackupSchema = schema.GroupVersionResource{ Group: BackupGroup, Version: BackupVersion, Resource: BackupResource, } )
var (
Providers = make(map[string]Factory)
)
Functions ¶
func RegisterBackupStorageFactory ¶
RegisterBackupStorageFactory registers the specified backup storage provider
Types ¶
type Config ¶
type Config struct { StorageType backupapiv2.BackupStorageType `json:"storageType"` StoragePolicy *backupapiv2.BackupPolicy `json:"backupPolicy,omitempty"` backupapiv2.BackupSource `json:",inline"` }
func GetBackupConfig ¶
func GetBackupConfig(cluster *kstonev1alpha2.EtcdCluster) (*Config, error)
type Factory ¶
type Factory func(cfg *StorageConfig) (Storage, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewBackupServer ¶
func NewBackupServer(clientBuilder util.ClientBuilder) (*Server, error)
NewBackupServer generates backup provider
func (*Server) CheckEqualIfDisabled ¶
func (bak *Server) CheckEqualIfDisabled(cluster *kstonev1alpha2.EtcdCluster) bool
CheckEqualIfDisabled checks whether the backup resource is not found if it is disabled
func (*Server) CheckEqualIfEnabled ¶
func (bak *Server) CheckEqualIfEnabled(cluster *kstonev1alpha2.EtcdCluster) bool
CheckEqualIfEnabled checks whether the backup resource is equal if it is enabled
func (*Server) CleanBackup ¶
func (bak *Server) CleanBackup(cluster *kstonev1alpha2.EtcdCluster) error
CleanBackup cleans the etcdbackup if it is disabled.
func (*Server) CreateEtcdBackupByYaml ¶
func (bak *Server) CreateEtcdBackupByYaml(backup *backupapiv2.EtcdBackup) error
CreateEtcdBackupByYaml creates etcd backup by yaml
func (*Server) DeleteEtcdBackup ¶
DeleteEtcdBackup deletes etcd backup
func (*Server) Equal ¶
func (bak *Server) Equal(cluster *kstonev1alpha2.EtcdCluster) bool
Equal checks whether the backup resource needs to be updated
func (*Server) GetEtcdBackup ¶
func (bak *Server) GetEtcdBackup(name, namespace string) (*backupapiv2.EtcdBackup, error)
GetEtcdBackup gets etcd backup
func (*Server) SyncBackup ¶
func (bak *Server) SyncBackup(cluster *kstonev1alpha2.EtcdCluster) error
SyncBackup synchronizes the etcdbackup if it is enabled.
func (*Server) UpdateEtcdBackup ¶
func (bak *Server) UpdateEtcdBackup(backup *backupapiv2.EtcdBackup) (*backupapiv2.EtcdBackup, error)
UpdateEtcdBackup updates etcd backup
type Storage ¶
type Storage interface { // List gets all backup files from object storage. List(cluster *v1alpha2.EtcdCluster) (interface{}, error) // Stat counts the number of backup file in the last day. Stat(objects interface{}) (int, error) }
Storage is an abstract, pluggable interface for etcd backup storage.
func GetBackupStorageProvider ¶
func GetBackupStorageProvider(name string, config *StorageConfig) (Storage, error)
GetBackupStorageProvider gets the specified backup storage provider
type StorageConfig ¶
type StorageConfig struct {
KubeCli kubernetes.Interface
}