If someone tries to kill you, you are entitled to use reasonable force to stop them. Including if it's necessary to kill them to prevent them from killing you.
Hamas et al have consistently stated their intent, and have demonstrated they mean it.
Going on about the occupation is meaningless in this sense. How can the Israelis do anything other than totally defend themselves against those who would do them harm. How could they ever entertain ceding anything to those with such a stance? It would be suicide, and this has always been the case.
It is interesting that those trying to claim equivalence between the acts of Israel in defending their citizens right to peaceful life and Hamas' violent attempts to kill them, that they also try to portray this as a non-equivalent David Vs Goliath situation. Where despite everything, Hamas get to be terrorists but the Israelis have to show "restraint".
Hamas in fact have a 40,000 in number army, a massive arsenal - funded by Iran - and who knows what else. They also won the elections in Gaza. Collective punishment is wrong, sure, but there is also such a thing as collective responsibility. It is notable that the Israelis still send out warnings of impending operations despite all this.