diff --git a/cluster/saltbase/pillar/top.sls b/cluster/saltbase/pillar/top.sls index 10ec08c59a2..463168c7233 100755 --- a/cluster/saltbase/pillar/top.sls +++ b/cluster/saltbase/pillar/top.sls @@ -1,3 +1,4 @@ base: '*': - mine + - common diff --git a/cluster/saltbase/salt/apiserver/default b/cluster/saltbase/salt/apiserver/default index 5f446237a55..86b95775a21 100644 --- a/cluster/saltbase/salt/apiserver/default +++ b/cluster/saltbase/salt/apiserver/default @@ -1,5 +1,5 @@ {%- set ips = salt['mine.get']('roles:kubernetes-master', 'network.ip_addrs', 'grain').values() %} -DAEMON_ARGS="$DAEMON_ARGS -etcd_servers=http://{{ ips[0][0] }}:4001" +DAEMON_ARGS="$DAEMON_ARGS -etcd_servers=http://{{ ips[0][0] }}:4001 -minion_regexp '{{ pillar['instance_prefix'] }}.*'" MACHINES="{{ ','.join(salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', expr_form='grain').keys()) }}" DAEMON_ARGS="$DAEMON_ARGS --machines $MACHINES" diff --git a/cluster/saltbase/salt/apiserver/initd b/cluster/saltbase/salt/apiserver/initd index fb71ec8bc9b..e4a6d27b4a5 100644 --- a/cluster/saltbase/salt/apiserver/initd +++ b/cluster/saltbase/salt/apiserver/initd @@ -17,7 +17,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="The Kubernetes API server" NAME=apiserver DAEMON=/usr/local/bin/apiserver -DAEMON_ARGS="-cloud_provider gce " +DAEMON_ARGS="-cloud_provider gce" DAEMON_LOG_FILE=/var/log/$NAME.log PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME diff --git a/pkg/cloudprovider/cloud.go b/pkg/cloudprovider/cloud.go index 28a91b6a01a..a4504713e3e 100644 --- a/pkg/cloudprovider/cloud.go +++ b/pkg/cloudprovider/cloud.go @@ -38,6 +38,6 @@ type TCPLoadBalancer interface { type Instances interface { IPAddress(name string) (net.IP, error) - // Lists instances that match 'filter' which is a regular expression which must match the entire instance name + // Lists instances that match 'filter' which is a regular expression which must match the entire instance name (fqdn) List(filter string) ([]string, error) } diff --git a/pkg/cloudprovider/gce.go b/pkg/cloudprovider/gce.go index 83dee9ab431..5c03ceb8972 100644 --- a/pkg/cloudprovider/gce.go +++ b/pkg/cloudprovider/gce.go @@ -21,6 +21,7 @@ import ( "io/ioutil" "net" "net/http" + "os/exec" "strconv" "strings" "time" @@ -181,7 +182,31 @@ func (gce *GCECloud) IPAddress(instance string) (net.IP, error) { return ip, nil } +// This is hacky, compute the delta between hostame and hostname -f +func fqdnSuffix() (string, error) { + fullHostname, err := exec.Command("hostname", "-f").Output() + if err != nil { + return "", err + } + hostname, err := exec.Command("hostname").Output() + if err != nil { + return "", err + } + return strings.TrimSpace(string(fullHostname)[len(string(hostname)):]), nil +} + func (gce *GCECloud) List(filter string) ([]string, error) { + // GCE gives names without their fqdn suffix, so get that here for appending. + // This is needed because the kubelet looks for its jobs in /registry/hosts//pods + // We should really just replace this convention, with a negotiated naming protocol for kubelet's + // to register with the master. + suffix, err := fqdnSuffix() + if err != nil { + return []string{}, err + } + if len(suffix) > 0 { + suffix = "." + suffix + } listCall := gce.service.Instances.List(gce.projectID, gce.zone) if len(filter) > 0 { listCall = listCall.Filter("name eq " + filter) @@ -192,7 +217,7 @@ func (gce *GCECloud) List(filter string) ([]string, error) { } var instances []string for _, instance := range res.Items { - instances = append(instances, instance.Name) + instances = append(instances, instance.Name+suffix) } return instances, nil } diff --git a/pkg/master/pod_cache.go b/pkg/master/pod_cache.go index a1a3b591716..33b6da00819 100644 --- a/pkg/master/pod_cache.go +++ b/pkg/master/pod_cache.go @@ -74,7 +74,7 @@ func (p *PodCache) updateContainerInfo(host, id string) error { func (p *PodCache) UpdateAllContainers() { pods, err := p.pods.ListPods(labels.Everything()) if err != nil { - glog.Errorf("Error synchronizing container: %#v", err) + glog.Errorf("Error synchronizing container list: %#v", err) return } for _, pod := range pods { diff --git a/release/release.sh b/release/release.sh index 6405ff2a744..c902ce58b45 100755 --- a/release/release.sh +++ b/release/release.sh @@ -25,6 +25,8 @@ set -e source $(dirname $0)/config.sh +source $(dirname ${BASH_SOURCE})/../cluster/${KUBE_CONFIG_FILE-"config-default.sh"} + cd $(dirname $0)/.. # First build the release tar. This gets copied on to the master and installed @@ -40,6 +42,11 @@ mkdir -p $MASTER_RELEASE_DIR/third_party/go echo "Building release tree" cp release/master-release-install.sh $MASTER_RELEASE_DIR/src/scripts/master-release-install.sh cp -r cluster/saltbase $MASTER_RELEASE_DIR/src/saltbase + +cat << EOF > $MASTER_RELEASE_DIR/src/saltbase/pillar/common.sls +instance_prefix: $INSTANCE_PREFIX-minion +EOF + cp -r third_party/src $MASTER_RELEASE_DIR/third_party/go/src function find_go_files() {