Documentation ¶
Index ¶
- func IsResourceTypeNotFound(err error) bool
- func IsSubResource(resource *metav1.APIResource) bool
- type APIGroupMap
- type APIResourceMap
- type ErrorResourceTypeNotFound
- type KubeClient
- func (c *KubeClient) ClientForGVK(gvk schema.GroupVersionKind) (dynamic.NamespaceableResourceInterface, error)
- func (c *KubeClient) ConfigForResource(name string, preferredVersion string) (rest.Config, error)
- func (c *KubeClient) DynamicClientForResource(resource string, version string) (dynamic.NamespaceableResourceInterface, error)
- func (c *KubeClient) GetApiResourceByKind(kind string) (*metav1.APIResource, error)
- func (c *KubeClient) GetApiResourceByKindInsensitive(kind string) (*metav1.APIResource, error)
- func (c *KubeClient) GetApiResourceByName(name string, preferredVersion string) (*metav1.APIResource, error)
- func (c *KubeClient) GetApiResourceList() ([]*metav1.APIResourceList, error)
- func (c *KubeClient) GetGroupVersionByName(name string, preferredVersion string) (schema.GroupVersion, error)
- func (c *KubeClient) GetGroupVersionList() (*metav1.APIGroupList, error)
- func (c *KubeClient) GetResourceTypeByKind(kind string) (string, error)
- func (c *KubeClient) GetVersionByGroup(group string) (string, error)
- func (c *KubeClient) IsClusterScopeResource(kind string) bool
- func (c *KubeClient) IsNamespaceScoped(resource string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsResourceTypeNotFound ¶ added in v0.3.3
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
func (e ErrorResourceTypeNotFound) Error() string
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 (c *KubeClient) ClientForGVK(gvk schema.GroupVersionKind) (dynamic.NamespaceableResourceInterface, error)
func (*KubeClient) ConfigForResource ¶
ConfigForResource generates the REST config of k8s client for the resource type and version
func (*KubeClient) DynamicClientForResource ¶ added in v0.4.1
func (c *KubeClient) DynamicClientForResource(resource string, version string) (dynamic.NamespaceableResourceInterface, error)
DynamicClientForResource get dynamic client for resource
func (*KubeClient) GetApiResourceByKind ¶
func (c *KubeClient) GetApiResourceByKind(kind string) (*metav1.APIResource, error)
GetApiResourceByKindInsensitive 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 string, 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 string, 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) 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)