Compare commits

...

3 Commits

Author SHA1 Message Date
Marco Nenciarini
98c9d198ef
Merge 80edf33c7c into 921b20c249 2025-11-30 15:44:49 +01:00
Armando Ruocco
921b20c249
feat: add pprof-server support (#538)
Some checks failed
Deploy Docusaurus to GitHub Pages / build (push) Failing after 5s
Deploy Docusaurus to GitHub Pages / deploy (push) Has been skipped
release-please / release-please (push) Failing after 2s
Barman Base Image / build (push) Failing after 6s
Closes #421

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
2025-11-26 17:54:34 +01:00
Marco Nenciarini
80edf33c7c
fix(deps): use barman-cloud with fadvise
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
2025-11-12 08:31:39 -05:00
6 changed files with 34 additions and 4 deletions

View File

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

2
go.mod
View File

@ -7,7 +7,7 @@ toolchain go1.25.4
require ( require (
github.com/cert-manager/cert-manager v1.19.1 github.com/cert-manager/cert-manager v1.19.1
github.com/cloudnative-pg/api v1.27.0 github.com/cloudnative-pg/api v1.27.0
github.com/cloudnative-pg/barman-cloud v0.3.3 github.com/cloudnative-pg/barman-cloud v0.3.4-0.20251112132635-b853f955b90a
github.com/cloudnative-pg/cloudnative-pg v1.27.1 github.com/cloudnative-pg/cloudnative-pg v1.27.1
github.com/cloudnative-pg/cnpg-i v0.3.0 github.com/cloudnative-pg/cnpg-i v0.3.0
github.com/cloudnative-pg/cnpg-i-machinery v0.4.1 github.com/cloudnative-pg/cnpg-i-machinery v0.4.1

4
go.sum
View File

@ -18,8 +18,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudnative-pg/api v1.27.0 h1:uSUkF9X/0UZu1Xn5qI33qHVmzZrDKuuyoiRlsOmSTv4= github.com/cloudnative-pg/api v1.27.0 h1:uSUkF9X/0UZu1Xn5qI33qHVmzZrDKuuyoiRlsOmSTv4=
github.com/cloudnative-pg/api v1.27.0/go.mod h1:IWyAmuirffHiw6iIGD1p18BmZNb13TK9Os/wkp8ltDg= github.com/cloudnative-pg/api v1.27.0/go.mod h1:IWyAmuirffHiw6iIGD1p18BmZNb13TK9Os/wkp8ltDg=
github.com/cloudnative-pg/barman-cloud v0.3.3 h1:EEcjeV+IUivDpmyF/H/XGY1pGaKJ5LS5MYeB6wgGcak= github.com/cloudnative-pg/barman-cloud v0.3.4-0.20251112132635-b853f955b90a h1:L4eUkKUKvX3qXyKJvwbo2RiYzx6NW7DdWh0WGWeNVGI=
github.com/cloudnative-pg/barman-cloud v0.3.3/go.mod h1:5CM4MncAxAjnqxjDt0I5E/oVd7gsMLL0/o/wQ+vUSgs= github.com/cloudnative-pg/barman-cloud v0.3.4-0.20251112132635-b853f955b90a/go.mod h1:svkzKIpTe5qe6nQRd6MwmInRlL50RTYVpkgu959usus=
github.com/cloudnative-pg/cloudnative-pg v1.27.1 h1:w+bbtXyEPoaa7sZGXxbb8qJ+/bUGWQ3M48kbNUEpKlk= github.com/cloudnative-pg/cloudnative-pg v1.27.1 h1:w+bbtXyEPoaa7sZGXxbb8qJ+/bUGWQ3M48kbNUEpKlk=
github.com/cloudnative-pg/cloudnative-pg v1.27.1/go.mod h1:XbwCAlCm5fr+/A+v+qvMp8DHzVtJr2m0Y/TpKALw+Bk= github.com/cloudnative-pg/cloudnative-pg v1.27.1/go.mod h1:XbwCAlCm5fr+/A+v+qvMp8DHzVtJr2m0Y/TpKALw+Bk=
github.com/cloudnative-pg/cnpg-i v0.3.0 h1:5ayNOG5x68lU70IVbHDZQrv5p+bErCJ0mqRmOpW2jjE= github.com/cloudnative-pg/cnpg-i v0.3.0 h1:5ayNOG5x68lU70IVbHDZQrv5p+bErCJ0mqRmOpW2jjE=

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("namespace", "NAMESPACE")
_ = viper.BindEnv("cluster-name", "CLUSTER_NAME") _ = viper.BindEnv("cluster-name", "CLUSTER_NAME")
_ = viper.BindEnv("pod-name", "POD_NAME") _ = viper.BindEnv("pod-name", "POD_NAME")

View File

@ -52,7 +52,8 @@ func Start(ctx context.Context) error {
namespace := viper.GetString("namespace") namespace := viper.GetString("namespace")
controllerOptions := ctrl.Options{ controllerOptions := ctrl.Options{
Scheme: scheme, PprofBindAddress: viper.GetString("pprof-server"),
Scheme: scheme,
Client: client.Options{ Client: client.Options{
// Important: the caching options below are used by // Important: the caching options below are used by
// controller-runtime only. // controller-runtime only.

View File

@ -74,3 +74,24 @@ spec:
For a complete list of supported options, refer to the For a complete list of supported options, refer to the
[official Barman Cloud documentation](https://docs.pgbarman.org/release/latest/). [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"
```