kubernetes

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildClientCmd

func BuildClientCmd(kubeconfig, context string) clientcmd.ClientConfig

BuildClientCmd builds a client cmd config from a kubeconfig filepath and context. It overrides the current context with the one provided (empty to use default).

This is a modified version of k8s.io/client-go/tools/clientcmd/BuildConfigFromFlags with the difference that it loads default configs if not running in-cluster.

func BuildClientConfig

func BuildClientConfig(kubeconfig, context string) (*rest.Config, error)

BuildClientConfig builds a client rest config from a kubeconfig filepath and context. It overrides the current context with the one provided (empty to use default).

This is a modified version of k8s.io/client-go/tools/clientcmd/BuildConfigFromFlags with the difference that it loads default configs if not running in-cluster.

func NewClientset

func NewClientset(client *Client) (*kubernetes.Clientset, error)

NewClientset creates a new Clientset for the given config.

func RunPortForwarder

func RunPortForwarder(fw *PortForward, readyFunc func(fw *PortForward) error) error

RunPortForwarder run the portforwarder

Types

type Client

type Client struct {
	Config *rest.Config
	*rest.RESTClient
}

Client is a helper wrapper around the Kube RESTClient for istioctl -> Pilot/Envoy/Mesh related things

func NewClient

func NewClient(kubeconfig, configContext string) (*Client, error)

NewClient is the constructor for the client wrapper

func (*Client) BuildPortForwarder

func (client *Client) BuildPortForwarder(podName string, ns string, localPort int, podPort int) (*PortForward, error)

BuildPortForwarder sets up port forwarding.

func (*Client) PodsForSelector

func (client *Client) PodsForSelector(namespace, labelSelector string) (*v1.PodList, error)

PodsForSelector get pods via label selector

type ExecClient

type ExecClient interface {
	PodsForSelector(namespace, labelSelector string) (*v1.PodList, error)
	BuildPortForwarder(podName string, ns string, localPort int, podPort int) (*PortForward, error)
}

ExecClient is an interface for remote execution

type PortForward

type PortForward struct {
	Forwarder    *portforward.PortForwarder
	LocalPort    int
	StopChannel  chan struct{}
	ReadyChannel <-chan struct{}
}

PortForward gathers port forwarding results

Jump to

Keyboard shortcuts

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