Documentation ¶
Overview ¶
Package kubernetes provides abstractions for the Kubernetes platform. At the moment, Kubernetes is the only supported platform, so we are directly returning Kubernetes objects. As we add more platforms, we will create abstractions and common data types in package platform.
Index ¶
- Variables
- func FilesFor(path, namespace, service string) (filenames []string, err error)
- func UpdatePodController(def []byte, newImageName string, trace io.Writer) ([]byte, error)
- type Cluster
- func (c *Cluster) ContainersFor(namespace, serviceName string) (res []platform.Container, err error)
- func (c *Cluster) Namespaces() ([]string, error)
- func (c *Cluster) Release(namespace, serviceName string, newDefinition []byte) error
- func (c *Cluster) Service(namespace, service string) (platform.Service, error)
- func (c *Cluster) Services(namespace string) ([]platform.Service, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptySelector = errors.New("empty selector") ErrWrongResourceKind = errors.New("new definition does not match existing resource") ErrNoMatchingService = errors.New("no matching service") ErrServiceHasNoSelector = errors.New("service has no selector") ErrNoMatching = errors.New("no matching replication controllers or deployments") ErrMultipleMatching = errors.New("multiple matching replication controllers or deployments") ErrNoMatchingImages = errors.New("no matching images") )
These errors are returned by cluster methods.
Functions ¶
func FilesFor ¶
FilesFor returns the resource definition files in path (or any subdirectory) that are responsible for driving the given namespace/service. It presumes kubeservice is available in the PWD or PATH.
func UpdatePodController ¶
UpdatePodController takes the body of a ReplicationController or Deployment resource definition (specified in YAML) and the name of the new image that should be put in the definition (in the format "repo.org/group/name:tag"). It returns a new resource definition body where all references to the old image have been replaced with the new one.
This function has many additional requirements that are likely in flux. Read the source to learn about them.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster is a handle to a Kubernetes API server. (Typically, this code is deployed into the same cluster.)
func NewCluster ¶
NewCluster returns a usable cluster. Host should be of the form "http://hostname:8080".
func (*Cluster) ContainersFor ¶
func (c *Cluster) ContainersFor(namespace, serviceName string) (res []platform.Container, err error)
ContainersFor returns a list of container names with the image specified to run in that container, for a particular service. This is useful to see which images a particular service is presently running, to judge whether a release is needed.
func (*Cluster) Namespaces ¶
Namespaces returns the set of available namespaces on the platform.
func (*Cluster) Release ¶
Release performs a update of the service, from whatever it is currently, to what is described by the new resource, which can be a replication controller or deployment.
Release assumes there is a one-to-one mapping between services and replication controllers or deployments; this can be improved. Release blocks until the rolling update is complete; this can be improved. Release invokes `kubectl rolling-update` or `kubectl apply` in a seperate process, and assumes kubectl is in the PATH; this can be improved.
func (*Cluster) Services ¶
Services returns the set of services currently active on the platform in the given namespace. Maybe it makes sense to move the namespace to the constructor? Depends on how it will be used. For now it is here.
The user is expected to list services, and then choose the one that will receive a release. Releases operate on replication controllers, not services. For now, we make a simplifying assumption that there is a one-to-one mapping between services and replication controllers.