Specify sshUser, sshKeyfile in kube-apiserver manifest.

Trim space on ssh key so GCE doesn't treat it as 2 lines.
A couple other minor fixes.
This commit is contained in:
CJ Cullen 2015-05-29 14:29:17 -07:00
parent 5115fd5703
commit de9a5f43bc
3 changed files with 8 additions and 2 deletions

View File

@ -81,7 +81,7 @@
{% endif -%}
{% set params = address + " " + etcd_servers + " " + cloud_provider + " " + cloud_config + " " + runtime_config + " " + admission_control + " " + service_cluster_ip_range + " " + client_ca_file + " " + basic_auth_file + " " + min_request_timeout -%}
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + bind_address + " " + pillar['log_level'] + " " + advertise_address -%}
{% set params = params + " " + cluster_name + " " + cert_file + " " + key_file + " --secure_port=" + secure_port + " " + token_auth_file + " " + bind_address + " " + pillar['log_level'] + " " + advertise_address + " --ssh-user=root --ssh-keyfile=/.sshkeyfile"-%}
{
"apiVersion": "v1beta3",

View File

@ -17,6 +17,7 @@ limitations under the License.
package gce_cloud
import (
"bytes"
"fmt"
"io"
"io/ioutil"
@ -484,6 +485,7 @@ func (gce *GCECloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
if err != nil {
return err
}
keyData = bytes.TrimSpace(keyData)
found := false
for _, item := range project.CommonInstanceMetadata.Items {
if item.Key == "sshKeys" {

View File

@ -340,6 +340,8 @@ func New(c *Config) *Master {
serviceReadWriteIP: serviceReadWriteIP,
// TODO: serviceReadWritePort should be passed in as an argument, it may not always be 443
serviceReadWritePort: 443,
installSSHKey: c.InstallSSHKey,
}
var handlerContainer *restful.Container
@ -827,7 +829,9 @@ func (m *Master) generateSSHKey(user, keyfile string) error {
if err != nil {
return err
}
ioutil.WriteFile(keyfile, util.EncodePrivateKey(private), 0600)
if err := ioutil.WriteFile(keyfile, util.EncodePrivateKey(private), 0600); err != nil {
return err
}
data, err := util.EncodeSSHKey(public)
if err != nil {
return err