kubectl

package
v0.0.0-...-3155cad Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2014 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientVersion

func GetClientVersion(w io.Writer)

func GetKubeClient

func GetKubeClient(config *client.Config, matchVersion bool) (*client.Client, error)

func GetVersion

func GetVersion(w io.Writer, kubeClient client.Interface)

func SaveNamespaceInfo

func SaveNamespaceInfo(path string, ns *NamespaceInfo) error

SaveNamespaceInfo saves a NamespaceInfo object at the specified file path.

Types

type AuthInfo

type AuthInfo struct {
	User        string
	Password    string
	CAFile      string
	CertFile    string
	KeyFile     string
	BearerToken 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 Describer

type Describer interface {
	Describe(namespace, name string) (output string, err error)
}

Describer generates output for the named resource or an error if the output could not be generated.

func DescriberFor

func DescriberFor(kind string, c *client.Client) (Describer, bool)

Describer returns the default describe functions for each of the standard Kubernetes types.

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(noHeaders bool) *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.

func (*HumanReadablePrinter) PrintObj

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

type JSONPrinter struct{}

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

func (*JSONPrinter) PrintObj

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 MinionDescriber

type MinionDescriber struct {
	MinionClient func() (client.MinionInterface, error)
}

MinionDescriber generates information about a minion.

func (*MinionDescriber) Describe

func (d *MinionDescriber) Describe(namespace, name string) (string, error)

type NamespaceInfo

type NamespaceInfo struct {
	Namespace string
}

func LoadNamespaceInfo

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 PodDescriber

type PodDescriber struct {
	PodClient                   func(namespace string) (client.PodInterface, error)
	ReplicationControllerClient func(namespace string) (client.ReplicationControllerInterface, error)
}

PodDescriber generates information about a pod and the replication controllers that create it.

func (*PodDescriber) Describe

func (d *PodDescriber) Describe(namespace, name string) (string, error)

type ProxyServer

type ProxyServer struct {
	httputil.ReverseProxy
	Port int
}

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

func NewProxyServer

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

func (s *ProxyServer) Serve() error

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

type RESTClient

type RESTClient interface {
	Get() *client.Request
	Post() *client.Request
	Delete() *client.Request
	Put() *client.Request
}

RESTClient is a client helper for dealing with RESTful resources in a generic way.

type RESTHelper

type RESTHelper struct {
	Resource string
	// A RESTClient capable of mutating this resource
	RESTClient RESTClient
	// A codec for decoding and encoding objects of this resource type.
	Codec runtime.Codec
	// An interface for reading or writing the resource version of this
	// type.
	Versioner runtime.ResourceVersioner
}

RESTHelper provides methods for retrieving or mutating a RESTful resource.

func NewRESTHelper

func NewRESTHelper(client RESTClient, mapping *meta.RESTMapping) *RESTHelper

NewRESTHelper creates a RESTHelper from a ResourceMapping

func (*RESTHelper) Create

func (m *RESTHelper) Create(namespace string, modify bool, data []byte) error

func (*RESTHelper) Delete

func (m *RESTHelper) Delete(namespace, name string) error

func (*RESTHelper) Get

func (m *RESTHelper) Get(namespace, name string, selector labels.Selector) (runtime.Object, error)

func (*RESTHelper) Update

func (m *RESTHelper) Update(namespace, name string, overwrite bool, data []byte) error

type ReplicationControllerDescriber

type ReplicationControllerDescriber struct {
	ReplicationControllerClient func(namespace string) (client.ReplicationControllerInterface, error)
	PodClient                   func(namespace string) (client.PodInterface, error)
}

ReplicationControllerDescriber generates information about a replication controller and the pods it has created.

func (*ReplicationControllerDescriber) Describe

func (d *ReplicationControllerDescriber) Describe(namespace, name string) (string, error)

type ResourcePrinter

type ResourcePrinter interface {
	// Print receives an arbitrary object, 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.

func GetPrinter

func GetPrinter(format, templateFile string, defaultPrinter ResourcePrinter) (ResourcePrinter, bool, error)

GetPrinter returns a resource printer and a bool indicating whether the object must be versioned for the given format.

type ServiceDescriber

type ServiceDescriber struct {
	ServiceClient func(namespace string) (client.ServiceInterface, error)
}

ServiceDescriber generates information about a service.

func (*ServiceDescriber) Describe

func (d *ServiceDescriber) Describe(namespace, name string) (string, error)

type TemplatePrinter

type TemplatePrinter struct {
	Template *template.Template
}

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

func (*TemplatePrinter) PrintObj

func (t *TemplatePrinter) PrintObj(obj runtime.Object, 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) PrintObj

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

PrintObj prints the data as YAML.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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