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 ¶
- func DeleteController(name string, client client.Interface) error
- func LoadAuthInfo(path string, r io.Reader) (*client.AuthInfo, error)
- func ResizeController(name string, replicas int, client client.Interface) error
- func RunController(image, name string, replicas int, client client.Interface, portSpec string, ...) error
- func StopController(name string, client client.Interface) error
- func SupportedWireStorage() []string
- func ToWireFormat(data []byte, storage string) ([]byte, error)
- func Update(name string, client client.Interface, updatePeriod time.Duration) error
- type HumanReadablePrinter
- type IdentityPrinter
- type ProxyServer
- type ResourcePrinter
- type TemplatePrinter
- type YAMLPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteController ¶
DeleteController deletes a replication controller named 'name', requires that the controller already be stopped
func LoadAuthInfo ¶
LoadAuthInfo parses an AuthInfo object from a file path. It prompts user and creates file if it doesn't exist.
func ResizeController ¶
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 ¶
StopController stops a controller named 'name' by setting replicas to zero
func SupportedWireStorage ¶
func SupportedWireStorage() []string
func ToWireFormat ¶
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.
Types ¶
type HumanReadablePrinter ¶
type HumanReadablePrinter struct{}
HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide more elegant output.
type IdentityPrinter ¶
type IdentityPrinter struct{}
IdentityPrinter is an implementation of ResourcePrinter which simply copies the body out to the output stream
type ProxyServer ¶
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 ¶
TemplatePrinter is an implementation of ResourcePrinter which formats data with a Go Template.
type YAMLPrinter ¶
type YAMLPrinter struct{}
YAMLPrinter is an implementation of ResourcePrinter which parsess JSON, and re-formats as YAML