Skip to content
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
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pluginConfiguration
podName
postgres
postgresql
pprof
primaryUpdateStrategy
rbac
rc
Expand Down
7 changes: 7 additions & 0 deletions internal/cmd/instance/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func NewCmd() *cobra.Command {
},
}

cmd.Flags().String("pprof-server",
"",
"The address where pprof server should be exposed, for example: 0.0.0.0:6061. "+
"Empty string means disabled. Disabled by default",
)
_ = viper.BindPFlag("pprof-server", cmd.Flags().Lookup("pprof-server"))

_ = viper.BindEnv("namespace", "NAMESPACE")
_ = viper.BindEnv("cluster-name", "CLUSTER_NAME")
_ = viper.BindEnv("pod-name", "POD_NAME")
Expand Down
3 changes: 2 additions & 1 deletion internal/cnpgi/instance/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ func Start(ctx context.Context) error {
namespace := viper.GetString("namespace")

controllerOptions := ctrl.Options{
Scheme: scheme,
PprofBindAddress: viper.GetString("pprof-server"),
Scheme: scheme,
Client: client.Options{
// Important: the caching options below are used by
// controller-runtime only.
Expand Down
21 changes: 21 additions & 0 deletions web/docs/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,24 @@ spec:

For a complete list of supported options, refer to the
[official Barman Cloud documentation](https://docs.pgbarman.org/release/latest/).

## Enable the pprof debug server for the sidecar

You can enable the instance sidecar's pprof debug HTTP server by adding the `--pprof-server=<address>` flag to the container's
arguments via `.spec.instanceSidecarConfiguration.additionalContainerArgs`.

Pass a bind address in the form `<host>:<port>` (for example, `0.0.0.0:6061`).
An empty value disables the server (disabled by default).

### Example

```yaml
apiVersion: barmancloud.cnpg.io/v1
kind: ObjectStore
metadata:
name: my-store
spec:
instanceSidecarConfiguration:
additionalContainerArgs:
- "--pprof-server=0.0.0.0:6061"
```
Loading