For the most part, this is all legal. Prior to 1967, Americans risked losing their citizenship if they joined a foreign military or even voted in a foreign election. That year, the Supreme Court decision in Afroyim v. Rusk established that citizenship is a constitutional right and can't be stripped involuntarily. So, yo're free to join up with whatever military that will take you, as long as you don't engage in active hostilities against the U.S.
Ditto that......