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(ctx api.Context, name string, client client.Interface) error
- func GetServerVersion(client *client.Client) (*version.Info, error)
- func ResizeController(ctx api.Context, name string, replicas int, client client.Interface) error
- func RunController(ctx api.Context, image, name string, replicas int, client client.Interface, ...) error
- func StopController(ctx api.Context, name string, client client.Interface) error
- func Update(ctx api.Context, name string, client client.Interface, ...) error
- type AuthInfo
- type HumanReadablePrinter
- type IdentityPrinter
- type Parser
- type ProxyServer
- type ResourcePrinter
- type TemplatePrinter
- type YAMLPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteController ¶
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 ¶
func GetServerVersion(client *client.Client) (*version.Info, error)
func ResizeController ¶
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 ¶
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 StopController ¶
func StopController(ctx api.Context, name string, client client.Interface) error
StopController stops a controller named 'name' by setting replicas to zero.
func Update ¶
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.
Types ¶
type AuthInfo ¶
type AuthInfo struct {
User string
Password string
CAFile string
CertFile string
KeyFile string
Insecure *bool
}
func LoadAuthInfo ¶
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 ¶
type HumanReadablePrinter struct {
// contains filtered or unexported fields
}
HumanReadablePrinter is an implementation of ResourcePrinter which attempts to provide more elegant output.
func NewHumanReadablePrinter ¶
func NewHumanReadablePrinter() *HumanReadablePrinter
NewHumanReadablePrinter creates a HumanReadablePrinter.
func (*HumanReadablePrinter) Handler ¶
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.
type IdentityPrinter ¶
type IdentityPrinter struct{}
IdentityPrinter is an implementation of ResourcePrinter which simply copies the body out to the output stream.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func NewParser ¶
func NewParser(objectMap map[string]runtime.Object) *Parser
NewParser creates a new parser.
func (*Parser) SupportedWireStorage ¶
func (p *Parser) SupportedWireStorage() []string
func (*Parser) ToWireFormat ¶
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 ¶
type ProxyServer struct {
Client *client.Client
}
ProxyServer is a http.Handler which proxies Kubernetes APIs to remote API server.
func NewProxyServer ¶
func NewProxyServer(filebase string, kubeClient *client.Client) *ProxyServer
NewProxyServer creates and installs a new ProxyServer. It automatically registers the created ProxyServer to http.DefaultServeMux.
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(runtime.Object, 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.
type YAMLPrinter ¶
type YAMLPrinter struct{}
YAMLPrinter is an implementation of ResourcePrinter which parsess JSON, and re-formats as YAML.