mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-11 21:23:12 +01:00
chore: add pprof server to operator and sidecar
We add the pprof server to the operator and the sidecar, to avoid any conflict with the CloudNativePG operator and clusters we use the port 6061 Closes #421 Signed-off-by: Jonathan Gonzalez V. <jonathan.gonzalez@enterprisedb.com>
This commit is contained in:
parent
a225902a36
commit
b7b62f1cb4
@ -40,6 +40,7 @@ func NewCmd() *cobra.Command {
|
|||||||
_ = viper.BindEnv("spool-directory", "SPOOL_DIRECTORY")
|
_ = viper.BindEnv("spool-directory", "SPOOL_DIRECTORY")
|
||||||
_ = viper.BindEnv("custom-cnpg-group", "CUSTOM_CNPG_GROUP")
|
_ = viper.BindEnv("custom-cnpg-group", "CUSTOM_CNPG_GROUP")
|
||||||
_ = viper.BindEnv("custom-cnpg-version", "CUSTOM_CNPG_VERSIONXS")
|
_ = viper.BindEnv("custom-cnpg-version", "CUSTOM_CNPG_VERSIONXS")
|
||||||
|
_ = viper.BindEnv("pprof-server", "PLUGIN_PPROF_SERVER")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,5 +84,7 @@ func NewCmd() *cobra.Command {
|
|||||||
|
|
||||||
_ = viper.BindEnv("sidecar-image", "SIDECAR_IMAGE")
|
_ = viper.BindEnv("sidecar-image", "SIDECAR_IMAGE")
|
||||||
|
|
||||||
|
_ = viper.BindEnv("pprof-server", "PPROF_SERVER")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,7 @@ func Start(ctx context.Context) error {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
PprofBindAddress: viper.GetString("pprof-server"),
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), controllerOptions)
|
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), controllerOptions)
|
||||||
|
|||||||
@ -332,7 +332,13 @@ func reconcilePodSpec(
|
|||||||
}
|
}
|
||||||
sidecarTemplate.RestartPolicy = ptr.To(corev1.ContainerRestartPolicyAlways)
|
sidecarTemplate.RestartPolicy = ptr.To(corev1.ContainerRestartPolicyAlways)
|
||||||
sidecarTemplate.Resources = config.resources
|
sidecarTemplate.Resources = config.resources
|
||||||
|
sidecarTemplate.Ports = []corev1.ContainerPort{
|
||||||
|
{
|
||||||
|
Name: "pprof",
|
||||||
|
ContainerPort: 6061,
|
||||||
|
Protocol: corev1.ProtocolTCP,
|
||||||
|
},
|
||||||
|
}
|
||||||
// merge the main container envs if they aren't already set
|
// merge the main container envs if they aren't already set
|
||||||
for _, container := range spec.Containers {
|
for _, container := range spec.Containers {
|
||||||
if container.Name == mainContainerName {
|
if container.Name == mainContainerName {
|
||||||
|
|||||||
@ -104,6 +104,7 @@ func Start(ctx context.Context) error {
|
|||||||
Metrics: metricsServerOptions,
|
Metrics: metricsServerOptions,
|
||||||
WebhookServer: webhookServer,
|
WebhookServer: webhookServer,
|
||||||
HealthProbeBindAddress: viper.GetString("health-probe-bind-address"),
|
HealthProbeBindAddress: viper.GetString("health-probe-bind-address"),
|
||||||
|
PprofBindAddress: viper.GetString("pprof-server"),
|
||||||
LeaderElection: viper.GetBool("leader-elect"),
|
LeaderElection: viper.GetBool("leader-elect"),
|
||||||
LeaderElectionID: "822e3f5c.cnpg.io",
|
LeaderElectionID: "822e3f5c.cnpg.io",
|
||||||
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
|
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
|
||||||
|
|||||||
@ -27,6 +27,9 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 9090
|
- containerPort: 9090
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
- containerPort: 6060
|
||||||
|
protocol: TCP
|
||||||
|
name: "pprof"
|
||||||
env:
|
env:
|
||||||
- name: SIDECAR_IMAGE
|
- name: SIDECAR_IMAGE
|
||||||
valueFrom:
|
valueFrom:
|
||||||
|
|||||||
@ -932,6 +932,9 @@ spec:
|
|||||||
ports:
|
ports:
|
||||||
- containerPort: 9090
|
- containerPort: 9090
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
- containerPort: 6060
|
||||||
|
name: pprof
|
||||||
|
protocol: TCP
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
initialDelaySeconds: 10
|
initialDelaySeconds: 10
|
||||||
periodSeconds: 10
|
periodSeconds: 10
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user