podresapi

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is Pod Resources API client.

func NewClient

func NewClient(options ...ClientOption) (*Client, error)

NewClient creates a new Pod Resources API client with the given options.

func (*Client) Close

func (c *Client) Close()

Close closes the client.

func (*Client) Get

func (c *Client) Get(ctx context.Context, namespace, pod string) (*PodResources, error)

Get queries the given pod's resources.

func (*Client) HasClient

func (c *Client) HasClient() bool

HasClient returns true if the client has a usable client.

func (*Client) List

func (c *Client) List(ctx context.Context) (*PodResourcesList, error)

List lists all pods' resources.

type ClientOption

type ClientOption func(*Client)

ClientOption is an option for the client.

func WithClientConn

func WithClientConn(conn *grpc.ClientConn) ClientOption

WithClientConn sets a pre-created gRPC connection for the client.

func WithSocketPath

func WithSocketPath(path string) ClientOption

WithSocketPath sets the kubelet socket path to connect to.

type ContainerResources

type ContainerResources struct {
	*api.ContainerResources
}

ContainerResources contains resources for a single container.

func (*ContainerResources) GetDeviceTopologyHints

func (r *ContainerResources) GetDeviceTopologyHints(checkDenied func(string) bool) topology.Hints

GetDeviceTopologyHints returns topology hints for the given container. checkDenied is used to filter out hints that are disallowed.

type PodResources

type PodResources struct {
	*api.PodResources
}

PodResources contains resources for a pod.

func (*PodResources) GetContainer

func (p *PodResources) GetContainer(ctr string) *ContainerResources

GetContainer returns resources for the given container.

type PodResourcesList

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

PodResourcesList containers the result of a pod resources list query.

func NewPodResourcesList

func NewPodResourcesList(l []*api.PodResources) *PodResourcesList

func (*PodResourcesList) GetContainer

func (l *PodResourcesList) GetContainer(ns, pod, ctr string) *ContainerResources

GetContainer returns resources for the given container.

func (*PodResourcesList) GetPodResources

func (l *PodResourcesList) GetPodResources(ns, pod string) *PodResources

GetPodResources returns resources for the given pod.

func (*PodResourcesList) Len

func (l *PodResourcesList) Len() int

Jump to

Keyboard shortcuts

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