client

package
v1.15.0-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 37 Imported by: 121

Documentation

Index

Constants

View Source
const (
	ConfigKeyNamespace = "namespace"
	ConfigKeyFeatures  = "features"
	ConfigKeyCACert    = "cacert"
	ConfigKeyColorized = "colorized"
)

Variables

This section is empty.

Functions

func CapBackoff added in v1.15.0

func CapBackoff(cap time.Duration) wait.Backoff

CapBackoff provides a backoff with a set backoff cap

func Config

func Config(kubeconfig, kubecontext, baseName string, qps float32, burst int) (*rest.Config, error)

Config returns a *rest.Config, using either the kubeconfig (if specified) or an in-cluster configuration.

func CreateRetryGenerateName added in v1.12.1

func CreateRetryGenerateName(client kbclient.Client, ctx context.Context, obj kbclient.Object) error

func RetryOnErrorMaxBackOff added in v1.15.0

func RetryOnErrorMaxBackOff(maxDuration time.Duration, fn func() error) error

RetryOnErrorMaxBackOff accepts a patch function param, retrying when the error is not nil.

func RetryOnRetriableMaxBackOff added in v1.15.0

func RetryOnRetriableMaxBackOff(maxDuration time.Duration, fn func() error, retriable func(error) bool) error

RetryOnRetriableMaxBackOff accepts a patch function param, retrying when the provided retriable function returns true.

func SaveConfig added in v0.7.0

func SaveConfig(config VeleroConfig) error

SaveConfig saves the passed in config map to the Velero client configuration file.

Types

type Creator added in v0.5.0

type Creator interface {
	// Create creates an object.
	Create(obj *unstructured.Unstructured) (*unstructured.Unstructured, error)
}

Creator creates an object.

type Deletor added in v1.6.0

type Deletor interface {
	Delete(name string, opts metav1.DeleteOptions) error
}

Deletor deletes an object.

type Dynamic

Dynamic contains client methods that Velero needs for backing up and restoring resources.

type DynamicFactory

type DynamicFactory interface {
	// ClientForGroupVersionResource returns a Dynamic client for the given group/version
	// and resource for the given namespace.
	ClientForGroupVersionResource(gv schema.GroupVersion, resource metav1.APIResource, namespace string) (Dynamic, error)
	// DynamicSharedInformerFactory returns a DynamicSharedInformerFactory.
	DynamicSharedInformerFactory() dynamicinformer.DynamicSharedInformerFactory
}

DynamicFactory contains methods for retrieving dynamic clients for GroupVersionResources and GroupVersionKinds.

func NewDynamicFactory

func NewDynamicFactory(dynamicClient dynamic.Interface) DynamicFactory

NewDynamicFactory returns a new ClientPool-based dynamic factory.

type Factory

type Factory interface {
	// BindFlags binds common flags (--kubeconfig, --namespace) to the passed-in FlagSet.
	BindFlags(flags *pflag.FlagSet)
	// KubeClient returns a Kubernetes client. It uses the following priority to specify the cluster
	// configuration: --kubeconfig flag, KUBECONFIG environment variable, in-cluster configuration.
	KubeClient() (kubernetes.Interface, error)
	// DynamicClient returns a Kubernetes dynamic client. It uses the following priority to specify the cluster
	// configuration: --kubeconfig flag, KUBECONFIG environment variable, in-cluster configuration.
	DynamicClient() (dynamic.Interface, error)
	// KubebuilderClient returns a client for the controller runtime framework. It adds Kubernetes and Velero
	// types to its scheme. It uses the following priority to specify the cluster
	// configuration: --kubeconfig flag, KUBECONFIG environment variable, in-cluster configuration.
	KubebuilderClient() (kbclient.Client, error)
	// KubebuilderWatchClient returns a client with watcher for the controller runtime framework.
	// It adds Kubernetes and Velero types to its scheme. It uses the following priority to specify the cluster
	// configuration: --kubeconfig flag, KUBECONFIG environment variable, in-cluster configuration.
	KubebuilderWatchClient() (kbclient.WithWatch, error)
	// SetBasename changes the basename for an already-constructed client.
	// This is useful for generating clients that require a different user-agent string below the root `velero`
	// command, such as the server subcommand.
	SetBasename(string)
	// SetClientQPS sets the Queries Per Second for a client.
	SetClientQPS(float32)
	// SetClientBurst sets the Burst for a client.
	SetClientBurst(int)
	// ClientConfig returns a rest.Config struct used for client-go clients.
	ClientConfig() (*rest.Config, error)
	// Namespace returns the namespace which the Factory will create clients for.
	Namespace() string
}

Factory knows how to create a VeleroClient and Kubernetes client.

func NewFactory

func NewFactory(baseName string, config VeleroConfig) Factory

NewFactory returns a Factory.

type Getter added in v0.5.0

type Getter interface {
	// Get fetches an object by name.
	Get(name string, opts metav1.GetOptions) (*unstructured.Unstructured, error)
}

Getter gets an object.

type Lister added in v0.5.0

type Lister interface {
	// List lists all the objects of a given resource.
	List(metav1.ListOptions) (*unstructured.UnstructuredList, error)
}

Lister lists objects.

type Patcher added in v0.9.0

type Patcher interface {
	Patch(name string, data []byte) (*unstructured.Unstructured, error)
}

Patcher patches an object.

type StatusUpdater added in v1.9.0

type StatusUpdater interface {
	UpdateStatus(obj *unstructured.Unstructured, opts metav1.UpdateOptions) (*unstructured.Unstructured, error)
}

StatusUpdater updates status field of a object

type VeleroConfig added in v1.2.0

type VeleroConfig map[string]interface{}

VeleroConfig is a map of strings to interface{} for deserializing Velero client config options. The alias is a way to attach type-asserting convenience methods.

func LoadConfig added in v0.7.0

func LoadConfig() (VeleroConfig, error)

LoadConfig loads the Velero client configuration file and returns it as a VeleroConfig. If the file does not exist, an empty map is returned.

func (VeleroConfig) CACertFile added in v1.4.0

func (c VeleroConfig) CACertFile() string

func (VeleroConfig) Colorized added in v1.6.0

func (c VeleroConfig) Colorized() bool

func (VeleroConfig) Features added in v1.2.0

func (c VeleroConfig) Features() []string

func (VeleroConfig) Namespace added in v1.2.0

func (c VeleroConfig) Namespace() string

type Watcher added in v0.5.0

type Watcher interface {
	// Watch watches for changes to objects of a given resource.
	Watch(metav1.ListOptions) (watch.Interface, error)
}

Watcher watches objects.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL