kubecfg

package
v0.0.0-...-6eef5cf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2014 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteController

func DeleteController(name string, client client.Interface) error

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

func LoadAuthInfo

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

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

func ResizeController

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

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

func RunController

func RunController(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 StopController

func StopController(name string, client client.Interface) error

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

func SupportedWireStorage

func SupportedWireStorage() []string

func ToWireFormat

func ToWireFormat(data []byte, storage string) ([]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.

func Update

func Update(name string, client client.Interface, updatePeriod time.Duration) 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.

Types

type HumanReadablePrinter

type HumanReadablePrinter struct{}

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

func (*HumanReadablePrinter) Print

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

func (h *HumanReadablePrinter) PrintObj(obj interface{}, output io.Writer) error

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

type IdentityPrinter

type IdentityPrinter struct{}

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

func (*IdentityPrinter) Print

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

func (i *IdentityPrinter) PrintObj(obj interface{}, output io.Writer) error

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

type ProxyServer

type ProxyServer struct {
	Host   string
	Auth   *client.AuthInfo
	Client *client.Client
}

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

func NewProxyServer

func NewProxyServer(filebase, host string, auth *client.AuthInfo) *ProxyServer

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

func (*ProxyServer) Serve

func (s *ProxyServer) Serve() error

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

func (*ProxyServer) ServeHTTP

func (s *ProxyServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ResourcePrinter

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

ResourcePrinter is an interface that knows how to print API resources

type TemplatePrinter

type TemplatePrinter struct {
	Template *template.Template
}

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

func (*TemplatePrinter) Print

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

func (t *TemplatePrinter) PrintObj(obj interface{}, w io.Writer) error

PrintObj formats the obj with the Go Template.

type YAMLPrinter

type YAMLPrinter struct{}

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

func (*YAMLPrinter) Print

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

func (y *YAMLPrinter) PrintObj(obj interface{}, w io.Writer) error

PrintObj prints the data as YAML.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL