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

package kubectl

import "github.com/erikstmartin/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.


Package Files

describe.go doc.go get.go kubectl.go modify.go proxy_server.go resource_printer.go version.go


const (
    ModifyCreate = ModifyAction("create")
    ModifyUpdate = ModifyAction("update")
    ModifyDelete = ModifyAction("delete")

func CreateResource Uses

func CreateResource(resource, id string) ([]byte, error)

func Describe Uses

func Describe(w io.Writer, c client.Interface, resource, id string) error

func Get Uses

func Get(w io.Writer, c *client.RESTClient, namespace string, resource string, id string, selector string, format string, noHeaders bool, templateFile string) error

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 Modify Uses

func Modify(w io.Writer, c *client.RESTClient, namespace string, action ModifyAction, data []byte) error

func SaveNamespaceInfo Uses

func SaveNamespaceInfo(path string, ns *NamespaceInfo) error

SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.

type AuthInfo Uses

type AuthInfo struct {
    User        string
    Password    string
    CAFile      string
    CertFile    string
    KeyFile     string
    BearerToken string
    Insecure    *bool

func LoadAuthInfo Uses

func LoadAuthInfo(path string, r io.Reader) (*AuthInfo, error)

LoadAuthInfo parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist.

type HumanReadablePrinter Uses

type HumanReadablePrinter struct {
    // contains filtered or unexported fields

HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide more elegant output.

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{}

IdentityPrinter is an implementation of ResourcePrinter which simply copies the body out to the output stream.

func (*JSONPrinter) PrintObj Uses

func (i *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 ModifyAction Uses

type ModifyAction string

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 ProxyServer Uses

type ProxyServer struct {
    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 ResourcePrinter Uses

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

ResourcePrinter is an interface that knows how to print API resources.

type TemplatePrinter Uses

type TemplatePrinter struct {
    Template *template.Template

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

func (*TemplatePrinter) PrintObj Uses

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

PrintObj formats the obj with the Go Template.

type YAMLPrinter Uses

type YAMLPrinter struct{}

YAMLPrinter is an implementation of ResourcePrinter which parsess JSON, and re-formats as YAML.

func (*YAMLPrinter) PrintObj Uses

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

PrintObj prints the data as YAML.



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