mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-11 13:23:09 +01:00
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>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
// Package instance is the entrypoint of instance plugin
|
|
package instance
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
|
|
"github.com/cloudnative-pg/plugin-barman-cloud/internal/cnpgi/instance"
|
|
)
|
|
|
|
// NewCmd creates a new instance command
|
|
func NewCmd() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "instance",
|
|
Short: "Starts the Barman Cloud CNPG-I sidecar plugin",
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
requiredSettings := []string{
|
|
"namespace",
|
|
"cluster-name",
|
|
"pod-name",
|
|
"spool-directory",
|
|
}
|
|
|
|
for _, k := range requiredSettings {
|
|
if len(viper.GetString(k)) == 0 {
|
|
return fmt.Errorf("missing required %s setting", k)
|
|
}
|
|
}
|
|
|
|
return instance.Start(cmd.Context())
|
|
},
|
|
}
|
|
|
|
_ = viper.BindEnv("namespace", "NAMESPACE")
|
|
_ = viper.BindEnv("cluster-name", "CLUSTER_NAME")
|
|
_ = viper.BindEnv("pod-name", "POD_NAME")
|
|
_ = viper.BindEnv("pgdata", "PGDATA")
|
|
_ = viper.BindEnv("spool-directory", "SPOOL_DIRECTORY")
|
|
_ = viper.BindEnv("custom-cnpg-group", "CUSTOM_CNPG_GROUP")
|
|
_ = viper.BindEnv("custom-cnpg-version", "CUSTOM_CNPG_VERSIONXS")
|
|
_ = viper.BindEnv("pprof-server", "PLUGIN_PPROF_SERVER")
|
|
|
|
return cmd
|
|
}
|