From f0572f48b47eccda2e81d1bbf354c46d4347a810 Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Wed, 7 Nov 2018 02:08:38 +0200 Subject: [PATCH] Fix etcd snapshot --- cluster/defaults.go | 5 ++++- services/etcd.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cluster/defaults.go b/cluster/defaults.go index 291ea381..3601c45c 100644 --- a/cluster/defaults.go +++ b/cluster/defaults.go @@ -129,7 +129,10 @@ func (c *Cluster) setClusterServicesDefaults() { c.Services.Etcd.Image = c.SystemImages.Etcd // enable etcd snapshots by default - c.Services.Etcd.Snapshot = DefaultEtcdSnapshot + if c.Services.Etcd.Snapshot == nil { + defaultSnapshot := DefaultEtcdSnapshot + c.Services.Etcd.Snapshot = &defaultSnapshot + } serviceConfigDefaultsMap := map[*string]string{ &c.Services.KubeAPI.ServiceClusterIPRange: DefaultServiceClusterIPRange, diff --git a/services/etcd.go b/services/etcd.go index ff342e70..80575989 100644 --- a/services/etcd.go +++ b/services/etcd.go @@ -30,7 +30,7 @@ const ( type EtcdSnapshot struct { // Enable or disable snapshot creation - Snapshot bool + Snapshot *bool // Creation period of the etcd snapshots Creation string // Retention period of the etcd snapshots @@ -56,7 +56,7 @@ func RunEtcdPlane( if err := docker.DoRunContainer(ctx, host.DClient, imageCfg, hostCfg, EtcdContainerName, host.Address, ETCDRole, prsMap); err != nil { return err } - if etcdSnapshot.Snapshot { + if *etcdSnapshot.Snapshot == true { if err := RunEtcdSnapshotSave(ctx, host, prsMap, alpineImage, etcdSnapshot.Creation, etcdSnapshot.Retention, EtcdSnapshotContainerName, false); err != nil { return err }