kubernetes

package
v0.3.0-prep Latest Latest
Warning

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

Go to latest
Published: May 4, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

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

Constants

View Source
const (
	StatusUnknown  = "unknown"
	StatusReady    = "ready"
	StatusUpdating = "updating"
)

Variables

View Source
var ErrReplicationControllersDeprecated = flux.UserConfigProblem{
	&flux.BaseError{
		Err: errors.New("updating replication controllers is deprecated"),
		Help: `Using Flux to update replication controllers is deprecated.

ReplicationController resources are difficult to update, and it is
almost certainly better to use a Deployment resource instead. Please
see

    https://kubernetes.io/docs/user-guide/replication-controller/#deployment-recommended

If replacing with a Deployment is not possible, you can still update a
ReplicationController manually (e.g., with kubectl rolling-update).
`,
	},
}

Functions

func FindDefinedServices

func FindDefinedServices(path string) (map[flux.ServiceID][]string, error)

FindDefinedServices finds all the services defined under the directory given, and returns a map of service IDs (from its specified namespace and name) to the paths of resource definition files.

func UpdateNotSupportedError

func UpdateNotSupportedError(kind string) error

func UpdatePodController

func UpdatePodController(def []byte, newImageID flux.ImageID, trace io.Writer) ([]byte, error)

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 Applier

type Applier interface {
	Delete(logger log.Logger, def *apiObject) error
	Apply(logger log.Logger, def *apiObject) error
}

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

func NewCluster(config *rest.Config, applier Applier, version string, logger log.Logger) (*Cluster, error)

NewCluster returns a usable cluster. Host should be of the form "http://hostname:8080".

func (*Cluster) AllServices

func (c *Cluster) AllServices(namespace string, ignore flux.ServiceIDSet) (res []platform.Service, err error)

AllServices returns all services matching the criteria; that is, in the namespace (or any namespace if that argument is empty), and not in the `ignore` set given.

func (*Cluster) Apply

func (c *Cluster) Apply(defs []platform.ServiceDefinition) error

Apply applies a new set of ServiceDefinition. If all definitions succeed, Apply returns a nil error. If any definitions fail, Apply returns an error of type ApplyError, which can be inspected for more detailed information. Applies are serialized.

func (*Cluster) Export

func (c *Cluster) Export() ([]byte, error)

func (*Cluster) Ping

func (c *Cluster) Ping() error

func (*Cluster) SomeServices

func (c *Cluster) SomeServices(ids []flux.ServiceID) (res []platform.Service, err error)

SomeServices returns the services named, missing out any that don't exist in the cluster. They do not necessarily have to be returned in the order requested.

func (*Cluster) Stop

func (c *Cluster) Stop()

Stop terminates the goroutine that serializes and executes requests against the cluster. A stopped cluster cannot be restarted.

func (*Cluster) Sync

func (c *Cluster) Sync(spec platform.SyncDef) error

Sync performs the given actions on resources. Operations are asynchronous, but serialised.

func (*Cluster) Version

func (c *Cluster) Version() (string, error)

type Kubectl

type Kubectl struct {
	// contains filtered or unexported fields
}

func NewKubectl

func NewKubectl(exe string, config *rest.Config, stdout, stderr io.Writer) *Kubectl

func (*Kubectl) Apply

func (c *Kubectl) Apply(logger log.Logger, obj *apiObject) error

func (*Kubectl) Delete

func (c *Kubectl) Delete(logger log.Logger, obj *apiObject) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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