mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Renamed variables colliding with package names, and added TODOs on uncaught-errors
This commit is contained in:
parent
65637e7621
commit
c22d855612
@ -280,6 +280,7 @@ func (o *Options) writeConfigFile() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// TODO handle error
|
||||||
defer configFile.Close()
|
defer configFile.Close()
|
||||||
|
|
||||||
if err := encoder.Encode(o.config, configFile); err != nil {
|
if err := encoder.Encode(o.config, configFile); err != nil {
|
||||||
@ -342,11 +343,11 @@ func (o *Options) loadConfig(data []byte) (*kubeproxyconfig.KubeProxyConfigurati
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
config, ok := configObj.(*kubeproxyconfig.KubeProxyConfiguration)
|
proxyConfig, ok := configObj.(*kubeproxyconfig.KubeProxyConfiguration)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("got unexpected config type: %v", gvk)
|
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) {
|
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())
|
opts.AddFlags(cmd.Flags())
|
||||||
|
|
||||||
|
// TODO handle error
|
||||||
cmd.MarkFlagFilename("config", "yaml", "yml", "json")
|
cmd.MarkFlagFilename("config", "yaml", "yml", "json")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
@ -462,8 +464,6 @@ func createClients(config componentbaseconfig.ClientConnectionConfiguration, mas
|
|||||||
kubeConfig.AcceptContentTypes = config.AcceptContentTypes
|
kubeConfig.AcceptContentTypes = config.AcceptContentTypes
|
||||||
kubeConfig.ContentType = config.ContentType
|
kubeConfig.ContentType = config.ContentType
|
||||||
kubeConfig.QPS = config.QPS
|
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)
|
kubeConfig.Burst = int(config.Burst)
|
||||||
|
|
||||||
client, err := clientset.NewForConfig(kubeConfig)
|
client, err := clientset.NewForConfig(kubeConfig)
|
||||||
@ -523,18 +523,18 @@ func (s *ProxyServer) Run() error {
|
|||||||
|
|
||||||
// Start up a metrics server if requested
|
// Start up a metrics server if requested
|
||||||
if len(s.MetricsBindAddress) > 0 {
|
if len(s.MetricsBindAddress) > 0 {
|
||||||
mux := mux.NewPathRecorderMux("kube-proxy")
|
proxyMux := mux.NewPathRecorderMux("kube-proxy")
|
||||||
healthz.InstallHandler(mux)
|
healthz.InstallHandler(proxyMux)
|
||||||
mux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
proxyMux.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintf(w, "%s", s.ProxyMode)
|
fmt.Fprintf(w, "%s", s.ProxyMode)
|
||||||
})
|
})
|
||||||
mux.Handle("/metrics", prometheus.Handler())
|
proxyMux.Handle("/metrics", prometheus.Handler())
|
||||||
if s.EnableProfiling {
|
if s.EnableProfiling {
|
||||||
routes.Profiling{}.Install(mux)
|
routes.Profiling{}.Install(proxyMux)
|
||||||
}
|
}
|
||||||
configz.InstallHandler(mux)
|
configz.InstallHandler(proxyMux)
|
||||||
go wait.Until(func() {
|
go wait.Until(func() {
|
||||||
err := http.ListenAndServe(s.MetricsBindAddress, mux)
|
err := http.ListenAndServe(s.MetricsBindAddress, proxyMux)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
utilruntime.HandleError(fmt.Errorf("starting metrics server failed: %v", err))
|
utilruntime.HandleError(fmt.Errorf("starting metrics server failed: %v", err))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user