Documentation ¶
Overview ¶
Package kubernetes contains a minimal client for the Kubernetes API.
Index ¶
- Constants
- type Client
- func (c *Client) DeletePod(ctx context.Context, podName string) error
- func (c *Client) GetNodes(ctx context.Context) ([]api.Node, error)
- func (c *Client) GetPods(ctx context.Context) ([]api.Pod, error)
- func (c *Client) PodLog(ctx context.Context, podName string) (string, error)
- func (c *Client) PodStatus(ctx context.Context, podName string) (*api.PodStatus, error)
- func (c *Client) RunLongLivedPod(ctx context.Context, pod *api.Pod) (*api.PodStatus, error)
- type PodStatusResult
Constants ¶
const (
// APIEndpoint defines the base path for kubernetes API resources.
APIEndpoint = "/api/v1"
)
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 the Kubernetes master.
func NewClient ¶
NewClient returns a new Kubernetes client. The provided host is an url (scheme://hostname[:port]) of a Kubernetes master without any path. The provided client is an authorized http.Client used to perform requests to the Kubernetes API master.
func (*Client) RunLongLivedPod ¶
RunLongLivedPod creates a new pod resource in the default pod namespace with the given pod API specification. It assumes the pod runs a long-lived server (i.e. if the container exit quickly quickly, even with success, then that is an error).
It returns the pod status once it has entered the Running phase. An error is returned if the pod can not be created, or if ctx.Done is closed.