So in Harry Potter and the Deathly Hallows, Harry resents Dumbledore for never properly explaining this to him,
Harry thought of Godric’s Hollow, of graves Dumbledore had never mentioned there; he thought of mysterious objects left with- out explanation in Dumbledore’s will, and resentment swelled in the darkness. Why hadn’t Dumbledore told him? Why hadn’t he explained? Had Dumbledore actually cared about Harry at all? Or had Harry been nothing more than a tool to be polished and honed, but not trusted, never confided in?
Kreacher's tale, HP and Deathly Hallows
It isn't until much later that Harry finds out that Dumbledore knew he was going to die and wanted Snape to kill him. It makes sense at that point to be angry with Dumbledore for not training him better and telling him all he needed to know considering he wouldn't be around for too long. But at the end of HBP and the very beginning of DH, Harry thought Dumbledore's death was sudden and unexpected. At the end of HBP they had just returned with what they thought was a horcrux and would have got to work destroying it had it not been for the visit from the Death Eaters and the subsequent "murder" of Albus Dumbledore.
So why did Harry resent Dumbledore at the beginning of Deathly Hallows then?