mirror of https://github.com/k3s-io/k3s
Fix nil map in full snapshot configmap reconcile
If a full reconcile wins the race against sync of an individual snapshot resource, or someone intentionally deletes the configmap, the data map could be nil and cause a crash.
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
(cherry picked from commit 319dca3e82
)
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/9216/head
parent
fe19faaf9a
commit
f95ab7aaf9
|
@ -252,6 +252,10 @@ func (e *etcdSnapshotHandler) reconcile() error {
|
|||
}
|
||||
}
|
||||
|
||||
if len(snapshots) > 0 && snapshotConfigMap.Data == nil {
|
||||
snapshotConfigMap.Data = map[string]string{}
|
||||
}
|
||||
|
||||
// Ensure keys for existing snapshots
|
||||
for sfKey, esf := range snapshots {
|
||||
sf := snapshotFile{}
|
||||
|
|
Loading…
Reference in New Issue