client

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsResourceTypeNotFound added in v0.3.3

func IsResourceTypeNotFound(err error) bool

func IsSubResource added in v0.4.0

func IsSubResource(resource *metav1.APIResource) bool

Types

type APIGroupMap

type APIGroupMap struct {
	// index by cluster
	M map[string]*metav1.APIGroupList
	sync.RWMutex
}

type APIResourceMap

type APIResourceMap struct {
	// index by cluster
	M map[string][]*metav1.APIResourceList
	sync.RWMutex
}

type ErrorResourceTypeNotFound added in v0.3.3

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

func NewTypeNotFoundError added in v0.4.0

func NewTypeNotFoundError(message string) ErrorResourceTypeNotFound

func (ErrorResourceTypeNotFound) Error added in v0.3.3

type KubeClient

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

func NewKubeClient

func NewKubeClient(cfg *rest.Config, cluster string) (*KubeClient, error)

func (*KubeClient) ClientForGVK added in v0.4.3

func (*KubeClient) ConfigForResource

func (c *KubeClient) ConfigForResource(name, preferredVersion string) (rest.Config, error)

ConfigForResource generates the REST config of k8s client for the resource type and version

func (*KubeClient) DynamicClientForGroupKind added in v0.5.4

func (c *KubeClient) DynamicClientForGroupKind(gk metav1.GroupKind) (dynamic.NamespaceableResourceInterface, error)

DynamicClientForResource get dynamic client for resource

func (*KubeClient) DynamicClientForResource added in v0.4.1

func (c *KubeClient) DynamicClientForResource(resource, version string) (dynamic.NamespaceableResourceInterface, error)

DynamicClientForResource get dynamic client for resource

func (*KubeClient) GetApiResourceByGroupKind added in v0.5.3

func (c *KubeClient) GetApiResourceByGroupKind(gk metav1.GroupKind) (*metav1.APIResource, error)

GetApiResourceByGroupKind get api resource by GroupKind

func (*KubeClient) GetApiResourceByKind

func (c *KubeClient) GetApiResourceByKind(kind string) (*metav1.APIResource, error)

GetApiResourceByKind get api resource by kind

func (*KubeClient) GetApiResourceByKindInsensitive added in v0.4.7

func (c *KubeClient) GetApiResourceByKindInsensitive(kind string) (*metav1.APIResource, error)

GetApiResourceByKindInsensitive get api resource by kind, but ignore case when compare

func (*KubeClient) GetApiResourceByName

func (c *KubeClient) GetApiResourceByName(name, preferredVersion string) (*metav1.APIResource, error)

GetApiResourceByName gets APIResource by the resource type name and the preferred api version. If the preferredVersion not exist, the first available version will be returned.

func (*KubeClient) GetApiResourceList added in v0.3.4

func (c *KubeClient) GetApiResourceList() ([]*metav1.APIResourceList, error)

GetResourceList gets api resource list of the cluster.

func (*KubeClient) GetGroupVersionByName

func (c *KubeClient) GetGroupVersionByName(name, preferredVersion string) (schema.GroupVersion, error)

GetGroupVersionByName gets the group version of a resource by it's type name and the preferred api version.

func (*KubeClient) GetGroupVersionList added in v0.4.0

func (c *KubeClient) GetGroupVersionList() (*metav1.APIGroupList, error)

func (*KubeClient) GetResourceTypeByGroupKind added in v0.5.3

func (c *KubeClient) GetResourceTypeByGroupKind(gk metav1.GroupKind) (string, error)

GetResourceTypeByGroupKind gets the name of resource type by the resource Groupkind. eg: Deployment -> deployments

func (*KubeClient) GetResourceTypeByKind added in v0.3.4

func (c *KubeClient) GetResourceTypeByKind(kind string) (string, error)

GetResourceByKind gets the name of resource type by the resource kind. eg: Deployment -> deployments

func (*KubeClient) GetVersionByGroup

func (c *KubeClient) GetVersionByGroup(group string) (string, error)

GetVersionByGroup gets the preferred version of a group.

func (*KubeClient) IsClusterScopeResource added in v0.3.2

func (c *KubeClient) IsClusterScopeResource(kind string) bool

func (*KubeClient) IsNamespaceScoped added in v0.4.1

func (c *KubeClient) IsNamespaceScoped(resource string) (bool, error)

Jump to

Keyboard shortcuts

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