Moving to a foreign country and buying real estate

I am planning to move to a foreign country once i retire and buy a house for primary residency. If i buy a house big enough that I can rent part of it, do I get taxed on the rental income? if so, how is the tax calculated since the rental space will a portion of the house?