Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added pprof endpoint #978

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apis/config/v1beta1/configuration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ type ControllerManager struct {
// +optional
Health ControllerHealth `json:"health,omitempty"`

// PprofBindAddress is the TCP address that the controller should bind to
// for serving pprof.
// It can be set to "" or "0" to disable the pprof serving.
// Since pprof may contain sensitive information, make sure to protect it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are not exposing this port through a Service, it can only be used if you ssh into node to attach to the port, right?

Did you have a chance to test it?
Can you include some documentation? Although that can be done in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my mind, usually port-forward command is enough to reach the port of pod to surf web part (or cli) of pprof or even to take a dump. For security reasons it's better nothing to expose out of the cluster. #983

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, port-forward seems reasonable.

/approve
/lgtm

// before exposing it to public.
// +optional
PprofBindAddress string `json:"pprofBindAddress,omitempty"`

// Controller contains global configuration options for controllers
// registered within this manager.
// +optional
Expand Down
1 change: 1 addition & 0 deletions charts/kueue/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ managerConfig:
clientConnection:
qps: 50
burst: 100
#pprofBindAddress: :8082
#waitForPodsReady:
# enable: true
#manageJobsWithoutQueueName: true
Expand Down
1 change: 1 addition & 0 deletions config/components/manager/controller_manager_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ controller:
clientConnection:
qps: 50
burst: 100
#pprofBindAddress: :8082
#waitForPodsReady:
# enable: true
#manageJobsWithoutQueueName: true
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func addTo(o *ctrl.Options, cfg *configapi.Configuration) {
o.MetricsBindAddress = cfg.Metrics.BindAddress
}

if o.PprofBindAddress == "" && cfg.PprofBindAddress != "" {
o.PprofBindAddress = cfg.PprofBindAddress
}

if o.HealthProbeBindAddress == "" && cfg.Health.HealthProbeBindAddress != "" {
o.HealthProbeBindAddress = cfg.Health.HealthProbeBindAddress
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ health:
livenessEndpointName: live
metrics:
bindAddress: :8080
pprofBindAddress: :8082
leaderElection:
leaderElect: true
resourceName: c1f6bfd2.kueue.x-k8s.io
Expand Down Expand Up @@ -474,6 +475,7 @@ integrations:
ReadinessEndpointName: "ready",
LivenessEndpointName: "live",
MetricsBindAddress: configapi.DefaultMetricsBindAddress,
PprofBindAddress: ":8082",
LeaderElection: true,
LeaderElectionID: configapi.DefaultLeaderElectionID,
LeaderElectionNamespace: "namespace",
Expand Down