View Source
const (
	StatusUnknown  = "unknown"
	StatusError    = "error"
	StatusReady    = "ready"
	StatusUpdating = "updating"
	StatusStarted  = "started"

Constants for workload ready status. These are defined here so that no-one has to drag in Kubernetes dependencies to be able to use them.


View Source
var AlwaysInclude = IncluderFunc(func(string) bool { return true })


This section is empty.


type Cluster

type Cluster interface {
	// Get all of the services (optionally, from a specific namespace), excluding those
	AllWorkloads(ctx context.Context, maybeNamespace string) ([]Workload, error)
	SomeWorkloads(ctx context.Context, ids []resource.ID) ([]Workload, error)
	IsAllowedResource(resource.ID) bool
	Ping() error
	Export(ctx context.Context) ([]byte, error)
	Sync(SyncSet) error
	PublicSSHKey(regenerate bool) (ssh.PublicKey, error)

The things we can get from the running cluster. These used to form the remote.Platform interface; but now we do more in the daemon so they are distinct interfaces.

type ContainersOrExcuse

type ContainersOrExcuse struct {
	Excuse     string
	Containers []resource.Container

Sometimes we care if we can't find the containers for a service, sometimes we just want the information we can get.

type ExcludeIncludeGlob

type ExcludeIncludeGlob struct {
	Include []string
	Exclude []string

ExcludeIncludeGlob is an Includer that uses glob patterns to decide what to include or exclude. Note that Include and Exclude are treated differently -- see the method IsIncluded.

func (ExcludeIncludeGlob) IsIncluded

func (ei ExcludeIncludeGlob) IsIncluded(s string) bool

IsIncluded implements Includer using the logic:

- if the string matches any exclude pattern, don't include it
- otherwise, if there are no include patterns, include it
- otherwise, if it matches an include pattern, include it
= otherwise don't include it.

type Includer

type Includer interface {
	IsIncluded(string) bool

type IncluderFunc

type IncluderFunc func(string) bool

func (IncluderFunc) IsIncluded

func (f IncluderFunc) IsIncluded(s string) bool

type ResourceError

type ResourceError struct {
	ResourceID resource.ID
	Source     string
	Error      error

type RolloutStatus

type RolloutStatus struct {
	// Desired number of pods as defined in spec.
	Desired int32
	// Updated number of pods that are on the desired pod spec.
	Updated int32
	// Ready number of pods targeted by this deployment.
	Ready int32
	// Available number of available pods (ready for at least minReadySeconds) targeted by this deployment.
	Available int32
	// Outdated number of pods that are on a different pod spec.
	Outdated int32
	// Messages about unexpected rollout progress
	// if there's a message here, the rollout will not make progress without intervention
	Messages []string

RolloutStatus describes numbers of pods in different states and the messages about unexpected rollout progress a rollout status might be: - in progress: Updated, Ready or Available numbers are not equal to Desired, or Outdated not equal to 0 - stuck: Messages contains info if deployment unavailable or exceeded its progress deadline - complete: Updated, Ready and Available numbers are equal to Desired and Outdated equal to 0 See

type SyncError

type SyncError []ResourceError

func (SyncError) Error

func (err SyncError) Error() string

type SyncSet

type SyncSet struct {
	Name      string
	Resources []resource.Resource

SyncSet groups the set of resources to be updated. Usually this is the set of resources found in a git repo; in any case, it must represent the complete set of resources, as garbage collection will assume missing resources should be deleted. The name is used to distinguish the resources from a set from other resources -- e.g., cluster resources not marked as belonging to a set will not be deleted by garbage collection.

type Workload

type Workload struct {
	ID     resource.ID
	Status string // A status summary for display
	// Is the controller considered read-only because it's under the
	// control of the platform. In the case of Kubernetes, we simply
	// omit these controllers; but this may not always be the case.
	IsSystem bool
	// If this workload was created _because_ of another, antecedent
	// resource through some mechanism (like an operator, or custom
	// resource controller), we try to record the ID of that resource
	// in this field.
	Antecedent resource.ID
	Labels     map[string]string
	Policies   policy.Set
	Rollout    RolloutStatus
	// Errors during the recurring sync from the Git repository to the
	// cluster will surface here.
	SyncError error

	Containers ContainersOrExcuse

Workload describes a cluster resource that declares versioned images.

func (Workload) ContainersOrError

func (s Workload) ContainersOrError() ([]resource.Container, error)

func (Workload) ContainersOrNil

func (s Workload) ContainersOrNil() []resource.Container


Path Synopsis
Package kubernetes provides implementations of `Cluster` and `manifests` that interact with the Kubernetes API (using kubectl or the k8s API client).
Package kubernetes provides implementations of `Cluster` and `manifests` that interact with the Kubernetes API (using kubectl or the k8s API client).