File tree Expand file tree Collapse file tree 4 files changed +37
-1
lines changed
Expand file tree Collapse file tree 4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ objectstore
103103objectstores
104104pluginConfiguration
105105postgresql
106+ pprof
106107primaryUpdateStrategy
107108rbac
108109rc
Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ func NewCmd() *cobra.Command {
3333 },
3434 }
3535
36+ cmd .Flags ().Bool ("pprof-server" ,
37+ false ,
38+ "If true it will start a pprof debug http server on localhost:6061. Defaults to false." ,
39+ )
40+ _ = viper .BindPFlag ("pprof-server" , cmd .Flags ().Lookup ("pprof-server" ))
41+
3642 _ = viper .BindEnv ("namespace" , "NAMESPACE" )
3743 _ = viper .BindEnv ("cluster-name" , "CLUSTER_NAME" )
3844 _ = viper .BindEnv ("pod-name" , "POD_NAME" )
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ func Start(ctx context.Context) error {
3333 namespace := viper .GetString ("namespace" )
3434
3535 controllerOptions := ctrl.Options {
36- Scheme : scheme ,
36+ PprofBindAddress : getPprofServerAddress (),
37+ Scheme : scheme ,
3738 Client : client.Options {
3839 // Important: the caching options below are used by
3940 // controller-runtime only.
@@ -129,3 +130,11 @@ func generateScheme(ctx context.Context) *runtime.Scheme {
129130
130131 return result
131132}
133+
134+ func getPprofServerAddress () string {
135+ if viper .GetBool ("pprof-server" ) {
136+ return "0.0.0.0:6061"
137+ }
138+
139+ return ""
140+ }
Original file line number Diff line number Diff line change 7474
7575For a complete list of supported options, refer to the
7676[official Barman Cloud documentation](https://docs.pgbarman.org/release/latest/).
77+
78+ ## Enable the pprof debug server for the sidecar
79+
80+ You can enable the instance sidecar's pprof debug HTTP server by adding the ` --pprof-server` flag to the container's
81+ arguments via `.spec.instanceSidecarConfiguration.additionalContainerArgs` in the `ObjectStore` resource.
82+
83+ This starts a pprof server on port 6061 inside the Pod.
84+
85+ # ## Example
86+
87+ ` ` ` yaml
88+ apiVersion: barmancloud.cnpg.io/v1
89+ kind: ObjectStore
90+ metadata:
91+ name: my-store
92+ spec:
93+ instanceSidecarConfiguration:
94+ additionalContainerArgs:
95+ - "--pprof-server"
96+ ` ` `
You can’t perform that action at this time.
0 commit comments