diff --git a/.chloggen/1997-expose-pprof-server.yaml b/.chloggen/1997-expose-pprof-server.yaml new file mode 100755 index 0000000000..3d31456001 --- /dev/null +++ b/.chloggen/1997-expose-pprof-server.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. operator, target allocator, github action) +component: operator + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add flag to enable support for the pprof server in the operator. + +# One or more tracking issues related to the change +issues: [1997] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/main.go b/main.go index c7538a3068..622a67a906 100644 --- a/main.go +++ b/main.go @@ -90,6 +90,7 @@ func main() { var ( metricsAddr string probeAddr string + pprofAddr string enableLeaderElection bool collectorImage string targetAllocatorImage string @@ -107,6 +108,7 @@ func main() { pflag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") pflag.StringVar(&probeAddr, "health-probe-addr", ":8081", "The address the probe endpoint binds to.") + pflag.StringVar(&pprofAddr, "pprof-addr", "", "The address to expose the pprof server. Default is empty string which disables the pprof server.") pflag.BoolVar(&enableLeaderElection, "enable-leader-election", false, "Enable leader election for controller manager. "+ "Enabling this will ensure there is only one active controller manager.") @@ -203,6 +205,7 @@ func main() { LeaseDuration: &leaseDuration, RenewDeadline: &renewDeadline, RetryPeriod: &retryPeriod, + PprofBindAddress: pprofAddr, WebhookServer: webhook.NewServer(webhook.Options{ Port: webhookPort, TLSOpts: optionsTlSOptsFuncs,