kubeclient

package
v0.0.0-...-599ae38 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

* Copyright FMR LLC <opensource@fidelity.com> * * SPDX-License-Identifier: Apache

Index

Constants

View Source
const (
	QPS_KEY       = "CLIENTGO_QPS"
	BURST_KEY     = "CLIENTGO_BURST"
	QPS_DEFAULT   = 50.0
	BURST_DEFAULT = 100
)
View Source
const RetrieveErrorMessage = "unable retrieve the resource using dynamic client"

Variables

This section is empty.

Functions

func GetListResource

func GetListResource(ctx context.Context, dr dynamic.ResourceInterface, ops runtime.Object, resName NamespacedName) ([]byte, error)

func GetListResourceName

func GetListResourceName(gvk *schema.GroupVersionKind)

Replace the suffix "List" for resource list.

func GetSingleResourceName

func GetSingleResourceName(gvk *schema.GroupVersionKind)

Return original gvk for single resource.

func GetSingleResoure

func GetSingleResoure(ctx context.Context, dr dynamic.ResourceInterface, ops runtime.Object, resName NamespacedName) ([]byte, error)

Types

type GetResourceName

type GetResourceName func(gvk *schema.GroupVersionKind)

type GetTargetResource

type GetTargetResource func(ctx context.Context, dr dynamic.ResourceInterface, ops runtime.Object, resName NamespacedName) ([]byte, error)

type KubeClient

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

func NewKubeClient

func NewKubeClient(ctx context.Context, cfg *restclient.Config, opts ...func(*KubeClient)) (*KubeClient, error)

func (*KubeClient) Get

func (kc *KubeClient) Get(ctx context.Context, obj runtime.Object, resName NamespacedName, getOps metav1.GetOptions) error

Usage examples: For k8s native resources: kubeCli, err := NewKubeClient(config) dep := &appsv1.Deployment{} err := kubeCli.Get(context.TODO(), dep, NamespacedName{}, metav1.GetOptions{}) dep.Status etc

CRD example: kubeCli, err := NewKubeClient(config, func(kc *Kubeclient) {_ = velerov1.AddToScheme(kc.Scheme())}) veleroBackup := (), &velerov1.Backup{} kubeCli.Get(context.TODO, veleroBackup, NamespacedName{}, metav1.GetOptions{}) veleroBackup.Spec etc

func (*KubeClient) GetOwner

func (kc *KubeClient) GetOwner(ctx context.Context, or metav1.OwnerReference, ns string) (metav1.Object, error)

GetOwner returns the owner resource

func (*KubeClient) List

func (kc *KubeClient) List(ctx context.Context, obj runtime.Object, resName NamespacedName, listOps metav1.ListOptions) error

func (*KubeClient) Scheme

func (kc *KubeClient) Scheme() *runtime.Scheme

type NamespacedName

type NamespacedName struct {
	Name      string
	Namespace string
}

Jump to

Keyboard shortcuts

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