kubernetes

package
v0.0.0-...-4896a30 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunPortForwarder

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

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) AllPilotsDiscoveryDo

func (client *Client) AllPilotsDiscoveryDo(pilotNamespace, method, path string, body []byte) (map[string][]byte, error)

AllPilotsDiscoveryDo makes an http request to each Pilot discovery instance

func (*Client) BuildPortForwarder

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

BuildPortForwarder sets up port forwarding.

nolint: lll

func (*Client) EnvoyDo

func (client *Client) EnvoyDo(podName, podNamespace, method, path string, body []byte) ([]byte, error)

EnvoyDo makes an http request to the Envoy in the specified pod

func (*Client) EnvoyDoPortForward

func (client *Client) EnvoyDoPortForward(podName, podNamespace string, podPort int, method, path string, body []byte) ([]byte, error)

EnvoyDoPortForward makes an http request to the Envoy in the specified pod through a port-forward useful in case the Envoy is not equiped with pilot request binary

func (*Client) ExtractExecResult

func (client *Client) ExtractExecResult(podName, podNamespace, container string, cmd []string) ([]byte, error)

ExtractExecResult wraps PodExec and return the execution result and error if has any.

func (*Client) GetIstioPods

func (client *Client) GetIstioPods(namespace string, params map[string]string) ([]v1.Pod, error)

GetIstioPods retrieves the pod objects for Istio deployments

func (*Client) GetIstioVersions

func (client *Client) GetIstioVersions(namespace string) (*version.MeshInfo, error)

GetIstioVersions gets the version for each Istio component

func (*Client) GetPilotAgentContainer

func (client *Client) GetPilotAgentContainer(podName, podNamespace string) (string, error)

GetPilotAgentContainer retrieves the pilot-agent container name for the specified pod

func (*Client) PilotDiscoveryDo

func (client *Client) PilotDiscoveryDo(pilotNamespace, method, path string, body []byte) ([]byte, error)

PilotDiscoveryDo makes an http request to a single Pilot discovery instance

func (*Client) PodExec

func (client *Client) PodExec(podName, podNamespace, container string, command []string) (*bytes.Buffer, *bytes.Buffer, error)

PodExec takes a command and the pod data to run the command in the specified pod

func (*Client) PodsForSelector

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

type ExecClient

type ExecClient interface {
	EnvoyDo(podName, podNamespace, method, path string, body []byte) ([]byte, error)
	EnvoyDoPortForward(podName, podNamespace string, podPort int, method, path string, body []byte) ([]byte, error)
	AllPilotsDiscoveryDo(pilotNamespace, method, path string, body []byte) (map[string][]byte, error)
	GetIstioVersions(namespace string) (*version.MeshInfo, error)
	PilotDiscoveryDo(pilotNamespace, method, path string, body []byte) ([]byte, error)
	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