mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
prevent snapshot save when snapshots are disabled (#3475)
* prevent snapshot save when snapshots are disabled
This commit is contained in:
parent
a4c992ce52
commit
238dc2086e
@ -127,16 +127,14 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
||||
serverConfig.ControlConfig.DisableControllerManager = cfg.DisableControllerManager
|
||||
serverConfig.ControlConfig.ClusterInit = cfg.ClusterInit
|
||||
serverConfig.ControlConfig.EncryptSecrets = cfg.EncryptSecrets
|
||||
serverConfig.ControlConfig.EtcdExposeMetrics = cfg.EtcdExposeMetrics
|
||||
serverConfig.ControlConfig.EtcdDisableSnapshots = cfg.EtcdDisableSnapshots
|
||||
|
||||
if !cfg.EtcdDisableSnapshots {
|
||||
serverConfig.ControlConfig.EtcdSnapshotName = cfg.EtcdSnapshotName
|
||||
serverConfig.ControlConfig.EtcdSnapshotCron = cfg.EtcdSnapshotCron
|
||||
serverConfig.ControlConfig.EtcdSnapshotDir = cfg.EtcdSnapshotDir
|
||||
serverConfig.ControlConfig.EtcdSnapshotRetention = cfg.EtcdSnapshotRetention
|
||||
|
||||
if cfg.EtcdDisableSnapshots {
|
||||
logrus.Info("ETCD snapshots are disabled")
|
||||
}
|
||||
serverConfig.ControlConfig.EtcdDisableSnapshots = cfg.EtcdDisableSnapshots
|
||||
serverConfig.ControlConfig.EtcdExposeMetrics = cfg.EtcdExposeMetrics
|
||||
serverConfig.ControlConfig.EtcdS3 = cfg.EtcdS3
|
||||
serverConfig.ControlConfig.EtcdS3Endpoint = cfg.EtcdS3Endpoint
|
||||
serverConfig.ControlConfig.EtcdS3EndpointCA = cfg.EtcdS3EndpointCA
|
||||
@ -146,6 +144,9 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
||||
serverConfig.ControlConfig.EtcdS3BucketName = cfg.EtcdS3BucketName
|
||||
serverConfig.ControlConfig.EtcdS3Region = cfg.EtcdS3Region
|
||||
serverConfig.ControlConfig.EtcdS3Folder = cfg.EtcdS3Folder
|
||||
} else {
|
||||
logrus.Info("ETCD snapshots are disabled")
|
||||
}
|
||||
|
||||
if cfg.ClusterResetRestorePath != "" && !cfg.ClusterReset {
|
||||
return errors.New("invalid flag use; --cluster-reset required with --cluster-reset-restore-path")
|
||||
|
@ -110,9 +110,11 @@ func (c *Cluster) Start(ctx context.Context) (<-chan struct{}, error) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !c.config.EtcdDisableSnapshots {
|
||||
if err := c.managedDB.StoreSnapshotData(ctx); err != nil {
|
||||
logrus.Errorf("Failed to record snapshots for cluster: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user