Documentation ¶
Overview ¶
* Copyright FMR LLC <opensource@fidelity.com> * * SPDX-License-Identifier: Apache
Index ¶
- Constants
- func GetListResource(ctx context.Context, dr dynamic.ResourceInterface, ops runtime.Object, ...) ([]byte, error)
- func GetListResourceName(gvk *schema.GroupVersionKind)
- func GetSingleResourceName(gvk *schema.GroupVersionKind)
- func GetSingleResoure(ctx context.Context, dr dynamic.ResourceInterface, ops runtime.Object, ...) ([]byte, error)
- type GetResourceName
- type GetTargetResource
- type KubeClient
- func (kc *KubeClient) Get(ctx context.Context, obj runtime.Object, resName NamespacedName, ...) error
- func (kc *KubeClient) GetOwner(ctx context.Context, or metav1.OwnerReference, ns string) (metav1.Object, error)
- func (kc *KubeClient) List(ctx context.Context, obj runtime.Object, resName NamespacedName, ...) error
- func (kc *KubeClient) Scheme() *runtime.Scheme
- type NamespacedName
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 ¶
Click to show internal directories.
Click to hide internal directories.