Skip to content

Commit

Permalink
Write to IPAM checkpoint file immediately after reading from CRI
Browse files Browse the repository at this point in the history
The current migration logic has a corner case: if we upgrade
1.6->1.7->1.8 and _never_ see a pod create/delete during the 1.7
phase, then we never write the IPAM checkpoint file.

This change just writes the file immediately after reading state from
CRI, if in migration phase1.
  • Loading branch information
anguslees authored and jayanthvn committed Aug 14, 2020
1 parent e5952c4 commit e150b8e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/ipamd/datastore/data_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,16 @@ func (ds *DataStore) ReadBackingStore() error {
ds.log.Debugf("Recovered %s => %s/%s", allocation.IPAMKey, eni.ID, addr.Address)
}

if ds.CheckpointMigrationPhase == 1 {
// For phase1: write whatever we just read above from
// CRI to backingstore immediately - just in case we
// _never_ see an add/del request before we upgrade to
// phase2.
if err := ds.writeBackingStoreUnsafe(); err != nil {
return err
}
}

ds.log.Debugf("Completed ipam state recovery")
return nil
}
Expand Down

0 comments on commit e150b8e

Please sign in to comment.