mirror of https://github.com/k3s-io/k3s
commit
212a393404
|
@ -1,3 +1,4 @@
|
||||||
base:
|
base:
|
||||||
'*':
|
'*':
|
||||||
- mine
|
- mine
|
||||||
|
- common
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{%- set ips = salt['mine.get']('roles:kubernetes-master', 'network.ip_addrs', 'grain').values() %}
|
{%- 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()) }}"
|
MACHINES="{{ ','.join(salt['mine.get']('roles:kubernetes-pool', 'network.ip_addrs', expr_form='grain').keys()) }}"
|
||||||
DAEMON_ARGS="$DAEMON_ARGS --machines $MACHINES"
|
DAEMON_ARGS="$DAEMON_ARGS --machines $MACHINES"
|
||||||
|
|
|
@ -17,7 +17,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
DESC="The Kubernetes API server"
|
DESC="The Kubernetes API server"
|
||||||
NAME=apiserver
|
NAME=apiserver
|
||||||
DAEMON=/usr/local/bin/apiserver
|
DAEMON=/usr/local/bin/apiserver
|
||||||
DAEMON_ARGS="-cloud_provider gce "
|
DAEMON_ARGS="-cloud_provider gce"
|
||||||
DAEMON_LOG_FILE=/var/log/$NAME.log
|
DAEMON_LOG_FILE=/var/log/$NAME.log
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
|
@ -38,6 +38,6 @@ type TCPLoadBalancer interface {
|
||||||
|
|
||||||
type Instances interface {
|
type Instances interface {
|
||||||
IPAddress(name string) (net.IP, error)
|
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)
|
List(filter string) ([]string, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os/exec"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -181,7 +182,31 @@ func (gce *GCECloud) IPAddress(instance string) (net.IP, error) {
|
||||||
return ip, nil
|
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) {
|
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/<fqdn>/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)
|
listCall := gce.service.Instances.List(gce.projectID, gce.zone)
|
||||||
if len(filter) > 0 {
|
if len(filter) > 0 {
|
||||||
listCall = listCall.Filter("name eq " + filter)
|
listCall = listCall.Filter("name eq " + filter)
|
||||||
|
@ -192,7 +217,7 @@ func (gce *GCECloud) List(filter string) ([]string, error) {
|
||||||
}
|
}
|
||||||
var instances []string
|
var instances []string
|
||||||
for _, instance := range res.Items {
|
for _, instance := range res.Items {
|
||||||
instances = append(instances, instance.Name)
|
instances = append(instances, instance.Name+suffix)
|
||||||
}
|
}
|
||||||
return instances, nil
|
return instances, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ func (p *PodCache) updateContainerInfo(host, id string) error {
|
||||||
func (p *PodCache) UpdateAllContainers() {
|
func (p *PodCache) UpdateAllContainers() {
|
||||||
pods, err := p.pods.ListPods(labels.Everything())
|
pods, err := p.pods.ListPods(labels.Everything())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Errorf("Error synchronizing container: %#v", err)
|
glog.Errorf("Error synchronizing container list: %#v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for _, pod := range pods {
|
for _, pod := range pods {
|
||||||
|
|
|
@ -25,6 +25,8 @@ set -e
|
||||||
|
|
||||||
source $(dirname $0)/config.sh
|
source $(dirname $0)/config.sh
|
||||||
|
|
||||||
|
source $(dirname ${BASH_SOURCE})/../cluster/${KUBE_CONFIG_FILE-"config-default.sh"}
|
||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
# First build the release tar. This gets copied on to the master and installed
|
# 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"
|
echo "Building release tree"
|
||||||
cp release/master-release-install.sh $MASTER_RELEASE_DIR/src/scripts/master-release-install.sh
|
cp release/master-release-install.sh $MASTER_RELEASE_DIR/src/scripts/master-release-install.sh
|
||||||
cp -r cluster/saltbase $MASTER_RELEASE_DIR/src/saltbase
|
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
|
cp -r third_party/src $MASTER_RELEASE_DIR/third_party/go/src
|
||||||
|
|
||||||
function find_go_files() {
|
function find_go_files() {
|
||||||
|
|
Loading…
Reference in New Issue