Documentation ¶
Index ¶
- Constants
- func CleanseNamespace(ns string) string
- func FQN(ns, n string) string
- func IsAllNamespace(ns string) bool
- func IsAllNamespaces(ns string) bool
- func IsClusterScoped(ns string) bool
- func IsClusterWide(ns string) bool
- func IsNamespaced(ns string) bool
- func MetaFQN(m metav1.ObjectMeta) string
- func Namespaced(p string) (string, string)
- type APIClient
- func (a *APIClient) ActiveCluster() string
- func (a *APIClient) ActiveContext() string
- func (a *APIClient) ActiveNamespace() string
- func (a *APIClient) CachedDiscovery() (*disk.CachedDiscoveryClient, error)
- func (a *APIClient) CanI(ns string, gvr types.GVR, verbs ...string) (auth bool, err error)
- func (a *APIClient) CheckConnectivity() (status bool)
- func (a *APIClient) Config() types.Config
- func (a *APIClient) ConnectionOK() bool
- func (a *APIClient) CurrentNamespaceName() (string, error)
- func (a *APIClient) Dial() (kubernetes.Interface, error)
- func (a *APIClient) DynDial() (dynamic.Interface, error)
- func (a *APIClient) HasMetrics() bool
- func (a *APIClient) IsActiveNamespace(ns string) bool
- func (a *APIClient) MXDial() (*versioned.Clientset, error)
- func (a *APIClient) RestConfig() (*restclient.Config, error)
- func (a *APIClient) ServerVersion() (*version.Info, error)
- func (a *APIClient) ValidNamespaces() ([]v1.Namespace, error)
- type Config
- func (c *Config) CallTimeout() time.Duration
- func (c *Config) ClusterNameFromContext(ctx string) (string, error)
- func (c *Config) ClusterNames() ([]string, error)
- func (c *Config) ConfigAccess() (clientcmd.ConfigAccess, error)
- func (c *Config) ContextNames() ([]string, error)
- func (c *Config) Contexts() (map[string]*clientcmdapi.Context, error)
- func (c *Config) CurrentClusterName() (string, error)
- func (c *Config) CurrentContextName() (string, error)
- func (c *Config) CurrentGroupNames() ([]string, error)
- func (c *Config) CurrentNamespaceName() (string, error)
- func (c *Config) CurrentUserName() (string, error)
- func (c *Config) DelContext(n string) error
- func (c *Config) Flags() *genericclioptions.ConfigFlags
- func (c *Config) GetContext(n string) (*clientcmdapi.Context, error)
- func (c *Config) ImpersonateGroups() (string, error)
- func (c *Config) ImpersonateUser() (string, error)
- func (c *Config) NamespaceNames(nns []v1.Namespace) []string
- func (c *Config) RESTConfig() (*restclient.Config, error)
- func (c *Config) RawConfig() (clientcmdapi.Config, error)
- type ContainerMetrics
- type Factory
- func (f *Factory) CanForResource(ns string, gvr types.GVR, verbs ...string) (informers.GenericInformer, error)
- func (f *Factory) Client() types.Connection
- func (f *Factory) FactoryFor(ns string) di.DynamicSharedInformerFactory
- func (f *Factory) ForResource(ns string, gvr types.GVR) (informers.GenericInformer, error)
- func (f *Factory) Get(gvr types.GVR, path string, wait bool, sel labels.Selector) (runtime.Object, error)
- func (f *Factory) List(gvr types.GVR, ns string, wait bool, labels labels.Selector) ([]runtime.Object, error)
- func (f *Factory) SetActiveNS(ns string) error
- func (f *Factory) Start(ns string)
- func (f *Factory) Terminate()
- func (f *Factory) WaitForCacheSync()
- type Metrics
- type NodeMetrics
- type NodesMetrics
- type PodsMetrics
- type Revision
Constants ¶
const ( // NA Not available NA = "n/a" // NamespaceAll designates the fictional all namespace. NamespaceAll = "all" // AllNamespaces designates all namespaces. AllNamespaces = "" // ClusterScope designates a resource is not namespaced. ClusterScope = "-" // NotNamespaced designates a non resource namespace. NotNamespaced = "*" // BlankNamespace tracks an unspecified namespace. BlankNamespace = "" // DefaultNamespace tracks the default namespace. DefaultNamespace = "default" )
const ( // CallTimeout represents api call timeout limit. CallTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func CleanseNamespace ¶
CleanseNamespace ensures all ns maps to blank.
func IsAllNamespaces ¶
IsAllNamespaces returns true if all namespaces, false otherwise.
func IsClusterScoped ¶
IsClusterScoped returns true if resource is not namespaced.
func IsClusterWide ¶
IsClusterWide returns true if ns designates cluster scope, false otherwise.
func IsNamespaced ¶
IsNamespaced returns true if a specific ns is given.
func MetaFQN ¶
func MetaFQN(m metav1.ObjectMeta) string
MetaFQN returns a fully qualified resource name.
func Namespaced ¶
Namespaced converts a resource path to namespace and resource name.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient represents a Kubernetes api client.
func InitConnectionOrDie ¶
InitConnectionOrDie initialize connection from command line args. Checks for connectivity with the api server.
func (*APIClient) ActiveCluster ¶
ActiveCluster returns the current cluster name.
func (*APIClient) ActiveContext ¶ added in v0.11.2
ActiveContext returns the current context name.
func (*APIClient) ActiveNamespace ¶
ActiveNamespace returns the current namespace.
func (*APIClient) CachedDiscovery ¶ added in v0.8.4
func (a *APIClient) CachedDiscovery() (*disk.CachedDiscoveryClient, error)
CachedDiscovery returns a cached discovery client.
func (*APIClient) CheckConnectivity ¶
CheckConnectivity return true if api server is cool or false otherwise.
func (*APIClient) ConnectionOK ¶ added in v0.20.0
ConnectionOK checks api server connection status.
func (*APIClient) CurrentNamespaceName ¶
CurrentNamespaceName return namespace name set via either cli arg or cluster config.
func (*APIClient) Dial ¶ added in v0.8.4
func (a *APIClient) Dial() (kubernetes.Interface, error)
Dial returns a handle to api server or an error
func (*APIClient) HasMetrics ¶
HasMetrics checks if the cluster supports metrics and user is authorized to use metrics.
func (*APIClient) IsActiveNamespace ¶
IsActiveNamespace returns true if namespaces matches.
func (*APIClient) RestConfig ¶ added in v0.8.4
func (a *APIClient) RestConfig() (*restclient.Config, error)
RestConfig returns a rest api client.
func (*APIClient) ServerVersion ¶
ServerVersion returns the current server version info.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config tracks a kubernetes configuration.
func NewConfig ¶
func NewConfig(f *genericclioptions.ConfigFlags) *Config
NewConfig returns a new k8s config or an error if the flags are invalid.
func (*Config) CallTimeout ¶ added in v0.9.1
CallTimeout returns the call timeout if set or the default if not set.
func (*Config) ClusterNameFromContext ¶
ClusterNameFromContext returns the cluster associated with the given context.
func (*Config) ClusterNames ¶
ClusterNames fetch all kubeconfig defined clusters.
func (*Config) ConfigAccess ¶
func (c *Config) ConfigAccess() (clientcmd.ConfigAccess, error)
ConfigAccess return the current kubeconfig api server access configuration.
func (*Config) ContextNames ¶
ContextNames fetch all available contexts.
func (*Config) Contexts ¶
func (c *Config) Contexts() (map[string]*clientcmdapi.Context, error)
Contexts fetch all available contexts.
func (*Config) CurrentClusterName ¶
CurrentClusterName returns the active cluster name.
func (*Config) CurrentContextName ¶
CurrentContextName returns the currently active config context.
func (*Config) CurrentGroupNames ¶
CurrentGroupNames retrieves the active group names.
func (*Config) CurrentNamespaceName ¶
CurrentNamespaceName retrieves the active namespace.
func (*Config) CurrentUserName ¶
CurrentUserName retrieves the active user name.
func (*Config) DelContext ¶
DelContext remove a given context from the configuration.
func (*Config) Flags ¶
func (c *Config) Flags() *genericclioptions.ConfigFlags
Flags returns configuration flags.
func (*Config) GetContext ¶
func (c *Config) GetContext(n string) (*clientcmdapi.Context, error)
GetContext fetch a given context or error if it does not exists.
func (*Config) ImpersonateGroups ¶
ImpersonateGroups retrieves the active groupsif set on the CLI.
func (*Config) ImpersonateUser ¶
ImpersonateUser retrieves the active user name if set on the CLI.
func (*Config) NamespaceNames ¶
NamespaceNames fetch all available namespaces on current cluster.
func (*Config) RESTConfig ¶
func (c *Config) RESTConfig() (*restclient.Config, error)
RESTConfig fetch the current REST api service connection.
type ContainerMetrics ¶
ContainerMetrics tracks container metrics
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory tracks various resource informers.
func NewFactory ¶
func NewFactory(client types.Connection) *Factory
NewFactory returns a new informers factory.
func (*Factory) CanForResource ¶
func (f *Factory) CanForResource(ns string, gvr types.GVR, verbs ...string) (informers.GenericInformer, error)
CanForResource return an informer is user has access.
func (*Factory) Client ¶
func (f *Factory) Client() types.Connection
Client return the factory connection.
func (*Factory) FactoryFor ¶
func (f *Factory) FactoryFor(ns string) di.DynamicSharedInformerFactory
FactoryFor returns a factory for a given namespace.
func (*Factory) ForResource ¶
ForResource returns an informer for a given resource.
func (*Factory) Get ¶
func (f *Factory) Get(gvr types.GVR, path string, wait bool, sel labels.Selector) (runtime.Object, error)
Get retrieves a given resource.
func (*Factory) List ¶
func (f *Factory) List(gvr types.GVR, ns string, wait bool, labels labels.Selector) ([]runtime.Object, error)
List returns a resource collection.
func (*Factory) SetActiveNS ¶
SetActiveNS sets the active namespace.
func (*Factory) WaitForCacheSync ¶
func (f *Factory) WaitForCacheSync()
WaitForCacheSync waits for all factories to update their cache.
type NodeMetrics ¶
type NodeMetrics struct { CurrentCPU resource.Quantity CurrentMEM resource.Quantity AvailableCPU resource.Quantity AvailableMEM resource.Quantity TotalCPU resource.Quantity TotalMEM resource.Quantity }
NodeMetrics describes raw node metrics.
type NodesMetrics ¶
type NodesMetrics map[string]NodeMetrics
NodesMetrics tracks usage metrics per nodes.
type PodsMetrics ¶
type PodsMetrics map[string]ContainerMetrics
PodsMetrics tracks usage metrics per pods.