US national security adviser Mike Waltz is leaving his post and is set to be replaced by secretary of state Marco Rubio.