mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	Export Prometheus metrics in kube-proxy
This commit is contained in:
		@@ -35,6 +35,7 @@ go_library(
 | 
				
			|||||||
        "//pkg/util/resourcecontainer:go_default_library",
 | 
					        "//pkg/util/resourcecontainer:go_default_library",
 | 
				
			||||||
        "//pkg/util/sysctl:go_default_library",
 | 
					        "//pkg/util/sysctl:go_default_library",
 | 
				
			||||||
        "//vendor:github.com/golang/glog",
 | 
					        "//vendor:github.com/golang/glog",
 | 
				
			||||||
 | 
					        "//vendor:github.com/prometheus/client_golang/prometheus",
 | 
				
			||||||
        "//vendor:github.com/spf13/cobra",
 | 
					        "//vendor:github.com/spf13/cobra",
 | 
				
			||||||
        "//vendor:github.com/spf13/pflag",
 | 
					        "//vendor:github.com/spf13/pflag",
 | 
				
			||||||
        "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
 | 
					        "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,6 +57,7 @@ import (
 | 
				
			|||||||
	utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
 | 
						utilsysctl "k8s.io/kubernetes/pkg/util/sysctl"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/golang/glog"
 | 
						"github.com/golang/glog"
 | 
				
			||||||
 | 
						"github.com/prometheus/client_golang/prometheus"
 | 
				
			||||||
	"github.com/spf13/cobra"
 | 
						"github.com/spf13/cobra"
 | 
				
			||||||
	"github.com/spf13/pflag"
 | 
						"github.com/spf13/pflag"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@@ -342,6 +343,7 @@ func (s *ProxyServer) Run() error {
 | 
				
			|||||||
		http.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
 | 
							http.HandleFunc("/proxyMode", func(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
			fmt.Fprintf(w, "%s", s.ProxyMode)
 | 
								fmt.Fprintf(w, "%s", s.ProxyMode)
 | 
				
			||||||
		})
 | 
							})
 | 
				
			||||||
 | 
							http.Handle("/metrics", prometheus.Handler())
 | 
				
			||||||
		configz.InstallHandler(http.DefaultServeMux)
 | 
							configz.InstallHandler(http.DefaultServeMux)
 | 
				
			||||||
		go wait.Until(func() {
 | 
							go wait.Until(func() {
 | 
				
			||||||
			err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)
 | 
								err := http.ListenAndServe(s.Config.HealthzBindAddress+":"+strconv.Itoa(int(s.Config.HealthzPort)), nil)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user