Good chance is that as soon as you do draw, badguy with a blade is going to retreat somehow. You won't need to shoot him. Comes down to, YES you are justified in discharging your weapon, but you don't really have to. Not shooting him will give yourself less of a problem in the long run. Besides, I understand that in such a case your weapon can be confiscated (for bureaucratic while) until everything is sorted out. Just sayin.
You're assuming the bad guy doesn't really want to hurt you, that the man or woman threatening you with deadly harm is somehow the hooker with a heart of gold and won't really go through with the violence they promise unless you comply with their demands.
I'm going to assume that if someone brandishes a weapon and THREATENS my life or the life of my family with it that they mean it. If my gun comes out of the holster again, it's going to fire once it's on target if the threat is still there, if they have backed away and dropped the knife, then there is no threat, if they're still holding the knife, the threat is still there regardless of their motion/movement and I'm emptying my magazine as quickly as I can.
The old Tueller drill showed that the average person could cover a distance of 21 feet in 1.5 seconds (the average draw time for the officers Sgt Tueller was working with with a belt holster with no concealment or pressure). Inside of that distance, a knife is deadly and faster than my gun. 21 feet is a LOT farther away than someone will be threatening you with a knife from. Someone inside of that distance, threatening me with a knife is a lethal threat and should be treated as such IMO. Not as a possible threat that may or may not run away when the gun is shown to them. Me drawing and waiting for them to react is a great way to get stabbed. Work it out with some airsoft and some training blades at your dojo sometime. If you are reactive to a knife person, you get the blade.
Now, if you're worried about the legal consequences of drawing your firearm in a defensive situation, well, let's examine that. It's kind of a push, if you draw and don't fire, you can be charged, if you draw and do fire, you can also be charged. It's dependent on the circumstances and a lot of times, how you react after the incident and your choice of words to the police. In my state, drawing and presenting or showing a firearm constitutes a deadly force situation. Whether I shoot or not, me drawing my firearm is the same level of force to the law. If I drew it and didn't use it, it could be argued that I didn't need to do so and I was the escalator of violence. I've seen that happen before. The BG argued that he was conversing with the GG and the GG freaked out, drew a gun and threatened him at which point, the BG drew his knife. His word against the BG's, prosecutor looked at it as an argument that got out of hand, and charged both people with assault. My buddy (the GG), pleaded it down to a misdemeanor and got some community service, but it could've been much worse for him. His lawyer told him that had he shot the guy, it would've been a pretty clear cut self defense case.
My one instance of dealing with a threatening person with a knife was a sobering one. I drew my 1911 and presented it, expecting the guy to back down. His response instead was "do you think you're fast enough to shoot me before I gut you?" and then charge me from about 8 feet away. Had his buddy not tackled him, I'd have gotten a hunting knife in my guts before I couldn't put a round into him.