flux: github.com/weaveworks/flux/pkg/policy Index | Files

package policy

import "github.com/weaveworks/flux/pkg/policy"

Index

Package Files

pattern.go policy.go

Constants

const (
    Ignore     = Policy("ignore")
    Locked     = Policy("locked")
    LockedUser = Policy("locked_user")
    LockedMsg  = Policy("locked_msg")
    Automated  = Policy("automated")
    TagAll     = Policy("tag_all")
)
const IgnoreSyncOnly = "sync_only"

Variables

var (
    // PatternAll matches everything.
    PatternAll    = NewPattern(globPrefix + "*")
    PatternLatest = NewPattern(globPrefix + "latest")
)

func Boolean Uses

func Boolean(policy Policy) bool

func Tag Uses

func Tag(policy Policy) bool

type GlobPattern Uses

type GlobPattern string

func (GlobPattern) Matches Uses

func (g GlobPattern) Matches(tag string) bool

func (GlobPattern) Newer Uses

func (g GlobPattern) Newer(a, b *image.Info) bool

func (GlobPattern) RequiresTimestamp Uses

func (g GlobPattern) RequiresTimestamp() bool

func (GlobPattern) String Uses

func (g GlobPattern) String() string

func (GlobPattern) Valid Uses

func (g GlobPattern) Valid() bool

type Pattern Uses

type Pattern interface {
    // Matches returns true if the given image tag matches the pattern.
    Matches(tag string) bool
    // String returns the prefixed string representation.
    String() string
    // Newer returns true if image `a` is newer than image `b`.
    Newer(a, b *image.Info) bool
    // Valid returns true if the pattern is considered valid.
    Valid() bool
    // RequiresTimestamp returns true if the pattern orders based on timestamp data.
    RequiresTimestamp() bool
}

Pattern provides an interface to match image tags.

func GetTagPattern Uses

func GetTagPattern(policies Set, container string) Pattern

func NewPattern Uses

func NewPattern(pattern string) Pattern

NewPattern instantiates a Pattern according to the prefix it finds. The prefix can be either `glob:` (default if omitted), `semver:` or `regexp:`.

type Policy Uses

type Policy string

Policy is an string, denoting the current deployment policy of a service, e.g. automated, or locked.

func TagPrefix Uses

func TagPrefix(container string) Policy

type RegexpPattern Uses

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

RegexpPattern matches by regular expression.

func (RegexpPattern) Matches Uses

func (r RegexpPattern) Matches(tag string) bool

func (RegexpPattern) Newer Uses

func (r RegexpPattern) Newer(a, b *image.Info) bool

func (RegexpPattern) RequiresTimestamp Uses

func (r RegexpPattern) RequiresTimestamp() bool

func (RegexpPattern) String Uses

func (r RegexpPattern) String() string

func (RegexpPattern) Valid Uses

func (r RegexpPattern) Valid() bool

type SemverPattern Uses

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

SemverPattern matches by semantic versioning. See https://semver.org/

func (SemverPattern) Matches Uses

func (s SemverPattern) Matches(tag string) bool

func (SemverPattern) Newer Uses

func (s SemverPattern) Newer(a, b *image.Info) bool

func (SemverPattern) RequiresTimestamp Uses

func (s SemverPattern) RequiresTimestamp() bool

func (SemverPattern) String Uses

func (s SemverPattern) String() string

func (SemverPattern) Valid Uses

func (s SemverPattern) Valid() bool

type Set Uses

type Set map[Policy]string

func (Set) Add Uses

func (s Set) Add(ps ...Policy) Set

func (Set) Get Uses

func (s Set) Get(p Policy) (string, bool)

func (Set) Has Uses

func (s Set) Has(needle Policy) bool

Has returns true if a resource has a particular policy present, and for boolean policies, if it is set to true.

func (Set) Set Uses

func (s Set) Set(p Policy, v string) Set

func (Set) String Uses

func (s Set) String() string

func (Set) ToStringMap Uses

func (s Set) ToStringMap() map[string]string

func (*Set) UnmarshalJSON Uses

func (s *Set) UnmarshalJSON(in []byte) error

We used to specify a set of policies as []Policy, and in some places it may be so serialised.

func (Set) Without Uses

func (s Set) Without(omit Policy) Set

Package policy imports 6 packages (graph). Updated 2020-08-22. Refresh now. Tools for package owners.