The structure is as follows:
It (subject) is (verb) what (relative pronoun) you deserve.
Relative what is equivalent to that which or the thing which, even something that:
It/Losing your job is what you deserve.
Ex: ... is something that you deserve.
Ex: ... is the thing which you deserve.
Ex: ... is that which you deserve.
- For Teachers