Skip to content

Commit

Permalink
Merge pull request #527 from stevekuznetsov/skuznets/pprof-package-se…
Browse files Browse the repository at this point in the history
…rver-manager

OCPBUGS-17157: cmd/package-server-manager: add pprof endpoints
  • Loading branch information
openshift-merge-robot authored Aug 2, 2023
2 parents d5108bd + 5b2fedd commit 6413915
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 6413915

Please sign in to comment.