mirror of https://github.com/k3s-io/k3s
No underscores in variable names. Add option to set hostname at command line.
parent
229ccb0fa3
commit
a047dc4930
|
@ -27,7 +27,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
kube_client "github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/coreos/go-etcd/etcd"
|
||||
|
@ -49,7 +49,7 @@ func main() {
|
|||
etcd.SetLogger(log.New(os.Stderr, "etcd ", log.LstdFlags))
|
||||
|
||||
controllerManager := registry.MakeReplicationManager(etcd.NewClient([]string{*etcd_servers}),
|
||||
kube_client.Client{
|
||||
client.Client{
|
||||
Host: "http://" + *master,
|
||||
})
|
||||
|
||||
|
|
|
@ -34,13 +34,14 @@ import (
|
|||
|
||||
var (
|
||||
file = flag.String("config", "", "Path to the config file")
|
||||
etcd_servers = flag.String("etcd_servers", "", "Url of etcd servers in the cluster")
|
||||
etcdServers = flag.String("etcd_servers", "", "Url of etcd servers in the cluster")
|
||||
syncFrequency = flag.Duration("sync_frequency", 10*time.Second, "Max period between synchronizing running containers and config")
|
||||
fileCheckFrequency = flag.Duration("file_check_frequency", 20*time.Second, "Duration between checking file for new data")
|
||||
httpCheckFrequency = flag.Duration("http_check_frequency", 20*time.Second, "Duration between checking http for new data")
|
||||
manifest_url = flag.String("manifest_url", "", "URL for accessing the container manifest")
|
||||
manifestUrl = flag.String("manifest_url", "", "URL for accessing the container manifest")
|
||||
address = flag.String("address", "127.0.0.1", "The address for the info server to serve on")
|
||||
port = flag.Uint("port", 10250, "The port for the info server to serve on")
|
||||
hostnameOverride = flag.String("hostname_override", "", "If non-empty, will use this string as identification instead of the actual hostname.")
|
||||
)
|
||||
|
||||
const dockerBinary = "/usr/bin/docker"
|
||||
|
@ -58,9 +59,12 @@ func main() {
|
|||
log.Fatal("Couldn't connnect to docker.")
|
||||
}
|
||||
|
||||
hostname, err := exec.Command("hostname", "-f").Output()
|
||||
if err != nil {
|
||||
log.Fatalf("Couldn't determine hostname: %v", err)
|
||||
hostname := []byte(*hostnameOverride)
|
||||
if string(hostname) == "" {
|
||||
hostname, err = exec.Command("hostname", "-f").Output()
|
||||
if err != nil {
|
||||
log.Fatalf("Couldn't determine hostname: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
my_kubelet := kubelet.Kubelet{
|
||||
|
@ -70,5 +74,5 @@ func main() {
|
|||
SyncFrequency: *syncFrequency,
|
||||
HTTPCheckFrequency: *httpCheckFrequency,
|
||||
}
|
||||
my_kubelet.RunKubelet(*file, *manifest_url, *etcd_servers, *address, *port)
|
||||
my_kubelet.RunKubelet(*file, *manifestUrl, *etcdServers, *address, *port)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue