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
- Variables
- func FindDefinedServices(path string) (map[flux.ServiceID][]string, error)
- func UpdateNotSupportedError(kind string) error
- func UpdatePodController(def []byte, newImageID flux.ImageID, trace io.Writer) ([]byte, error)
- type Applier
- type Cluster
- func (c *Cluster) AllServices(namespace string, ignore flux.ServiceIDSet) (res []platform.Service, err error)
- func (c *Cluster) Apply(defs []platform.ServiceDefinition) error
- func (c *Cluster) Export() ([]byte, error)
- func (c *Cluster) Ping() error
- func (c *Cluster) SomeServices(ids []flux.ServiceID) (res []platform.Service, err error)
- func (c *Cluster) Stop()
- func (c *Cluster) Sync(spec platform.SyncDef) error
- func (c *Cluster) Version() (string, error)
- type Kubectl
Constants ¶
const ( StatusUnknown = "unknown" StatusReady = "ready" StatusUpdating = "updating" )
Variables ¶
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 ¶
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 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 ¶
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) SomeServices ¶
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.