kubernetes: github.com/igm/kubernetes/pkg/kubectl Index | Files | Directories

package kubectl

import "github.com/igm/kubernetes/pkg/kubectl"

Package kubectl is a set of libraries that are used by the kubectl command line tool. They are separated out into a library to support unit testing. Most functionality should be included in this package, and the main kubectl should really just be an entry point.

A set of common functions needed by cmd/kubectl and pkg/kubectl packages.

Index

Package Files

describe.go doc.go interfaces.go kubectl.go proxy_server.go resource_printer.go resthelper.go version.go watchloop.go

func ExpandResourceShortcut Uses

func ExpandResourceShortcut(resource string) string

ExpandResourceShortcut will return the expanded version of resource (something that a pkg/api/meta.RESTMapper can understand), if it is indeed a shortcut. Otherwise, will return resource unmodified. TODO: Combine with RESTMapper stuff to provide a general solution to this problem.

func GetClientVersion Uses

func GetClientVersion(w io.Writer)

func GetKubeClient Uses

func GetKubeClient(config *client.Config, matchVersion bool) (*client.Client, error)

func GetVersion Uses

func GetVersion(w io.Writer, kubeClient client.Interface)

func SaveNamespaceInfo Uses

func SaveNamespaceInfo(path string, ns *NamespaceInfo) error

SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.

func WatchLoop Uses

func WatchLoop(w watch.Interface, printer ResourcePrinter, out io.Writer)

WatchLoop loops, writing objects in the events from w to printer. If user sends interrupt signal, shut down cleanly. Otherwise, never return.

type Describer Uses

type Describer interface {
    Describe(namespace, name string) (output string, err error)
}

Describer generates output for the named resource or an error if the output could not be generated.

func DescriberFor Uses

func DescriberFor(kind string, c *client.Client) (Describer, bool)

Describer returns the default describe functions for each of the standard Kubernetes types.

type HumanReadablePrinter Uses

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

HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide more elegant output. It is not threadsafe, but you may call PrintObj repeatedly; headers will only be printed if the object type changes. This makes it useful for printing items recieved from watches.

func NewHumanReadablePrinter Uses

func NewHumanReadablePrinter(noHeaders bool) *HumanReadablePrinter

NewHumanReadablePrinter creates a HumanReadablePrinter.

func (*HumanReadablePrinter) Handler Uses

func (h *HumanReadablePrinter) Handler(columns []string, printFunc interface{}) error

Handler adds a print handler with a given set of columns to HumanReadablePrinter instance. printFunc is the function that will be called to print an object. It must be of the following type:

func printFunc(object ObjectType, w io.Writer) error

where ObjectType is the type of the object that will be printed.

func (*HumanReadablePrinter) PrintObj Uses

func (h *HumanReadablePrinter) PrintObj(obj runtime.Object, output io.Writer) error

PrintObj prints the obj in a human-friendly format according to the type of the obj.

type JSONPrinter Uses

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

JSONPrinter is an implementation of ResourcePrinter which outputs an object as JSON. The input object is assumed to be in the internal version of an API and is converted to the given version first.

func (*JSONPrinter) PrintObj Uses

func (p *JSONPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj is an implementation of ResourcePrinter.PrintObj which simply writes the object to the Writer.

type MinionDescriber Uses

type MinionDescriber struct {
    client.Interface
}

MinionDescriber generates information about a minion.

func (*MinionDescriber) Describe Uses

func (d *MinionDescriber) Describe(namespace, name string) (string, error)

type NamespaceInfo Uses

type NamespaceInfo struct {
    Namespace string
}

func LoadNamespaceInfo Uses

func LoadNamespaceInfo(path string) (*NamespaceInfo, error)

LoadNamespaceInfo parses a NamespaceInfo object from a file path. It creates a file at the specified path if it doesn't exist with the default namespace.

type PodDescriber Uses

type PodDescriber struct {
    client.Interface
}

PodDescriber generates information about a pod and the replication controllers that create it.

func (*PodDescriber) Describe Uses

func (d *PodDescriber) Describe(namespace, name string) (string, error)

type ProxyServer Uses

type ProxyServer struct {
    httputil.ReverseProxy
    Port int
}

ProxyServer is a http.Handler which proxies Kubernetes APIs to remote API server.

func NewProxyServer Uses

func NewProxyServer(filebase string, cfg *client.Config, port int) (*ProxyServer, error)

NewProxyServer creates and installs a new ProxyServer. It automatically registers the created ProxyServer to http.DefaultServeMux.

func (*ProxyServer) Serve Uses

func (s *ProxyServer) Serve() error

Serve starts the server (http.DefaultServeMux) on TCP port 8001, loops forever.

type RESTClient Uses

type RESTClient interface {
    Get() *client.Request
    Post() *client.Request
    Delete() *client.Request
    Put() *client.Request
}

RESTClient is a client helper for dealing with RESTful resources in a generic way.

type RESTHelper Uses

type RESTHelper struct {
    Resource string
    // A RESTClient capable of mutating this resource
    RESTClient RESTClient
    // A codec for decoding and encoding objects of this resource type.
    Codec runtime.Codec
    // An interface for reading or writing the resource version of this
    // type.
    Versioner runtime.ResourceVersioner
}

RESTHelper provides methods for retrieving or mutating a RESTful resource.

func NewRESTHelper Uses

func NewRESTHelper(client RESTClient, mapping *meta.RESTMapping) *RESTHelper

NewRESTHelper creates a RESTHelper from a ResourceMapping

func (*RESTHelper) Create Uses

func (m *RESTHelper) Create(namespace string, modify bool, data []byte) error

func (*RESTHelper) Delete Uses

func (m *RESTHelper) Delete(namespace, name string) error

func (*RESTHelper) Get Uses

func (m *RESTHelper) Get(namespace, name string, selector labels.Selector) (runtime.Object, error)

func (*RESTHelper) Update Uses

func (m *RESTHelper) Update(namespace, name string, overwrite bool, data []byte) error

func (*RESTHelper) Watch Uses

func (m *RESTHelper) Watch(namespace, resourceVersion string, labelSelector, fieldSelector labels.Selector) (watch.Interface, error)

type ReplicationControllerDescriber Uses

type ReplicationControllerDescriber struct {
    client.Interface
}

ReplicationControllerDescriber generates information about a replication controller and the pods it has created.

func (*ReplicationControllerDescriber) Describe Uses

func (d *ReplicationControllerDescriber) Describe(namespace, name string) (string, error)

type ResourcePrinter Uses

type ResourcePrinter interface {
    // Print receives an arbitrary object, formats it and prints it to a writer.
    PrintObj(runtime.Object, io.Writer) error
}

ResourcePrinter is an interface that knows how to print runtime objects.

func GetPrinter Uses

func GetPrinter(format, formatArgument, version string, convertor runtime.ObjectConvertor, defaultPrinter ResourcePrinter) (ResourcePrinter, error)

GetPrinter takes a format type, an optional format argument, a version and a convertor to be used if the underlying printer requires the object to be in a specific schema ( any of the generic formatters), and the default printer to use for this object.

type ServiceDescriber Uses

type ServiceDescriber struct {
    client.Interface
}

ServiceDescriber generates information about a service.

func (*ServiceDescriber) Describe Uses

func (d *ServiceDescriber) Describe(namespace, name string) (string, error)

type TemplatePrinter Uses

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

TemplatePrinter is an implementation of ResourcePrinter which formats data with a Go Template.

func NewTemplatePrinter Uses

func NewTemplatePrinter(tmpl []byte, asVersion string, convertor runtime.ObjectConvertor) (*TemplatePrinter, error)

func (*TemplatePrinter) PrintObj Uses

func (p *TemplatePrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj formats the obj with the Go Template.

type YAMLPrinter Uses

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

YAMLPrinter is an implementation of ResourcePrinter which outputs an object as YAML. The input object is assumed to be in the internal version of an API and is converted to the given version first.

func (*YAMLPrinter) PrintObj Uses

func (p *YAMLPrinter) PrintObj(obj runtime.Object, w io.Writer) error

PrintObj prints the data as YAML.

Directories

PathSynopsis
cmd

Package kubectl imports 25 packages (graph). Updated 2018-04-17. Refresh now. Tools for package owners.