@@ -6,9 +6,7 @@ package main
6
6
import (
7
7
"flag"
8
8
"fmt"
9
- "net/http"
10
9
"os"
11
- "time"
12
10
13
11
"github.com/spf13/pflag"
14
12
"k8s.io/apimachinery/pkg/runtime"
@@ -36,21 +34,14 @@ import (
36
34
"github.com/d2iq-labs/capi-runtime-extensions/pkg/handlers/servicelbgc"
37
35
)
38
36
39
- var (
40
- // Flags.
41
- profilerAddress string
42
- logOptions = logs .NewOptions ()
43
- )
37
+ // Flags.
38
+ var logOptions = logs .NewOptions ()
44
39
45
40
// initFlags initializes the flags.
46
41
func initFlags (fs * pflag.FlagSet ) {
47
42
// Initialize logs flags using Kubernetes component-base machinery.
48
43
logs .AddFlags (fs , logs .SkipLoggingConfigurationFlags ())
49
44
logsv1 .AddFlags (logOptions , fs )
50
-
51
- // Add test-extension specific flags
52
- fs .StringVar (& profilerAddress , "profiler-address" , "" ,
53
- "Bind address to expose the pprof profiler (e.g. localhost:6060)" )
54
45
}
55
46
56
47
func main () {
@@ -85,6 +76,9 @@ func main() {
85
76
"The address the probe endpoint binds to." ,
86
77
)
87
78
79
+ pflag .CommandLine .StringVar (& mgrOptions .PprofBindAddress , "profiler-address" , "" ,
80
+ "Bind address to expose the pprof profiler (e.g. localhost:6060)" )
81
+
88
82
calicoCNIConfig := & calico.CalicoCNIConfig {}
89
83
90
84
runtimeWebhookServerOpts := server .NewServerOptions ()
@@ -108,21 +102,6 @@ func main() {
108
102
// Add the klog logger in the context.
109
103
ctrl .SetLogger (klog .Background ())
110
104
111
- // Initialize the golang profiler server, if required.
112
- if profilerAddress != "" {
113
- klog .Infof ("Profiler listening for requests at %s" , profilerAddress )
114
- go func () {
115
- profilerServer := & http.Server {
116
- Addr : profilerAddress ,
117
- Handler : nil ,
118
- MaxHeaderBytes : 1 << 20 ,
119
- IdleTimeout : 90 * time .Second , // matches http.DefaultTransport keep-alive timeout
120
- ReadHeaderTimeout : 32 * time .Second ,
121
- }
122
- klog .Info (profilerServer .ListenAndServe ())
123
- }()
124
- }
125
-
126
105
signalCtx := ctrl .SetupSignalHandler ()
127
106
128
107
mgr , err := newManager (mgrOptions )
0 commit comments