Skip to content

Commit

Permalink
Fixes golint errors in cmd/.
Browse files Browse the repository at this point in the history
  • Loading branch information
yugui committed Jul 8, 2014
1 parent 28f7d60 commit c25f44c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions cmd/controller-manager/controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@ 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() {
flag.Parse()
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>")
}

// Set up logger for etcd client
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)
Expand Down
10 changes: 5 additions & 5 deletions cmd/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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" {
Expand Down
9 changes: 5 additions & 4 deletions cmd/kubecfg/kubecfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -97,7 +98,7 @@ func main() {
defer util.FlushLogs()

if *versionFlag {
fmt.Println("Version:", APP_VERSION)
fmt.Println("Version:", AppVersion)
os.Exit(0)
}

Expand All @@ -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
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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)
}
10 changes: 5 additions & 5 deletions cmd/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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"))

Expand Down

0 comments on commit c25f44c

Please sign in to comment.