plugin-barman-cloud/internal/cmd/instance/main.go
Leonardo Cecchi d3660c9ee6
feat: retention policy
This commit makes the Barman cloud plugin support the enforcement of
retention policy as provided by the barman-cloud tool suite.

The first recoverability point and the last successful backup are
shown in the status of the ObjectStore resource for each involved
server name.

feat: implement recovery window

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
2025-03-17 14:16:36 +01:00

46 lines
1.1 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")
return cmd
}