kubernetes: github.com/igm/kubernetes/pkg/kubecfg Index | Files

package kubecfg

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

Package kubecfg is a set of libraries that are used by the kubecfg 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 kubecfg should really just be an entry point.

Index

Package Files

doc.go kubecfg.go parse.go proxy_server.go resource_printer.go

func DeleteController Uses

func DeleteController(ctx api.Context, name string, client client.Interface) error

DeleteController deletes a replication controller named 'name', requires that the controller already be stopped.

func GetServerVersion Uses

func GetServerVersion(client *client.Client) (*version.Info, error)

func LoadClientAuthInfoOrPrompt Uses

func LoadClientAuthInfoOrPrompt(path string, r io.Reader) (*clientauth.Info, error)

LoadClientAuthInfoOrPrompt parses a clientauth.Info object from a file path. It prompts user and creates file if it doesn't exist. Oddly, it returns a clientauth.Info even if there is an error.

func ResizeController Uses

func ResizeController(ctx api.Context, name string, replicas int, client client.Interface) error

ResizeController resizes a controller named 'name' by setting replicas to 'replicas'.

func RunController Uses

func RunController(ctx api.Context, image, name string, replicas int, client client.Interface, portSpec string, servicePort int) error

RunController creates a new replication controller named 'name' which creates 'replicas' pods running 'image'.

func SaveNamespaceInfo Uses

func SaveNamespaceInfo(path string, ns *NamespaceInfo) error

SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.

func StopController Uses

func StopController(ctx api.Context, name string, client client.Interface) error

StopController stops a controller named 'name' by setting replicas to zero.

func Update Uses

func Update(ctx api.Context, name string, client client.Interface, updatePeriod time.Duration, imageName string) error

Update performs a rolling update of a collection of pods. 'name' points to a replication controller. 'client' is used for updating pods. 'updatePeriod' is the time between pod updates. 'imageName' is the new image to update for the template. This will work

with the first container in the pod.  There is no support yet for
updating more complex replication controllers.  If this is blank then no
update of the image is performed.

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() *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) Print Uses

func (h *HumanReadablePrinter) Print(data []byte, output io.Writer) error

Print parses the data as JSON, then prints the parsed data in a human-friendly format according to the type of the data.

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

type IdentityPrinter struct{}

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

func (*IdentityPrinter) Print Uses

func (i *IdentityPrinter) Print(data []byte, w io.Writer) error

Print is an implementation of ResourcePrinter.Print which simply writes the data to the Writer.

func (*IdentityPrinter) PrintObj Uses

func (i *IdentityPrinter) PrintObj(obj runtime.Object, output io.Writer) error

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

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

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

func NewParser Uses

func NewParser(objectMap map[string]runtime.Object) *Parser

NewParser creates a new parser.

func (*Parser) SupportedWireStorage Uses

func (p *Parser) SupportedWireStorage() []string

func (*Parser) ToWireFormat Uses

func (p *Parser) ToWireFormat(data []byte, storage string, decode runtime.Codec, encode runtime.Codec) ([]byte, error)

ToWireFormat takes input 'data' as either json or yaml, checks that it parses as the appropriate object type, and returns json for sending to the API or an error.

type ProxyServer Uses

type ProxyServer struct {
    httputil.ReverseProxy
}

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

func NewProxyServer Uses

func NewProxyServer(filebase string, cfg *client.Config) (*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.
    Print([]byte, io.Writer) error
    PrintObj(runtime.Object, io.Writer) error
}

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

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) (*TemplatePrinter, error)

func (*TemplatePrinter) Print Uses

func (t *TemplatePrinter) Print(data []byte, w io.Writer) error

Print parses the data as JSON, and re-formats it with the 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) Print Uses

func (y *YAMLPrinter) Print(data []byte, w io.Writer) error

Print parses the data as JSON, re-formats as YAML and prints the YAML.

func (*YAMLPrinter) PrintObj Uses

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

PrintObj prints the data as YAML.

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