Compare commits

...

4 Commits

Author SHA1 Message Date
Armando Ruocco
8a14cd7d22
Merge 304f9de3a0 into 316828cc73 2025-11-07 09:49:18 +01:00
Marco Nenciarini
304f9de3a0
Merge branch 'main' into dev/pprof 2025-09-26 12:16:36 +02:00
Armando Ruocco
585814ed67
feat: migrato to string
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-09-24 11:46:00 +02:00
Armando Ruocco
3ace7f2836
feat: add pprof
This patch adds the pprof server feature to the instance sidecar container

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-09-24 11:45:57 +02:00
4 changed files with 31 additions and 1 deletions

View File

@ -128,6 +128,7 @@ pluginConfiguration
podName
postgres
postgresql
pprof
primaryUpdateStrategy
rbac
rc

View File

@ -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")

View File

@ -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.

View File

@ -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"
```