Skip to content

Commit

Permalink
cmd/package-server-manager: add pprof endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
  • Loading branch information
stevekuznetsov committed Aug 1, 2023
1 parent 9a977fa commit 5b2fedd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/package-server-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
defaultNamespace = "openshift-operator-lifecycle-manager"
defaultMetricsPort = "0"
defaultHealthCheckPort = ":8080"
defaultPprofPort = ":6060"
leaderElectionConfigmapName = "packageserver-controller-lock"
)

Expand Down Expand Up @@ -57,6 +58,10 @@ func run(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
pprofAddr, err := cmd.Flags().GetString("pprof")
if err != nil {
return err
}

ctrl.SetLogger(zap.New(zap.UseDevMode(true)))
setupLog := ctrl.Log.WithName("setup")
Expand All @@ -76,6 +81,7 @@ func run(cmd *cobra.Command, args []string) error {
RenewDeadline: &le.RenewDeadline.Duration,
RetryPeriod: &le.RetryPeriod.Duration,
HealthProbeBindAddress: healthCheckAddr,
PprofBindAddress: pprofAddr,
Cache: cache.Options{
ByObject: map[client.Object]cache.ByObject{
&olmv1alpha1.ClusterServiceVersion{}: {
Expand Down
1 change: 1 addition & 0 deletions cmd/package-server-manager/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func newStartCmd() *cobra.Command {
cmd.Flags().String("name", defaultName, "configures the metadata.name for the packageserver csv resource")
cmd.Flags().String("namespace", defaultNamespace, "configures the metadata.namespace that contains the packageserver csv resource")
cmd.Flags().String("health", defaultHealthCheckPort, "configures the health check port that the kubelet is configured to probe")
cmd.Flags().String("pprof", defaultPprofPort, "configures the pprof port that the process exposes")
cmd.Flags().Bool("disable-leader-election", false, "configures whether leader election will be disabled")

return cmd
Expand Down

0 comments on commit 5b2fedd

Please sign in to comment.