99 "encoding/json"
1010 "fmt"
1111 "net/http"
12- "net/http/pprof"
1312 "os"
1413 "os/signal"
1514 "runtime"
@@ -47,16 +46,13 @@ import (
4746 "github.com/Azure/azure-container-networking/store"
4847 "github.com/avast/retry-go/v3"
4948 "github.com/pkg/errors"
50- "github.com/prometheus/client_golang/prometheus/promhttp"
5149 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5250 "k8s.io/apimachinery/pkg/fields"
5351 "k8s.io/apimachinery/pkg/types"
5452 "k8s.io/client-go/kubernetes"
5553 ctrl "sigs.k8s.io/controller-runtime"
5654 "sigs.k8s.io/controller-runtime/pkg/cache"
5755 "sigs.k8s.io/controller-runtime/pkg/client"
58- "sigs.k8s.io/controller-runtime/pkg/healthz"
59- "sigs.k8s.io/controller-runtime/pkg/metrics"
6056)
6157
6258const (
@@ -334,12 +330,7 @@ func registerNode(httpc *http.Client, httpRestService cns.HTTPService, dncEP, in
334330}
335331
336332// sendRegisterNodeRequest func helps in registering the node until there is an error.
337- func sendRegisterNodeRequest (
338- httpc * http.Client ,
339- httpRestService cns.HTTPService ,
340- nodeRegisterRequest cns.NodeRegisterRequest ,
341- registerURL string ,
342- ) error {
333+ func sendRegisterNodeRequest (httpc * http.Client , httpRestService cns.HTTPService , nodeRegisterRequest cns.NodeRegisterRequest , registerURL string ) error {
343334 var body bytes.Buffer
344335 err := json .NewEncoder (& body ).Encode (nodeRegisterRequest )
345336 if err != nil {
@@ -999,9 +990,10 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
999990 })
1000991
1001992 manager , err := ctrl .NewManager (kubeConfig , ctrl.Options {
1002- Scheme : nodenetworkconfig .Scheme ,
1003- Namespace : "kube-system" , // TODO(rbtr): namespace should be in the cns config
1004- NewCache : nodeScopedCache ,
993+ Scheme : nodenetworkconfig .Scheme ,
994+ MetricsBindAddress : cnsconfig .MetricsBindAddress ,
995+ Namespace : "kube-system" , // TODO(rbtr): namespace should be in the cns config
996+ NewCache : nodeScopedCache ,
1005997 })
1006998 if err != nil {
1007999 return errors .Wrap (err , "failed to create manager" )
@@ -1020,27 +1012,6 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
10201012 return errors .Wrapf (err , "failed to setup reconciler with manager" )
10211013 }
10221014
1023- // adding some routes to the root serve mux
1024- mux := httpRestServiceImplementation .Listener .GetMux ()
1025-
1026- if cnsconfig .Debug {
1027- // add pprof endpoints
1028- mux .HandleFunc ("/debug/pprof/" , pprof .Index )
1029- mux .HandleFunc ("/debug/pprof/cmdline" , pprof .Cmdline )
1030- mux .HandleFunc ("/debug/pprof/profile" , pprof .Profile )
1031- mux .HandleFunc ("/debug/pprof/symbol" , pprof .Symbol )
1032- mux .HandleFunc ("/debug/pprof/trace" , pprof .Trace )
1033- }
1034-
1035- // add metrics endpoints
1036- mux .Handle ("/metrics" , promhttp .HandlerFor (metrics .Registry , promhttp.HandlerOpts {
1037- ErrorHandling : promhttp .HTTPErrorOnError ,
1038- }))
1039-
1040- // add healthz endpoints
1041- healthzhandler := healthz.Handler {}
1042- mux .Handle ("/healthz" , http .StripPrefix ("/healthz" , & healthzhandler ))
1043-
10441015 // Start the Manager which starts the reconcile loop.
10451016 // The Reconciler will send an initial NodeNetworkConfig update to the PoolMonitor, starting the
10461017 // Monitor's internal loop.
@@ -1085,7 +1056,6 @@ func InitializeCRDState(ctx context.Context, httpRestService cns.HTTPService, cn
10851056 }
10861057 }
10871058 }()
1088-
10891059 logger .Printf ("initialized and started SyncHostNCVersion loop" )
10901060
10911061 return nil
0 commit comments