client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 25 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 a client for interacting with Kubernetes API for a single master.

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient returns a new client loaded from configLoader with config overrides.

func (*Client) Clientset

func (k *Client) Clientset() kubernetes.Interface

Clientset returns interface for kubernetes API.

func (*Client) Cluster

func (k *Client) Cluster() string

Cluster returns the cluster name used for this client.

func (*Client) Context

func (k *Client) Context() string

Context returns the context name used for this client.

func (*Client) GetPod

func (k *Client) GetPod(namespace string, name string) (*Pod, error)

GetPod calls the API to get pod with namespace and name.

func (*Client) GetVersionInfo

func (k *Client) GetVersionInfo() (*version.Info, error)

func (*Client) ListPods

func (k *Client) ListPods(namespace string, labelSelector, fieldSelector string) (list []*Pod, err error)

ListPods calls the API to lists all pods with namespace and label selector.

func (*Client) Namespace

func (k *Client) Namespace() string

Namespace returns the namspace name used for this client.

func (*Client) String

func (k *Client) String() string

type Config

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

func NewConfig

func NewConfig(flags *genericclioptions.ConfigFlags) *Config

func NewConfigWith

func NewConfigWith(kubeconfig string, context string) *Config

func (*Config) ClusterNames

func (c *Config) ClusterNames() ([]string, error)

func (*Config) ConfigAccess

func (c *Config) ConfigAccess() (clientcmd.ConfigAccess, error)

func (*Config) ContextNames

func (c *Config) ContextNames() ([]string, error)

func (*Config) Contexts

func (c *Config) Contexts() (map[string]*clientcmdapi.Context, error)

func (*Config) CurrentCluster

func (c *Config) CurrentCluster() (string, error)

func (*Config) CurrentContext

func (c *Config) CurrentContext() (string, error)

func (*Config) CurrentNamespace

func (c *Config) CurrentNamespace() (string, error)

func (*Config) GetContext

func (c *Config) GetContext(name string) (*clientcmdapi.Context, error)

func (*Config) RESTConfig

func (c *Config) RESTConfig() (*restclient.Config, error)

func (*Config) RawConfig

func (c *Config) RawConfig() (clientcmdapi.Config, error)

type Pod

type Pod struct {
	UID       types.UID
	Name      string
	NodeName  string
	Cluster   string
	Namespace string
	IP        string
	HostIP    string
	Created   time.Time
	URL       string
	Image     string
	ImageID   string
	// contains filtered or unexported fields
}

Pod is a pod returned from Client.

func (Pod) Age

func (pod Pod) Age() time.Duration

Age returns duration since the pod started.

func (Pod) Exec

func (pod Pod) Exec(command string, stdin io.Reader, stdout, stderr io.Writer) error

Exec executes a command in the pod.

func (Pod) ExecContainer

func (pod Pod) ExecContainer(container, command string, stdin io.Reader, stdout, stderr io.Writer) error

ExecContainer executes a command in a container of the pod.

func (Pod) PortForward

func (pod Pod) PortForward(podPort int) (*PortForwarder, error)

PortForward starts port forwarding of pod port to a local random port.

func (Pod) String

func (pod Pod) String() string

Strings returns name for this pod prefixed with cluster name and namespace.

type PortForwardOptions

type PortForwardOptions struct {
	PodName      string
	PodNamespace string
	PodPort      int
	LocalPort    int
}

type PortForwarder

type PortForwarder struct {
	Streams genericclioptions.IOStreams
	// contains filtered or unexported fields
}

func PortForward

func PortForward(client *Client, opt PortForwardOptions) (*PortForwarder, error)

PortForward starts port forwarding for a port and returns the PortForwarder.

func (*PortForwarder) Done added in v0.2.0

func (pf *PortForwarder) Done() <-chan error

func (*PortForwarder) LocalPort

func (pf *PortForwarder) LocalPort() uint16

func (*PortForwarder) Stop

func (pf *PortForwarder) Stop()

Jump to

Keyboard shortcuts

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