CIA director David Petraeus resigns over extramarital affair