Renamed variables colliding with package names, and added TODOs on uncaught-errors

This commit is contained in:
Vallery Lancey 2019-01-27 15:26:25 -08:00
parent 65637e7621
commit c22d855612

View File

@ -280,6 +280,7 @@ func (o *Options) writeConfigFile() error {
if err != nil {
return err
}
// TODO handle error
defer configFile.Close()
if err := encoder.Encode(o.config, configFile); err != nil {
@ -342,11 +343,11 @@ func (o *Options) loadConfig(data []byte) (*kubeproxyconfig.KubeProxyConfigurati
if err != nil {
return nil, err
}
config, ok := configObj.(*kubeproxyconfig.KubeProxyConfiguration)
proxyConfig, ok := configObj.(*kubeproxyconfig.KubeProxyConfiguration)
if !ok {
return nil, fmt.Errorf("got unexpected config type: %v", gvk)
}
return config, nil
return proxyConfig, nil
}
func (o *Options) ApplyDefaults(in *kubeproxyconfig.KubeProxyConfiguration) (*kubeproxyconfig.KubeProxyConfiguration, error) {
@ -406,6 +407,7 @@ with the apiserver API to configure the proxy.`,
opts.AddFlags(cmd.Flags())
// TODO handle error
cmd.MarkFlagFilename("config", "yaml", "yml", "json")
return cmd
@ -462,8 +464,6 @@ func createClients(config componentbaseconfig.ClientConnectionConfiguration, mas
kubeConfig.AcceptContentTypes = config.AcceptContentTypes
kubeConfig.ContentType = config.ContentType
kubeConfig.QPS = config.QPS
//TODO make config struct use int instead of int32?
// https://github.com/kubernetes/kubernetes/issues/73375
kubeConfig.Burst = int(config.Burst)
client, err := clientset.NewForConfig(kubeConfig)
@ -523,18 +523,18 @@ func (s *ProxyServer) Run() error {
// Start up a metrics server if requested
if len(s.MetricsBindAddress) > 0 {
mux := mux.NewPathRecorderMux("kube-proxy")
healthz.InstallHandler(mux)
mux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
proxyMux := mux.NewPathRecorderMux("kube-proxy")
healthz.InstallHandler(proxyMux)
proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%s", s.ProxyMode)
})
mux.Handle("/metrics", prometheus.Handler())
proxyMux.Handle("/metrics", prometheus.Handler())
if s.EnableProfiling {
routes.Profiling{}.Install(mux)
routes.Profiling{}.Install(proxyMux)
}
configz.InstallHandler(mux)
configz.InstallHandler(proxyMux)
go wait.Until(func() {
err := http.ListenAndServe(s.MetricsBindAddress, mux)
err := http.ListenAndServe(s.MetricsBindAddress, proxyMux)
if err != nil {
utilruntime.HandleError(fmt.Errorf("starting metrics server failed: %v", err))
}