Add authenticated TLS support to the client.

This commit is contained in:
Brendan Burns
2014-09-19 15:43:23 -07:00
parent 06316f4861
commit 8dff6f12d7
3 changed files with 45 additions and 4 deletions

View File

@@ -59,6 +59,9 @@ var (
templateStr = flag.String("template", "", "If present, parse this string as a golang template and use it for output printing")
imageName = flag.String("image", "", "Image used when updating a replicationController. Will apply to the first container in the pod template.")
apiVersion = flag.String("api_version", latest.Version, "The version of the API to use against this server.")
caFile = flag.String("certificate_authority", "", "Path to a cert. file for the certificate authority")
certFile = flag.String("client_certificate", "", "Path to a client certificate for TLS.")
keyFile = flag.String("client_key", "", "Path to a client key file for TLS.")
)
var parser = kubecfg.NewParser(map[string]runtime.Object{
@@ -173,6 +176,15 @@ func main() {
if err != nil {
glog.Fatalf("Error loading auth: %v", err)
}
if *caFile != "" {
auth.CAFile = *caFile
}
if *certFile != "" {
auth.CertFile = *certFile
}
if *keyFile != "" {
auth.KeyFile = *keyFile
}
kubeClient, err = client.New(masterServer, *apiVersion, auth)
if err != nil {
glog.Fatalf("Can't configure client: %v", err)