How to establish a set of validators in epoch

Hi,

I am reading code of libra. I can’t find any clue that how consensus setup a set of validators for an epoch. As validators may join in and go out, validators set should change from epoch to epoch, right? Can anybody give me an answer of following questions:
1, What triggers a new epoch?
2, How to setup a set of validators for epoch?