Trudeau’s resignation comes before a federal parliamentary election that must happen by October 2025.