Documentation
¶
Index ¶
- Variables
- func GetConfig(context string) clientcmd.ClientConfig
- type Client
- func (c *Client) APIClient() (unversioned.Interface, error)
- func (c *Client) Create(namespace string, reader io.Reader) error
- func (c *Client) Delete(namespace string, reader io.Reader) error
- func (c *Client) Get(namespace string, reader io.Reader) (string, error)
- func (c *Client) Update(namespace string, currentReader, targetReader io.Reader) error
- func (c *Client) WatchUntilReady(namespace string, reader io.Reader) error
- type ErrAlreadyExists
- type ResourceActorFunc
- type Tunnel
Constants ¶
This section is empty.
Variables ¶
var ErrNoObjectsVisited = goerrors.New("no objects visited")
ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found.
Functions ¶
Types ¶
type Client ¶
type Client struct {
*cmdutil.Factory
// IncludeThirdPartyAPIs indicates whether to load "dynamic" APIs.
//
// This requires additional calls to the Kubernetes API server, and these calls
// are not supported by all versions. Additionally, during testing, initializing
// a client will still attempt to contact a live server. In these situations,
// this flag may need to be disabled.
IncludeThirdPartyAPIs bool
}
Client represents a client capable of communicating with the Kubernetes API.
func (*Client) APIClient ¶
func (c *Client) APIClient() (unversioned.Interface, error)
APIClient returns a Kubernetes API client.
This is necessary because cmdutil.Client is a field, not a method, which means it can't satisfy an interface's method requirement. In order to ensure that an implementation of environment.KubeClient can access the raw API client, it is necessary to add this method.
func (*Client) Create ¶
func (c *Client) Create(namespace string, reader io.Reader) error
Create creates kubernetes resources from an io.reader
Namespace will set the namespace
func (*Client) Delete ¶
func (c *Client) Delete(namespace string, reader io.Reader) error
Delete deletes kubernetes resources from an io.reader
Namespace will set the namespace
func (*Client) Get ¶
func (c *Client) Get(namespace string, reader io.Reader) (string, error)
Get gets kubernetes resources as pretty printed string
Namespace will set the namespace
func (*Client) Update ¶
func (c *Client) Update(namespace string, currentReader, targetReader io.Reader) error
Update reads in the current configuration and a target configuration from io.reader
and creates resources that don't already exists, updates resources that have been modified
in the target configuration and deletes resources from the current configuration that are
not present in the target configuration
Namespace will set the namespaces
func (*Client) WatchUntilReady ¶
func (c *Client) WatchUntilReady(namespace string, reader io.Reader) error
WatchUntilReady watches the resource given in the reader, and waits until it is ready.
This function is mainly for hook implementations. It watches for a resource to hit a particular milestone. The milestone depends on the Kind.
For most kinds, it checks to see if the resource is marked as Added or Modified by the Kubernetes event stream. For some kinds, it does more:
- Jobs: A job is marked "Ready" when it has successfully completed. This is ascertained by watching the Status fields in a job's output.
Handling for other kinds will be added as necessary.
type ErrAlreadyExists ¶
type ErrAlreadyExists struct {
// contains filtered or unexported fields
}
ErrAlreadyExists can be returned where there are no changes
type ResourceActorFunc ¶
type ResourceActorFunc func(*resource.Info) error
ResourceActorFunc performs an action on a single resource.
type Tunnel ¶
type Tunnel struct {
Local int
Remote int
Namespace string
PodName string
Out io.Writer
// contains filtered or unexported fields
}
Tunnel describes a ssh-like tunnel to a kubernetes pod
func NewTunnel ¶
func NewTunnel(client *restclient.RESTClient, config *restclient.Config, namespace, podName string, remote int) *Tunnel
NewTunnel creates a new tunnel
func (*Tunnel) ForwardPort ¶
func (t *Tunnel) ForwardPort() error
ForwardPort opens a tunnel to a kubernetes pod