I'm guessing you are talking about a Class A with one of those powered bunks
A tension rod would work, but unless you get a good one that's a long span & I would think you would forever be fighting it.
My class C 31L came with a curtain. Maybe you could borrow the technology they use.... a ceiling track. Come to think of it, I had a similar deal in my popup to surround the pottie.
I wouldn't be a bit surprised if they didn't have some sort of curtain track system at IKEA that you could attach to the ceiling. Any curtains they have would likely be too long, but that would be an easy thing to hem up.....