client

package
v1.7.16 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package client is Kubernetes client for getting resource from Kubernetes cluster.

Package client is Kubernetes client for getting resource from Kubernetes cluster.

Index

Constants

This section is empty.

Variables

View Source
var (
	ServerSideApply = cli.Apply
	MergePatch      = cli.Merge
	NewSelector     = labels.NewSelector
)

Functions

func PodPredicates added in v1.7.13

func PodPredicates(filter func(pod *corev1.Pod) bool) builder.Predicates

PodPredicates returns a builder.Predicates with the given filter function.

Types

type Client

type Client interface {
	// Get retrieves an obj for the given object key from the Kubernetes Cluster.
	// obj must be a struct pointer so that obj can be updated with the response
	// returned by the Server.
	Get(ctx context.Context, name string, namespace string, obj k8s.Object, opts ...cli.GetOption) error
	// List retrieves list of objects for a given namespace and list options. On a
	// successful call, Items field in the list will be populated with the
	// result returned from the server.
	List(ctx context.Context, list cli.ObjectList, opts ...k8s.ListOption) error

	// Create saves the object obj in the Kubernetes cluster. obj must be a
	// struct pointer so that obj can be updated with the content returned by the Server.
	Create(ctx context.Context, obj k8s.Object, opts ...k8s.CreateOption) error

	// Delete deletes the given obj from Kubernetes cluster.
	Delete(ctx context.Context, obj k8s.Object, opts ...cli.DeleteOption) error

	// Update updates the given obj in the Kubernetes cluster. obj must be a
	// struct pointer so that obj can be updated with the content returned by the Server.
	Update(ctx context.Context, obj k8s.Object, opts ...cli.UpdateOption) error

	// Patch patches the given obj in the Kubernetes cluster. obj must be a
	// struct pointer so that obj can be updated with the content returned by the Server.
	Patch(ctx context.Context, obj k8s.Object, patch cli.Patch, opts ...cli.PatchOption) error

	// Watch watches the given obj for changes and takes the appropriate callbacks.
	Watch(ctx context.Context, obj cli.ObjectList, opts ...k8s.ListOption) (watch.Interface, error)

	// MatchingLabels filters the list/delete operation on the given set of labels.
	MatchingLabels(labels map[string]string) cli.MatchingLabels

	// LabelSelector creates labels.Selector for Options like ListOptions.
	LabelSelector(key string, op selection.Operator, vals []string) (labels.Selector, error)
}

func New

func New(opts ...Option) (_ Client, err error)

type Option

type Option func(*client) error

func WithSchemeBuilder

func WithSchemeBuilder(sb scheme.Builder) Option

type Patcher added in v1.7.12

type Patcher interface {
	// ApplyPodAnnotations applies the given annotations to the agent pod with server-side apply.
	ApplyPodAnnotations(ctx context.Context, name, namespace string, entries map[string]string) error
}

Patcher is an interface for patching resources with controller-runtime client.

func NewPatcher added in v1.7.12

func NewPatcher(fieldManager string) (Patcher, error)

Jump to

Keyboard shortcuts

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