California doesn't have stand your ground law. Which means if officer could safely retreat he should have done so. Now, I don't know if could or couldn't, but clearly shooting in a crowded store is extremely dangerous to bystanders. Also, it hasn't been reported that parents of the guy shot dead did anything to attack the officer, yet the officer shot them too. I bet if it were a regular citizen his behind would be sitting in jail right now.
"Off-duty police, like private citizens with firearm permits in California, are legally allowed to discharge their weapon in self-defense in the event of an imminent attack and if there is no ability to retreat from the situation, said Jody Armour, a law professor at USC."
Costco shooting: LAPD investigates off-duty officer who killed a man in crowded store