clientutil

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAnnotation added in v0.13.0

func AddAnnotation(o client.Object, key, value string)

AddAnnotation adds an annotation to the given object. If the annotation already exists, it overwrites its value.

func AddLabel added in v0.15.0

func AddLabel(o client.Object, key, value string)

AddLabel adds a label to the given object. If the label already exists, it overwrites its value.

func ClusterNameIndexer added in v0.16.4

func ClusterNameIndexer(obj client.Object) []string

ClusterNameIndexer is an indexer for controller to list Cluster objects based on name.

func DeleteYaml

func DeleteYaml(ctx context.Context, c client.Client, yaml []byte) error

func ObjectsToClientObjects added in v0.12.0

func ObjectsToClientObjects[T client.Object](objs []T) []client.Object

func RemoveAnnotation added in v0.19.0

func RemoveAnnotation(o client.Object, key string)

RemoveAnnotation removes an annotation from the given object.

func YamlToClientObjects

func YamlToClientObjects(yamlObjects []byte) ([]client.Object, error)

Types

type KubeClient

type KubeClient struct {
	// contains filtered or unexported fields
}

Kubeclient implements kubernetes.Client interface using a client.Client as the underlying implementation.

func NewKubeClient

func NewKubeClient(client client.Client) *KubeClient

func (*KubeClient) ApplyServerSide added in v0.18.0

func (c *KubeClient) ApplyServerSide(ctx context.Context, fieldManager string, obj kubernetes.Object, opts ...kubernetes.ApplyServerSideOption) error

ApplyServerSide creates or patches and object using server side logic.

func (*KubeClient) Create added in v0.15.2

func (c *KubeClient) Create(ctx context.Context, obj kubernetes.Object) error

Create saves the object obj in the Kubernetes cluster.

func (*KubeClient) Delete added in v0.15.2

func (c *KubeClient) Delete(ctx context.Context, obj kubernetes.Object) error

Delete deletes the given obj from Kubernetes cluster.

func (*KubeClient) DeleteAllOf added in v0.15.2

func (c *KubeClient) DeleteAllOf(ctx context.Context, obj kubernetes.Object, opts ...kubernetes.DeleteAllOfOption) error

DeleteAllOf deletes all objects of the given type matching the given options.

func (*KubeClient) Get

func (c *KubeClient) Get(ctx context.Context, name, namespace string, obj kubernetes.Object) error

Get retrieves an obj for the given name and namespace from the Kubernetes Cluster.

func (*KubeClient) List added in v0.15.2

func (c *KubeClient) List(ctx context.Context, list kubernetes.ObjectList) error

List retrieves list of objects. On a successful call, Items field in the list will be populated with the result returned from the server.

func (*KubeClient) Update added in v0.15.2

func (c *KubeClient) Update(ctx context.Context, obj kubernetes.Object) error

Update updates the given obj in the Kubernetes cluster.

Jump to

Keyboard shortcuts

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