Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidServiceID = errors.New("invalid service ID") LegacyServiceIDRegexp = regexp.MustCompile("^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$") // The namespace and name components are (apparently // non-normatively) defined in // https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md // In practice, more punctuation is used than allowed there; // specifically, people use underscores as well as dashes and dots, and in names, colons. IDRegexp = regexp.MustCompile("^(<cluster>|[a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.:-]+)$") UnqualifiedIDRegexp = regexp.MustCompile("^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_.:-]+)$") )
Functions ¶
func ChangesForPolicyUpdate ¶
func ChangesForPolicyUpdate(workload Workload, update PolicyUpdate) (map[string]string, error)
ChangeForPolicyUpdate evaluates a policy update with respect to a workload. The reason this exists at all is that an `Update` can include qualified policies, for example "tag all containers"; and to make actual changes, we need to examine the workload to which it's to be applied.
This also translates policy deletion to empty values (i.e., `""`), to make it easy to use as command-line arguments or environment variables. When represented in manifests, policies are expected to have a non-empty value when present, even if it's `"true"`; so an empty value can safely denote deletion.
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is an opaque type which uniquely identifies a resource in an orchestrator.
func MustParseID ¶
MustParseID constructs a ID from a string representation, panicing if the format is invalid.
func ParseID ¶
ParseID constructs a ID from a string representation if possible, returning an error value otherwise.
func ParseIDOptionalNamespace ¶
ParseIDOptionalNamespace constructs a ID from either a fully qualified string representation, or an unqualified kind/name representation and the supplied namespace.
func (ID) Components ¶
Components returns the constituent components of a ID
func (ID) MarshalJSON ¶
MarshalJSON encodes a ID as a JSON string. This is done to maintain backwards compatibility with previous flux versions where the ID is a plain string.
func (ID) MarshalText ¶
MarshalText encodes a ID as a flat string; this is required because ResourceIDs are sometimes used as map keys.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON decodes a ID from a JSON string. This is done to maintain backwards compatibility with previous flux versions where the ID is a plain string.
func (*ID) UnmarshalText ¶
MarshalText decodes a ID from a flat string; this is required because ResourceIDs are sometimes used as map keys.
type PolicyUpdate ¶
type PolicyUpdates ¶
type PolicyUpdates map[ID]PolicyUpdate
type Resource ¶
type Resource interface { ResourceID() ID // name, to correlate with what's in the cluster Policies() policy.Set // policy for this resource; e.g., whether it is locked, automated, ignored Source() string // where did this come from (informational) Bytes() []byte // the definition, for sending to cluster.Sync }
For the minute we just care about