add utility for binding flags and building api server clients

This utility provides one stop shopping for a command line executable to get bind the correct flags, build the client config, and create a working client.  The code for usage reduces to something like this:

	authLoader := &PromptingAuthLoader{os.Stdin}
	clientBuilder := clientcmd.NewClientBuilder(authLoader)
	clientBuilder.BindFlags(cmds.PersistentFlags())
	apiClient, err := clientBuilder.BuildClient()

I made the flags congruent with kubectl and used kubectl as an example spot for usage.  This makes use of the auth config work in #2340 and the Bind and Build approach could be used to unify client creation and flag names.

@smarterclayton You've had an interest in this area.
That makes sense to me.


> On Nov 26, 2014, at 5:34 PM, Tim Hockin <notifications@github.com> wrote:
> 
> In pkg/client/clientcmd/client_builder.go:
> 
> > +	"fmt"
> > +	"os"
> > +	"reflect"
> > +
> > +	"github.com/spf13/pflag"
> > +
> > +	"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
> > +	"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
> > +	"github.com/GoogleCloudPlatform/kubernetes/pkg/clientauth"
> > +	"github.com/GoogleCloudPlatform/kubernetes/pkg/version"
> > +)
> > +
> > +// Builder are used to bind and interpret command line flags to make it easy to get an api server client
> > +type Builder interface {
> > +	// BindFlags must bind and keep track of all the flags required to build a client config object
> > +	BindFlags(flags *pflag.FlagSet)
> Just because they CAN be different doesn't mean they WILL be. simply being able to prefix them all with "k8s-" is "different" but not substantively so.
> 
> As a compromise, I could live with a lib that exposed the common flags and produced a set of common structs or an interface which was mandatory for any client binary inside our own codebase, but optional for clients like skydns. Bonus points if the flag names could be trivially prefixed, so that this lib was usable by skydns in a sane way.
> 
> —
> Reply to this email directly or view it on GitHub.
>