Documentation
¶
Index ¶
- func NewCmdBackup() *cobra.Command
- func NewDefaultBackupRunner(ocmConn *ocmsdk.Connection, opts ...DefaultBackupRunnerOption) *defaultBackupRunner
- type BuildOption
- type ClusterInfo
- type ClusterResolver
- type DefaultBackupRunnerOption
- type KubeClient
- type KubeClientBuilder
- type Printer
- type WithADPNamespace
- type WithBuilder
- type WithClusterID
- type WithElevation
- type WithLogger
- type WithPrinter
- type WithResolver
- type WithScheduleNameSuffix
- type WithVeleroContainer
- type WithVeleroLabelKey
- type WithVeleroLabelValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCmdBackup ¶
func NewDefaultBackupRunner ¶
func NewDefaultBackupRunner( ocmConn *ocmsdk.Connection, opts ...DefaultBackupRunnerOption, ) *defaultBackupRunner
NewDefaultBackupRunner constructs a defaultBackupRunner that will use ocmConn for all OCM API calls made during Run. opts are applied after defaults and may override any field, including Resolver and BuilderFactory (useful in tests to avoid real network calls).
Types ¶
type BuildOption ¶
type BuildOption interface {
// contains filtered or unexported methods
}
BuildOption configures a single call to KubeClientBuilder.Build.
type ClusterInfo ¶
ClusterInfo holds the canonical OCM internal IDs for the HCP cluster and its management cluster, as resolved by a ClusterResolver.
type ClusterResolver ¶
type ClusterResolver interface {
Resolve(ctx context.Context, clusterIdentifier string) (ClusterInfo, error)
}
ClusterResolver resolves an HCP cluster identifier to its canonical OCM IDs, including the management cluster. The OCM connection used for resolution is provided at construction time; the caller is responsible for its lifetime.
type DefaultBackupRunnerOption ¶
type DefaultBackupRunnerOption interface {
ConfigureDefaultBackupRunner(*defaultBackupRunnerConfig)
}
DefaultBackupRunnerOption is implemented by any type that can configure a defaultBackupRunnerConfig. Concrete implementations live in options.go.
type KubeClient ¶
type KubeClient interface {
// Get retrieves the resource identified by key and populates obj with the result.
// obj must be a pointer to an initialized struct (e.g. &corev1.Pod{}).
Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error
// List retrieves a collection of resources and populates list with the result.
// Namespace and label filters are passed as ListOptions (e.g. client.InNamespace, client.MatchingLabels).
List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
// Exec runs cmd inside the named container of the given pod and returns its stdout.
// It is only supported by clients constructed with a REST config and Clientset.
Exec(ctx context.Context, namespace, pod, container string, cmd []string) (string, error)
}
KubeClient is a generic interface for interacting with Kubernetes resources. It mirrors controller-runtime's Reader for Get and List, and adds Exec for in-pod command execution. Both privileged and unprivileged clients satisfy this interface, making them interchangeable in the runner and in tests.
type KubeClientBuilder ¶
type KubeClientBuilder interface {
Build(ctx context.Context, opts ...BuildOption) (KubeClient, error)
}
KubeClientBuilder creates KubeClient instances. Callers express their requirements via BuildOption values; the builder interprets them and performs whatever login or elevation is necessary.
type Printer ¶
Printer writes user-facing output (command results, hints) to an output stream. Diagnostic/progress logging uses *logrus.Logger instead.
type WithADPNamespace ¶
type WithADPNamespace string
WithADPNamespace overrides the namespace where the ADP / Velero resources live.
func (WithADPNamespace) ConfigureDefaultBackupRunner ¶
func (v WithADPNamespace) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithBuilder ¶
type WithBuilder struct{ Builder KubeClientBuilder }
WithBuilder overrides the KubeClientBuilder used to create KubeClient instances. Primarily useful in tests to avoid real backplane logins.
func (WithBuilder) ConfigureDefaultBackupRunner ¶
func (v WithBuilder) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithClusterID ¶
type WithClusterID struct{ ClusterID string }
WithClusterID sets the target cluster for a Build call.
type WithElevation ¶
type WithElevation struct{ Reason string }
WithElevation requests a backplane-cluster-admin session. Reason is the justification string passed to backplane and is required.
type WithLogger ¶
WithLogger overrides the logrus.Logger used for diagnostic output. By default a new logger writing to os.Stderr is created; callers may redirect it (e.g. to cmd.ErrOrStderr()) before passing it here.
func (WithLogger) ConfigureDefaultBackupRunner ¶
func (v WithLogger) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithPrinter ¶
type WithPrinter struct{ Printer Printer }
WithPrinter overrides the Printer used for user-facing output (backup results, status hints). The printer writes to os.Stdout by default.
func (WithPrinter) ConfigureDefaultBackupRunner ¶
func (v WithPrinter) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithResolver ¶
type WithResolver struct{ Resolver ClusterResolver }
WithResolver overrides the ClusterResolver used to translate a raw cluster identifier (from --cluster-id) into canonical OCM IDs. Primarily useful in tests to avoid real OCM calls.
func (WithResolver) ConfigureDefaultBackupRunner ¶
func (v WithResolver) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithScheduleNameSuffix ¶
type WithScheduleNameSuffix string
WithScheduleNameSuffix overrides the suffix appended to the cluster ID to form the schedule name.
func (WithScheduleNameSuffix) ConfigureDefaultBackupRunner ¶
func (v WithScheduleNameSuffix) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithVeleroContainer ¶
type WithVeleroContainer string
WithVeleroContainer overrides the name of the container inside the Velero pod to exec into.
func (WithVeleroContainer) ConfigureDefaultBackupRunner ¶
func (v WithVeleroContainer) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithVeleroLabelKey ¶
type WithVeleroLabelKey string
WithVeleroLabelKey overrides the pod label key used to locate the Velero pod.
func (WithVeleroLabelKey) ConfigureDefaultBackupRunner ¶
func (v WithVeleroLabelKey) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)
type WithVeleroLabelValue ¶
type WithVeleroLabelValue string
WithVeleroLabelValue overrides the pod label value used to locate the Velero pod.
func (WithVeleroLabelValue) ConfigureDefaultBackupRunner ¶
func (v WithVeleroLabelValue) ConfigureDefaultBackupRunner(c *defaultBackupRunnerConfig)