You need to be in legal status to apply for CA immigration. It requires your current legal status when you submit you application and usually your legal status when your immigration visa is granted as well.