Commit e9bc6bdc authored by Brian Downs's avatar Brian Downs

initialize map if nil

parent 59b52a15
......@@ -826,7 +826,8 @@ func (e *ETCD) Snapshot(ctx context.Context, config *config.Control) error {
return errors.Wrap(err, "failed to get config for etcd snapshot")
}
snapshotName := fmt.Sprintf("%s-%s-%d", e.config.EtcdSnapshotName, e.nodeName, time.Now().Unix())
nodeName := os.Getenv("NODE_NAME")
snapshotName := fmt.Sprintf("%s-%s-%d", e.config.EtcdSnapshotName, nodeName, time.Now().Unix())
snapshotPath := filepath.Join(snapshotDir, snapshotName)
logrus.Infof("Saving etcd snapshot to %s", snapshotPath)
......@@ -1028,6 +1029,10 @@ func (e *ETCD) StoreSnapshotData(ctx context.Context) error {
}
}
if snapshotConfigMap.Data == nil {
snapshotConfigMap.Data = make(map[string]string, 0)
}
// this node's entries to the ConfigMap
for k, v := range data {
snapshotConfigMap.Data[k] = v
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment