In June 2021 at the Brussels summit NATO leaders said that Ukraine
will eventually become a NATO country and would be given an "MAP"(Membership Action Plan).
(see item 69
https://www.nato.int/cps/en/natohq/news_185000.htm)
And for years prior, NATO countries were funneling in money to build up Ukraine's military. It was pretty clear where things were headed.
Russia had long said this was a red line. Russia tried again in December, through diplomacy to get NATO to agree to not allow Ukraine to join and to pull it's military equipment back from Eastern Europe, a demand which was rejected.
So the conditions to prevent conflict were clear. There was a long escalation leading up to this. Even back in the 90s foreign policy experts were warning that NATO expansion would lead to an eventual conflict with Russia. Russia kept complaining about this, and Ukraine was the red line. So they invaded to prevent it.
You can argue that Russia was not morally justified in invading, but you can't argue that they weren't provoked. If Russia or China were making the same moves in Canada we wouldn't like it either.