What is the grammar behind the phrase "all's well that ends well"? I understand what it means (all is well because it ended well) but could not for the life of me figure out how this meaning is derived from the original sentence. At first glance, it seems to have two verbs, which, as far as I can tell, is against all sorts of rules of English for a clause (all is well that ends well)? And what is the role of "that" in here? Is it to create a relative clause? Doesn't seem like it to me.
I'm dumbfounded by this phrase and I cannot understand its grammar at all. Any and all help is greatly appreciated!