The top mayoral aide who helped Rahm Emanuel put city employee pension funds on the road to solvency, avert a teachers strike and secure a $450 million windfall for Chicago Public Schools is calling it quits.

Mike Rendina is leaving his $180,000-a-year job as senior adviser to the mayor on Friday to accept a private sector opportunity he is still finalizing and refused to talk about. That will give Rendina the freedom to work part-time on “rebuilding” Emanuel’s re-election campaign.

That doesn’t mean the mayor has made a final decision to seek a third term — and face an angry electorate openly hostile to incumbents.

But Rendina, 37, said he would “be shocked if he doesn’t” run — and win.

“I see every day his fight. We have a governor who is constantly attacking Chicago. We have a president who’s constantly attacking Chicago. And I cannot see him stepping down from the challenge. And I can’t see anyone else out there better suited to defend and move our city forward,” Rendina said.

Emanuel survived Chicago’s first mayoral runoff only after spending $24 million to defeat County Commissioner Jesus “Chuy” Garcia, a relative political unknown. Emanuel now has just $1.6 million in the bank.

Still, Rendina said: “He’s Rahm Emanuel. … He’s never lost a campaign. … And I have no doubt that he’s gonna have the resources needed to run a strong and winning campaign.”

And how does the mayor plan to win back the shattered trust of African-American voters who re-elected him in 2015, even after he closed a record 50 public schools but have yet to forgive him for his handling of the Laquan McDonald shooting video?

“It’s been a year and a half since the … incident. We have a year and a half until the next election. The best way to win back voters is to earn their trust through governance the right way,” Rendina said.

If Emanuel wants to win them over “through governance the right way,” Rendina was asked, why it took a lawsuit by Illinois Attorney General Lisa Madigan to get Emanuel to agree to federal court oversight of the Chicago Police Department? The city also sought to dismiss a similar lawsuit just days before on the grounds that Emanuel’s “extensive, ongoing reform efforts” made the legal claims moot.

Emanuel, Rendina said, never specifically objected to a consent decree. “It’s always been about negotiating the right framework for the city and having the right partner,” Rendina said. “Without the attorney general stepping up, I’m not sure where we’d be right now. … Having a partner for a consent decree that has a law enforcement core — whether it’s the Department of Justice or the Attorney General — was important.”

Rendina said he had planned to leave City Hall at the end of May, when a marathon stalemate in Springfield ended with a state budget balanced through a state income tax increase.

Then Emanuel asked him to stay on to keep plugging on school funding reform. That campaign succeeded beyond the city’s wildest dreams.

Instead of $300 million, CPS got a $450 million windfall that authorizes a $125 million property tax increase for teacher pensions — on top of the $838 million already imposed for police, fire and teacher pensions and school construction.

That reduced the gap that must be filled with city funds to $80 million. Which is why Emanuel promised to assume $80 million in school security costs, using money saved by refinancing $3 billion in debt.

That doesn’t mean Chicago taxpayers are home free. Rendina said the mayor still intends to raise the monthly tax tacked onto Chicago telephone bills by 28 percent — both cellphones and land lines — to free up money to shore up the Laborers pension fund through 2023.

“We fought for that in Springfield. … There is no reason why the corporate fund should be subsidizing funding for public safety and emergency response,” Rendina said.

With that increase, Rendina added, “the Laborers should be fine through 2023.”

Now that he’s leaving, Rendina can reflect on the darkest days that followed the court-ordered release of the Laquan McDonald shooting video, when protesters spent months demanding Emanuel’s resignation.

“If you had a person of lesser character, they may not have made it through that. But he was incredibly focused and incredibly disciplined about approaching the job the same way every day. Because of that, you didn’t see defections. … People were incredibly loyal to him and to the city,” Rendina said. “That’s when you learn who’s a leader and who’s not a leader. Because he’s a leader, we were able to get through it and the team stuck together.”

Emanuel returned the favor, praising Rendina for “instincts and insights” that have “helped navigate the political landscape to move our city forward.”