Documentation ¶
Index ¶
- Constants
- Variables
- func GetNodeIp(node *coreV1.Node, addrType coreV1.NodeAddressType) string
- type Client
- func (k8s *Client) AssertCoreAuthz(ctx context.Context) error
- func (k8s *Client) AssertMetricsAvailable() error
- func (k8s *Client) ClusterContext() string
- func (k8s *Client) Controller() *Controller
- func (k8s *Client) GetServerVersion() string
- func (k8s *Client) IsAuthz(ctx context.Context, resource string, verbs []string) (bool, error)
- func (k8s *Client) Namespace() string
- func (k8s *Client) NewNamespace(name string) string
- func (k8s *Client) RESTConfig() *restclient.Config
- func (k8s *Client) Username() string
- type Controller
- func (c *Controller) GetAllPodMetrics(ctx context.Context) ([]*metricsV1beta1.PodMetrics, error)
- func (c *Controller) GetCronJobList(ctx context.Context) ([]*batchV1.CronJob, error)
- func (c *Controller) GetDaemonSetList(ctx context.Context) ([]*appsV1.DaemonSet, error)
- func (c *Controller) GetDeploymentList(ctx context.Context) ([]*appsV1.Deployment, error)
- func (c *Controller) GetJobList(ctx context.Context) ([]*batchV1.Job, error)
- func (c *Controller) GetNamespaceList(ctx context.Context) ([]*coreV1.Namespace, error)
- func (c *Controller) GetNode(ctx context.Context, nodeName string) (*coreV1.Node, error)
- func (c *Controller) GetNodeList(ctx context.Context) ([]*coreV1.Node, error)
- func (c *Controller) GetNodeMetrics(ctx context.Context, nodeName string) (*metricsV1beta1.NodeMetrics, error)
- func (c *Controller) GetNodeModels(ctx context.Context) (models []model.NodeModel, err error)
- func (c *Controller) GetPVCList(ctx context.Context) ([]*coreV1.PersistentVolumeClaim, error)
- func (c *Controller) GetPVList(ctx context.Context) ([]*coreV1.PersistentVolume, error)
- func (c *Controller) GetPodList(ctx context.Context) ([]*coreV1.Pod, error)
- func (c *Controller) GetPodMetricsByName(ctx context.Context, pod *v1.Pod) (*metricsV1beta1.PodMetrics, error)
- func (c *Controller) GetPodModels(ctx context.Context) (models []model.PodModel, err error)
- func (c *Controller) GetReplicaSetList(ctx context.Context) ([]*appsV1.ReplicaSet, error)
- func (c *Controller) GetStatefulSetList(ctx context.Context) ([]*appsV1.StatefulSet, error)
- func (c *Controller) SetClusterSummaryRefreshFunc(fn RefreshSummaryFunc) *Controller
- func (c *Controller) SetNodeRefreshFunc(fn RefreshNodesFunc) *Controller
- func (c *Controller) SetPodRefreshFunc(fn RefreshPodsFunc) *Controller
- func (c *Controller) Start(ctx context.Context, resync time.Duration) error
- type NodeMetricsInformer
- type NodeMetricsLister
- type PodMetricsInformer
- type PodMetricsLister
- type RefreshNodesFunc
- type RefreshPodsFunc
- type RefreshSummaryFunc
Constants ¶
View Source
const (
AllNamespaces = metav1.NamespaceAll
)
Variables ¶
View Source
var ( // GVRs used GVRs = map[string]schema.GroupVersionResource{ "nodes": {Group: "", Version: "v1", Resource: "nodes"}, "namespaces": {Group: "", Version: "v1", Resource: "namespaces"}, "pods": {Group: "", Version: "v1", Resource: "pods"}, "persistentvolumes": {Group: "", Version: "v1", Resource: "persistentvolumes"}, "persistentvolumeclaims": {Group: "", Version: "v1", Resource: "persistentvolumeclaims"}, "deployments": {Group: appsV1.GroupName, Version: "v1", Resource: "deployments"}, "daemonsets": {Group: appsV1.GroupName, Version: "v1", Resource: "daemonsets"}, "replicasets": {Group: appsV1.GroupName, Version: "v1", Resource: "replicasets"}, "statefulsets": {Group: appsV1.GroupName, Version: "v1", Resource: "statefulsets"}, "jobs": {Group: batchV1.GroupName, Version: "v1", Resource: "jobs"}, "cronjobs": {Group: batchV1.GroupName, Version: "v1", Resource: "cronjobs"}, } )
Functions ¶
Types ¶
type Client ¶
func New ¶
func New(flags *genericclioptions.ConfigFlags) (*Client, error)
func (*Client) AssertCoreAuthz ¶
AssertCoreAuthz asserts that user/context can access node and pods
func (*Client) AssertMetricsAvailable ¶
AssertMetricsAvailable checks for available metrics server every 10th invocation. Otherwise, it returns the last known registration state of metrics server.
func (*Client) ClusterContext ¶
func (*Client) Controller ¶
func (k8s *Client) Controller() *Controller
func (*Client) GetServerVersion ¶
func (*Client) NewNamespace ¶
func (*Client) RESTConfig ¶
func (k8s *Client) RESTConfig() *restclient.Config
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func (*Controller) GetAllPodMetrics ¶
func (c *Controller) GetAllPodMetrics(ctx context.Context) ([]*metricsV1beta1.PodMetrics, error)
GetAllPodMetrics retrieve all available pod emtrics
func (*Controller) GetCronJobList ¶
func (*Controller) GetDaemonSetList ¶
func (*Controller) GetDeploymentList ¶
func (c *Controller) GetDeploymentList(ctx context.Context) ([]*appsV1.Deployment, error)
func (*Controller) GetJobList ¶
func (*Controller) GetNamespaceList ¶
func (*Controller) GetNodeList ¶
func (*Controller) GetNodeMetrics ¶
func (c *Controller) GetNodeMetrics(ctx context.Context, nodeName string) (*metricsV1beta1.NodeMetrics, error)
GetNodeMetrics returns metrics for specified node
func (*Controller) GetNodeModels ¶
func (*Controller) GetPVCList ¶
func (c *Controller) GetPVCList(ctx context.Context) ([]*coreV1.PersistentVolumeClaim, error)
func (*Controller) GetPVList ¶
func (c *Controller) GetPVList(ctx context.Context) ([]*coreV1.PersistentVolume, error)
func (*Controller) GetPodList ¶
func (*Controller) GetPodMetricsByName ¶
func (c *Controller) GetPodMetricsByName(ctx context.Context, pod *v1.Pod) (*metricsV1beta1.PodMetrics, error)
GetPodMetricsByName returns pod metrics for specified pod
func (*Controller) GetPodModels ¶
func (*Controller) GetReplicaSetList ¶
func (c *Controller) GetReplicaSetList(ctx context.Context) ([]*appsV1.ReplicaSet, error)
func (*Controller) GetStatefulSetList ¶
func (c *Controller) GetStatefulSetList(ctx context.Context) ([]*appsV1.StatefulSet, error)
func (*Controller) SetClusterSummaryRefreshFunc ¶
func (c *Controller) SetClusterSummaryRefreshFunc(fn RefreshSummaryFunc) *Controller
func (*Controller) SetNodeRefreshFunc ¶
func (c *Controller) SetNodeRefreshFunc(fn RefreshNodesFunc) *Controller
func (*Controller) SetPodRefreshFunc ¶
func (c *Controller) SetPodRefreshFunc(fn RefreshPodsFunc) *Controller
type NodeMetricsInformer ¶
type NodeMetricsInformer struct {
// contains filtered or unexported fields
}
func NewNodeMetricsInformer ¶
func NewNodeMetricsInformer(client metricsclient.Interface, resyncPeriod time.Duration) *NodeMetricsInformer
func (*NodeMetricsInformer) Informer ¶
func (i *NodeMetricsInformer) Informer() cache.SharedIndexInformer
func (*NodeMetricsInformer) Lister ¶
func (i *NodeMetricsInformer) Lister() *NodeMetricsLister
type NodeMetricsLister ¶
type NodeMetricsLister struct {
// contains filtered or unexported fields
}
func NewNodeMetricsLister ¶
func NewNodeMetricsLister(indexer cache.Indexer) *NodeMetricsLister
func (*NodeMetricsLister) Get ¶
func (s *NodeMetricsLister) Get(name string) (*metricsV1beta1.NodeMetrics, error)
func (*NodeMetricsLister) List ¶
func (s *NodeMetricsLister) List(selector labels.Selector) (ret []*metricsV1beta1.NodeMetrics, err error)
type PodMetricsInformer ¶
type PodMetricsInformer struct {
// contains filtered or unexported fields
}
func NewPodMetricsInformer ¶
func NewPodMetricsInformer(client metricsclient.Interface, resyncPeriod time.Duration, namespace string) *PodMetricsInformer
func (*PodMetricsInformer) Informer ¶
func (i *PodMetricsInformer) Informer() cache.SharedIndexInformer
func (*PodMetricsInformer) Lister ¶
func (i *PodMetricsInformer) Lister() *PodMetricsLister
type PodMetricsLister ¶
type PodMetricsLister struct {
// contains filtered or unexported fields
}
func NewPodMetricsLister ¶
func NewPodMetricsLister(indexer cache.Indexer) *PodMetricsLister
func (*PodMetricsLister) Get ¶
func (s *PodMetricsLister) Get(pod *v1.Pod) (*metricsV1beta1.PodMetrics, error)
func (*PodMetricsLister) List ¶
func (s *PodMetricsLister) List(selector labels.Selector) (ret []*metricsV1beta1.PodMetrics, err error)
type RefreshNodesFunc ¶
type RefreshSummaryFunc ¶
type RefreshSummaryFunc func(ctx context.Context, items model.ClusterSummary) error
Click to show internal directories.
Click to hide internal directories.