Documentation ¶
Index ¶
- Constants
- Variables
- func FilterImages(images []image.Info, pattern policy.Pattern) []image.Info
- 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 resource.ID, container resource.Container, image image.Ref)
- func (a *Automated) CalculateRelease(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
- func (a *Automated) CommitMessage(result Result) string
- func (a *Automated) ReleaseKind() ReleaseKind
- func (a *Automated) ReleaseType() ReleaseType
- type Cause
- type Change
- type ContainerUpdate
- type ExcludeFilter
- type IgnoreFilter
- type ImageRepos
- type ImageSpec
- type IncludeFilter
- type LockedFilter
- type ManualSync
- type Menu
- type ReleaseContainersSpec
- func (s ReleaseContainersSpec) CalculateRelease(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
- func (s ReleaseContainersSpec) CommitMessage(result Result) string
- func (s ReleaseContainersSpec) ReleaseKind() ReleaseKind
- func (s ReleaseContainersSpec) ReleaseType() ReleaseType
- type ReleaseContext
- type ReleaseImageSpec
- func (s ReleaseImageSpec) CalculateRelease(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
- func (s ReleaseImageSpec) CommitMessage(result Result) string
- func (s ReleaseImageSpec) ReleaseKind() ReleaseKind
- func (s ReleaseImageSpec) ReleaseType() ReleaseType
- type ReleaseKind
- type ReleaseType
- type ResourceSpec
- type Result
- type SortedImageInfos
- type Spec
- type SpecificImageFilter
- type WorkloadFilter
- type WorkloadResult
- type WorkloadUpdate
- type WorkloadUpdateStatus
Constants ¶
const ( Locked = "locked" Ignore = "ignore" NotIncluded = "not included" Excluded = "excluded" DifferentImage = "a different image" NotAccessibleInCluster = "not accessible 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)" ContainerNotFound = "container(s) not found: %s" ContainerTagMismatch = "container(s) tag mismatch: %s" )
const ( ResourceSpecAll = ResourceSpec("<all>") ImageSpecLatest = ImageSpec("<all latest>") )
const ( Images = "image" Policy = "policy" Auto = "auto" Sync = "sync" Containers = "containers" )
const UserAutomated = "<automated>"
Variables ¶
var (
ErrInvalidReleaseKind = errors.New("invalid release kind")
)
Functions ¶
func FilterImages ¶
FilterImages returns only the images that match the pattern, in a new list.
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(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
func (*Automated) CommitMessage ¶
func (*Automated) ReleaseKind ¶
func (a *Automated) ReleaseKind() ReleaseKind
func (*Automated) ReleaseType ¶
func (a *Automated) ReleaseType() ReleaseType
type ContainerUpdate ¶
type ExcludeFilter ¶
func (*ExcludeFilter) Filter ¶
func (f *ExcludeFilter) Filter(u WorkloadUpdate) WorkloadResult
type IgnoreFilter ¶
type IgnoreFilter struct { }
func (*IgnoreFilter) Filter ¶
func (f *IgnoreFilter) Filter(u WorkloadUpdate) WorkloadResult
type ImageRepos ¶
type ImageRepos struct {
// contains filtered or unexported fields
}
ImageRepos contains a map of image repositories to their metadata
func FetchImageRepos ¶
FetchImageRepos finds all the known image metadata for containers in the controllers given.
func (ImageRepos) GetRepositoryMetadata ¶
func (r ImageRepos) GetRepositoryMetadata(repo image.Name) image.RepositoryMetadata
GetRepositoryMetadata returns the metadata for all the images in the named image repository.
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 ¶
func (*IncludeFilter) Filter ¶
func (f *IncludeFilter) Filter(u WorkloadUpdate) WorkloadResult
type LockedFilter ¶
type LockedFilter struct { }
func (*LockedFilter) Filter ¶
func (f *LockedFilter) Filter(u WorkloadUpdate) WorkloadResult
type ManualSync ¶
type ManualSync struct { }
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu presents a list of controllers which can be interacted with.
func NewMenu ¶
NewMenu creates a menu printer that 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
It can print a one time listing with `Print()` or then enter interactive mode with `Run()`.
type ReleaseContainersSpec ¶
type ReleaseContainersSpec struct { Kind ReleaseKind ContainerSpecs map[resource.ID][]ContainerUpdate SkipMismatches bool Force bool }
ReleaseContainersSpec defines the spec for a `containers` manifest update.
func (ReleaseContainersSpec) CalculateRelease ¶
func (s ReleaseContainersSpec) CalculateRelease(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
CalculateRelease computes required controller updates to satisfy this specification. It returns an error if any spec calculation fails unless `SkipMismatches` is true.
func (ReleaseContainersSpec) CommitMessage ¶
func (s ReleaseContainersSpec) CommitMessage(result Result) string
func (ReleaseContainersSpec) ReleaseKind ¶
func (s ReleaseContainersSpec) ReleaseKind() ReleaseKind
func (ReleaseContainersSpec) ReleaseType ¶
func (s ReleaseContainersSpec) ReleaseType() ReleaseType
type ReleaseContext ¶
type ReleaseContext interface { SelectWorkloads(context.Context, Result, []WorkloadFilter, []WorkloadFilter) ([]*WorkloadUpdate, error) Registry() registry.Registry }
type ReleaseImageSpec ¶
type ReleaseImageSpec struct { ServiceSpecs []ResourceSpec // TODO: rename to WorkloadSpecs after adding versioning ImageSpec ImageSpec Kind ReleaseKind Excludes []resource.ID Force bool }
NB: these get sent from fluxctl, so we have to maintain the json format of this. Eugh.
func (ReleaseImageSpec) CalculateRelease ¶
func (s ReleaseImageSpec) CalculateRelease(ctx context.Context, rc ReleaseContext, logger log.Logger) ([]*WorkloadUpdate, Result, error)
func (ReleaseImageSpec) CommitMessage ¶
func (s ReleaseImageSpec) CommitMessage(result Result) string
func (ReleaseImageSpec) ReleaseKind ¶
func (s ReleaseImageSpec) ReleaseKind() ReleaseKind
func (ReleaseImageSpec) ReleaseType ¶
func (s ReleaseImageSpec) ReleaseType() ReleaseType
ReleaseType gives a one-word description of the release, mainly useful for labelling metrics or log messages.
type ReleaseKind ¶
type ReleaseKind string
ReleaseKind says whether a release is to be planned only, or planned then executed
const ( ReleaseKindPlan ReleaseKind = "plan" ReleaseKindExecute ReleaseKind = "execute" )
func ParseReleaseKind ¶
func ParseReleaseKind(s string) (ReleaseKind, error)
type ReleaseType ¶
type ReleaseType string
type ResourceSpec ¶
type ResourceSpec string // ID or "<all>"
func MakeResourceSpec ¶
func MakeResourceSpec(id resource.ID) ResourceSpec
func ParseResourceSpec ¶
func ParseResourceSpec(s string) (ResourceSpec, error)
func (ResourceSpec) String ¶
func (s ResourceSpec) String() string
type Result ¶
type Result map[resource.ID]WorkloadResult
func (Result) AffectedResources ¶
func (Result) ChangedImages ¶
func (Result) WorkloadIDs ¶
type SortedImageInfos ¶
SortedImageInfos is a list of sorted image.Info
func FilterAndSortRepositoryMetadata ¶
func FilterAndSortRepositoryMetadata(rm image.RepositoryMetadata, pattern policy.Pattern) (SortedImageInfos, error)
FilterAndSortRepositoryMetadata obtains all the image information from the metadata after filtering and sorting. Filtering happens in the metadata directly to minimize problems with tag inconsistencies (i.e. tags without matching image information)
func SortImages ¶
func SortImages(images []image.Info, pattern policy.Pattern) SortedImageInfos
SortImages orders the images according to the pattern order in a new list.
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 WorkloadUpdate) WorkloadResult
type WorkloadFilter ¶
type WorkloadFilter interface {
Filter(WorkloadUpdate) WorkloadResult
}
type WorkloadResult ¶
type WorkloadResult struct { Status WorkloadUpdateStatus // 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 }
type WorkloadUpdate ¶
type WorkloadUpdate struct { ResourceID resource.ID Workload cluster.Workload Resource resource.Workload Updates []ContainerUpdate }
func (*WorkloadUpdate) Filter ¶
func (s *WorkloadUpdate) Filter(filters ...WorkloadFilter) WorkloadResult
type WorkloadUpdateStatus ¶
type WorkloadUpdateStatus string
const ( ReleaseStatusSuccess WorkloadUpdateStatus = "success" ReleaseStatusFailed WorkloadUpdateStatus = "failed" ReleaseStatusSkipped WorkloadUpdateStatus = "skipped" ReleaseStatusIgnored WorkloadUpdateStatus = "ignored" ReleaseStatusUnknown WorkloadUpdateStatus = "unknown" )