Merge pull request #10046 from cjcullen/fwfix

Allow passing through an explicit PROXY_SSH_USER.
This commit is contained in:
Brendan Burns 2015-06-18 13:13:19 -07:00
commit 5021dbc1a0
3 changed files with 14 additions and 13 deletions

View File

@ -501,7 +501,7 @@ EOF
cat <<EOF >>/etc/salt/minion.d/grains.conf cat <<EOF >>/etc/salt/minion.d/grains.conf
cloud_config: /etc/gce.conf cloud_config: /etc/gce.conf
advertise_address: '${EXTERNAL_IP}' advertise_address: '${EXTERNAL_IP}'
proxy_ssh_user: '${INSTANCE_PREFIX}' proxy_ssh_user: '${PROXY_SSH_USER}'
EOF EOF
fi fi
} }

View File

@ -22,7 +22,6 @@ import (
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
"os"
"path" "path"
"strconv" "strconv"
"strings" "strings"
@ -490,12 +489,7 @@ func (gce *GCECloud) AddSSHKeyToAllInstances(user string, keyData []byte) error
glog.Errorf("Could not get project: %v", err) glog.Errorf("Could not get project: %v", err)
return false, nil return false, nil
} }
hostname, err := os.Hostname() keyString := fmt.Sprintf("%s:%s %s@%s", user, strings.TrimSpace(string(keyData)), user, user)
if err != nil {
glog.Errorf("Could not get hostname: %v", err)
return false, nil
}
keyString := fmt.Sprintf("%s:%s %s@%s", user, strings.TrimSpace(string(keyData)), user, hostname)
found := false found := false
for _, item := range project.CommonInstanceMetadata.Items { for _, item := range project.CommonInstanceMetadata.Items {
if item.Key == "sshKeys" { if item.Key == "sshKeys" {

View File

@ -1663,6 +1663,11 @@ func (kl *Kubelet) admitPods(allPods []*api.Pod, podSyncTypes map[types.UID]Sync
func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) { func (kl *Kubelet) syncLoop(updates <-chan PodUpdate, handler SyncHandler) {
glog.Info("Starting kubelet main sync loop.") glog.Info("Starting kubelet main sync loop.")
for { for {
if !kl.containerRuntimeUp() {
time.Sleep(5 * time.Second)
glog.Infof("Skipping pod synchronization, container runtime is not up.")
continue
}
unsyncedPod := false unsyncedPod := false
podSyncTypes := make(map[types.UID]SyncPodType) podSyncTypes := make(map[types.UID]SyncPodType)
select { select {
@ -1923,11 +1928,7 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
} }
// Check whether container runtime can be reported as up. // Check whether container runtime can be reported as up.
containerRuntimeUp := func() bool { containerRuntimeUp := kl.containerRuntimeUp()
kl.runtimeMutex.Lock()
defer kl.runtimeMutex.Unlock()
return kl.lastTimestampRuntimeUp.Add(kl.runtimeUpThreshold).After(time.Now())
}()
currentTime := util.Now() currentTime := util.Now()
var newNodeReadyCondition api.NodeCondition var newNodeReadyCondition api.NodeCondition
@ -1990,6 +1991,12 @@ func (kl *Kubelet) setNodeStatus(node *api.Node) error {
return nil return nil
} }
func (kl *Kubelet) containerRuntimeUp() bool {
kl.runtimeMutex.Lock()
defer kl.runtimeMutex.Unlock()
return kl.lastTimestampRuntimeUp.Add(kl.runtimeUpThreshold).After(time.Now())
}
// tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0 // tryUpdateNodeStatus tries to update node status to master. If ReconcileCBR0
// is set, this function will also confirm that cbr0 is configured correctly. // is set, this function will also confirm that cbr0 is configured correctly.
func (kl *Kubelet) tryUpdateNodeStatus() error { func (kl *Kubelet) tryUpdateNodeStatus() error {