It would be literally my job to protect my country. So of course. Why an earth they would surrender?
What's the alternative? Let the enemy walk all over you and rape and kill your women and chidren and rob you blind? And after they walked over you they would just keep on going all over europe.
As far as I know, Ukraine did not "declare war", simply had to defend the country in order for such country to continue existing as an individual entity with its own government. If your question is if it was a wise decision to fight such a defence, I think that given the situation and knowing what we now know, it was a reasonable decision.