mirror of https://github.com/k3s-io/k3s
Fixes golint errors in cmd/.
parent
28f7d60965
commit
c25f44c137
|
@ -33,8 +33,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
etcd_servers = flag.String("etcd_servers", "", "Servers for the etcd (http://ip:port).")
|
||||
master = flag.String("master", "", "The address of the Kubernetes API server")
|
||||
etcdServers = flag.String("etcd_servers", "", "Servers for the etcd (http://ip:port).")
|
||||
master = flag.String("master", "", "The address of the Kubernetes API server")
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -42,7 +42,7 @@ func main() {
|
|||
util.InitLogs()
|
||||
defer util.FlushLogs()
|
||||
|
||||
if len(*etcd_servers) == 0 || len(*master) == 0 {
|
||||
if len(*etcdServers) == 0 || len(*master) == 0 {
|
||||
glog.Fatal("usage: controller-manager -etcd_servers <servers> -master <master>")
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ func main() {
|
|||
etcd.SetLogger(util.NewLogger("etcd "))
|
||||
|
||||
controllerManager := controller.MakeReplicationManager(
|
||||
etcd.NewClient([]string{*etcd_servers}),
|
||||
etcd.NewClient([]string{*etcdServers}),
|
||||
client.New("http://"+*master, nil))
|
||||
|
||||
controllerManager.Run(10 * time.Second)
|
||||
|
|
|
@ -76,10 +76,10 @@ func startComponents(manifestURL string) (apiServerURL string) {
|
|||
m := master.New(servers, machineList, fakePodInfoGetter{}, nil, "")
|
||||
apiserver := httptest.NewServer(m.ConstructHandler("/api/v1beta1"))
|
||||
|
||||
kClient := client.New(apiserver.URL, nil)
|
||||
kClient.PollPeriod = time.Second * 1
|
||||
kClient.Sync = true
|
||||
controllerManager := controller.MakeReplicationManager(etcd.NewClient(servers), kClient)
|
||||
cl := client.New(apiserver.URL, nil)
|
||||
cl.PollPeriod = time.Second * 1
|
||||
cl.Sync = true
|
||||
controllerManager := controller.MakeReplicationManager(etcd.NewClient(servers), cl)
|
||||
|
||||
controllerManager.Run(1 * time.Second)
|
||||
|
||||
|
@ -268,7 +268,7 @@ func main() {
|
|||
glog.Infof("OK - found created pods: %#v", createdPods.List())
|
||||
}
|
||||
|
||||
// Serve a file for kubelet to read.
|
||||
// ServeCachedManifestFile serves a file for kubelet to read.
|
||||
func ServeCachedManifestFile() (servingAddress string) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.URL.Path == "/manifest" {
|
||||
|
|
|
@ -32,7 +32,8 @@ import (
|
|||
"github.com/golang/glog"
|
||||
)
|
||||
|
||||
const APP_VERSION = "0.1"
|
||||
// AppVersion is the current version of kubecfg.
|
||||
const AppVersion = "0.1"
|
||||
|
||||
// The flag package provides a default help printer via -h switch
|
||||
var (
|
||||
|
@ -97,7 +98,7 @@ func main() {
|
|||
defer util.FlushLogs()
|
||||
|
||||
if *versionFlag {
|
||||
fmt.Println("Version:", APP_VERSION)
|
||||
fmt.Println("Version:", AppVersion)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
|
@ -110,11 +111,11 @@ func main() {
|
|||
} else {
|
||||
masterServer = "http://localhost:8080"
|
||||
}
|
||||
parsedUrl, err := url.Parse(masterServer)
|
||||
parsedURL, err := url.Parse(masterServer)
|
||||
if err != nil {
|
||||
glog.Fatalf("Unable to parse %v as a URL\n", err)
|
||||
}
|
||||
if parsedUrl.Scheme != "" && parsedUrl.Scheme != "https" {
|
||||
if parsedURL.Scheme != "" && parsedURL.Scheme != "https" {
|
||||
secure = false
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ var (
|
|||
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 config files for new data")
|
||||
httpCheckFrequency = flag.Duration("http_check_frequency", 20*time.Second, "Duration between checking http for new data")
|
||||
manifestUrl = 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.")
|
||||
|
@ -82,12 +82,12 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
my_kubelet := kubelet.Kubelet{
|
||||
k := kubelet.Kubelet{
|
||||
Hostname: string(hostname),
|
||||
DockerClient: dockerClient,
|
||||
FileCheckFrequency: *fileCheckFrequency,
|
||||
SyncFrequency: *syncFrequency,
|
||||
HTTPCheckFrequency: *httpCheckFrequency,
|
||||
}
|
||||
my_kubelet.RunKubelet(*dockerEndpoint, *config, *manifestUrl, *etcdServers, *address, *port)
|
||||
k.RunKubelet(*dockerEndpoint, *config, *manifestURL, *etcdServers, *address, *port)
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
config_file = flag.String("configfile", "/tmp/proxy_config", "Configuration file for the proxy")
|
||||
etcd_servers = flag.String("etcd_servers", "http://10.240.10.57:4001", "Servers for the etcd cluster (http://ip:port).")
|
||||
configFile = flag.String("configfile", "/tmp/proxy_config", "Configuration file for the proxy")
|
||||
etcdServers = flag.String("etcd_servers", "http://10.240.10.57:4001", "Servers for the etcd cluster (http://ip:port).")
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -39,18 +39,18 @@ func main() {
|
|||
// Set up logger for etcd client
|
||||
etcd.SetLogger(util.NewLogger("etcd "))
|
||||
|
||||
glog.Infof("Using configuration file %s and etcd_servers %s", *config_file, *etcd_servers)
|
||||
glog.Infof("Using configuration file %s and etcd_servers %s", *configFile, *etcdServers)
|
||||
|
||||
proxyConfig := config.NewServiceConfig()
|
||||
|
||||
// Create a configuration source that handles configuration from etcd.
|
||||
etcdClient := etcd.NewClient([]string{*etcd_servers})
|
||||
etcdClient := etcd.NewClient([]string{*etcdServers})
|
||||
config.NewConfigSourceEtcd(etcdClient,
|
||||
proxyConfig.GetServiceConfigurationChannel("etcd"),
|
||||
proxyConfig.GetEndpointsConfigurationChannel("etcd"))
|
||||
|
||||
// And create a configuration source that reads from a local file
|
||||
config.NewConfigSourceFile(*config_file,
|
||||
config.NewConfigSourceFile(*configFile,
|
||||
proxyConfig.GetServiceConfigurationChannel("file"),
|
||||
proxyConfig.GetEndpointsConfigurationChannel("file"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue