Documentation ¶
Index ¶
- Constants
- Variables
- func NewStageTimer(stage string) *metrics.Timer
- func ObserveRelease(start time.Time, success bool, releaseType ReleaseType, ...)
- func PrintResults(out io.Writer, results Result, verbosity int)
- type Automated
- func (a *Automated) Add(service flux.ResourceID, container cluster.Container, image image.Ref)
- func (a *Automated) CalculateRelease(rc ReleaseContext, logger log.Logger) ([]*ControllerUpdate, Result, error)
- func (a *Automated) CommitMessage() string
- func (a *Automated) Images() []image.Ref
- func (a *Automated) ReleaseKind() ReleaseKind
- func (a *Automated) ReleaseType() ReleaseType
- type Cause
- type Change
- type ContainerUpdate
- type ControllerFilter
- type ControllerResult
- type ControllerUpdate
- type ControllerUpdateStatus
- type ExcludeFilter
- type ImageMap
- type ImageSpec
- type IncludeFilter
- type LockedFilter
- type ReleaseContext
- type ReleaseKind
- type ReleaseSpec
- type ReleaseType
- type ResourceSpec
- type Result
- type Spec
- type SpecificImageFilter
Constants ¶
const ( Locked = "locked" NotIncluded = "not included" Excluded = "excluded" DifferentImage = "a different image" NotInCluster = "not running in cluster" NotInRepo = "not found in repository" ImageNotFound = "cannot find one or more images" ImageUpToDate = "image(s) up to date" DoesNotUseImage = "does not use image(s)" )
const ( ResourceSpecAll = ResourceSpec("<all>") ImageSpecLatest = ImageSpec("<all latest>") )
const ( Images = "image" Policy = "policy" Auto = "auto" )
const UserAutomated = "<automated>"
Variables ¶
var (
ErrInvalidReleaseKind = errors.New("invalid release kind")
)
Functions ¶
func NewStageTimer ¶
func ObserveRelease ¶
func ObserveRelease(start time.Time, success bool, releaseType ReleaseType, releaseKind ReleaseKind)
func PrintResults ¶
PrintResults outputs a result set to the `io.Writer` provided, at the given level of verbosity:
- 2 = include skipped and ignored resources
- 1 = include skipped resources, exclude ignored resources
- 0 = exclude skipped and ignored resources
Types ¶
type Automated ¶
type Automated struct {
Changes []Change
}
func (*Automated) CalculateRelease ¶
func (a *Automated) CalculateRelease(rc ReleaseContext, logger log.Logger) ([]*ControllerUpdate, Result, error)
func (*Automated) CommitMessage ¶
func (*Automated) ReleaseKind ¶
func (a *Automated) ReleaseKind() ReleaseKind
func (*Automated) ReleaseType ¶
func (a *Automated) ReleaseType() ReleaseType
type ContainerUpdate ¶
type ControllerFilter ¶
type ControllerFilter interface {
Filter(ControllerUpdate) ControllerResult
}
type ControllerResult ¶
type ControllerResult struct { Status ControllerUpdateStatus // summary of what happened, e.g., "incomplete", "ignored", "success" Error string `json:",omitempty"` // error if there was one finding the service (e.g., it doesn't exist in repo) PerContainer []ContainerUpdate // what happened with each container }
func (ControllerResult) Msg ¶
func (fr ControllerResult) Msg(id flux.ResourceID) string
type ControllerUpdate ¶
type ControllerUpdate struct { ResourceID flux.ResourceID Controller cluster.Controller ManifestPath string ManifestBytes []byte Updates []ContainerUpdate }
func (*ControllerUpdate) Filter ¶
func (s *ControllerUpdate) Filter(filters ...ControllerFilter) ControllerResult
type ControllerUpdateStatus ¶
type ControllerUpdateStatus string
const ( ReleaseStatusSuccess ControllerUpdateStatus = "success" ReleaseStatusFailed ControllerUpdateStatus = "failed" ReleaseStatusSkipped ControllerUpdateStatus = "skipped" ReleaseStatusIgnored ControllerUpdateStatus = "ignored" ReleaseStatusUnknown ControllerUpdateStatus = "unknown" )
type ExcludeFilter ¶
type ExcludeFilter struct {
IDs []flux.ResourceID
}
func (*ExcludeFilter) Filter ¶
func (f *ExcludeFilter) Filter(u ControllerUpdate) ControllerResult
type ImageMap ¶
type ImageMap struct {
// contains filtered or unexported fields
}
func CollectAvailableImages ¶
func CollectAvailableImages(reg registry.Registry, services []cluster.Controller, logger log.Logger) (ImageMap, error)
CollectAvailableImages finds all the known image metadata for containers in the controllers given.
func (ImageMap) Available ¶
Available returns image.Info entries for all the images in the named image repository.
func (ImageMap) LatestImage ¶
LatestImage returns the latest releasable image for a repository for which the tag matches a given pattern. A releasable image is one that is not tagged "latest". (Assumes the available images are in descending order of latestness.) If no such image exists, returns a zero value and `false`, and the caller can decide whether that's an error or not.
type ImageSpec ¶
type ImageSpec string
ImageSpec is an ImageID, or "<all latest>" (update all containers to the latest available).
func ImageSpecFromRef ¶
func ParseImageSpec ¶
type IncludeFilter ¶
type IncludeFilter struct {
IDs []flux.ResourceID
}
func (*IncludeFilter) Filter ¶
func (f *IncludeFilter) Filter(u ControllerUpdate) ControllerResult
type LockedFilter ¶
type LockedFilter struct {
IDs []flux.ResourceID
}
func (*LockedFilter) Filter ¶
func (f *LockedFilter) Filter(u ControllerUpdate) ControllerResult
type ReleaseContext ¶
type ReleaseContext interface { SelectServices(Result, []ControllerFilter, []ControllerFilter) ([]*ControllerUpdate, error) ServicesWithPolicies() (policy.ResourceMap, error) Registry() registry.Registry Manifests() cluster.Manifests }
type ReleaseKind ¶
type ReleaseKind string
ReleaseKind says whether a release is to be planned only, or planned then executed
const ( ReleaseKindPlan ReleaseKind = "plan" ReleaseKindExecute = "execute" )
func ParseReleaseKind ¶
func ParseReleaseKind(s string) (ReleaseKind, error)
type ReleaseSpec ¶
type ReleaseSpec struct { ServiceSpecs []ResourceSpec ImageSpec ImageSpec Kind ReleaseKind Excludes []flux.ResourceID }
NB: these get sent from fluxctl, so we have to maintain the json format of this. Eugh.
func (ReleaseSpec) CalculateRelease ¶
func (s ReleaseSpec) CalculateRelease(rc ReleaseContext, logger log.Logger) ([]*ControllerUpdate, Result, error)
func (ReleaseSpec) CommitMessage ¶
func (s ReleaseSpec) CommitMessage() string
func (ReleaseSpec) ReleaseKind ¶
func (s ReleaseSpec) ReleaseKind() ReleaseKind
func (ReleaseSpec) ReleaseType ¶
func (s ReleaseSpec) ReleaseType() ReleaseType
ReleaseType gives a one-word description of the release, mainly useful for labelling metrics or log messages.
type ReleaseType ¶
type ReleaseType string
type ResourceSpec ¶
type ResourceSpec string // ResourceID or "<all>"
func MakeResourceSpec ¶
func MakeResourceSpec(id flux.ResourceID) ResourceSpec
func ParseResourceSpec ¶
func ParseResourceSpec(s string) (ResourceSpec, error)
func (ResourceSpec) AsID ¶
func (s ResourceSpec) AsID() (flux.ResourceID, error)
func (ResourceSpec) String ¶
func (s ResourceSpec) String() string
type Result ¶
type Result map[flux.ResourceID]ControllerResult
func (Result) ServiceIDs ¶
type Spec ¶
type Spec struct { Type string `json:"type"` Cause Cause `json:"cause"` Spec interface{} `json:"spec"` }
A tagged union for all (both) kinds of update. The type is just so we know how to decode the rest of the struct.
func (*Spec) UnmarshalJSON ¶
type SpecificImageFilter ¶
func (*SpecificImageFilter) Filter ¶
func (f *SpecificImageFilter) Filter(u ControllerUpdate) ControllerResult