Documentation ¶
Index ¶
Constants ¶
const DefaultTarget = ""
DefaultTarget is the unnamed default target for the traffic.
const HttpScheme string = "http"
Variables ¶
This section is empty.
Functions ¶
func SubrouteDomain ¶ added in v0.5.0
SubrouteDomain returns the domain name of a traffic target given the traffic target name and the Route's base domain.
func SubrouteURL ¶ added in v0.5.0
subrouteURL returns the URL of the subroute given the scheme, traffic target name, and base domain. Curently the subroute is represented as a subdomain of the base domain.
Types ¶
type Config ¶ added in v0.4.0
type Config struct { // Group of traffic splits. Un-named targets are grouped together // under the key `DefaultTarget`, and named target are under the respective // name. This is used to configure network configuration to // realize a route's setting. Targets map[string]RevisionTargets // The referred `Configuration`s and `Revision`s. Configurations map[string]*v1alpha1.Configuration Revisions map[string]*v1alpha1.Revision // contains filtered or unexported fields }
Config encapsulates details of our traffic so that we don't need to make API calls, or use details of the route beyond its ObjectMeta to make routing changes.
func BuildTrafficConfiguration ¶
func BuildTrafficConfiguration(configLister listers.ConfigurationLister, revLister listers.RevisionLister, u *v1alpha1.Route) (*Config, error)
BuildTrafficConfiguration consolidates and flattens the Route.Spec.Traffic to the Revision-level. It also provides a complete lists of Configurations and Revisions referred by the Route, directly or indirectly. These referred targets are keyed by name for easy access.
In the case that some target is missing, an error of type TargetError will be returned.
func (*Config) GetRevisionTrafficTargets ¶ added in v0.4.0
func (t *Config) GetRevisionTrafficTargets(domain string) []v1alpha1.TrafficTarget
GetRevisionTrafficTargets returns a list of TrafficTarget flattened to the RevisionName, and having ConfigurationName cleared out.
type RevisionTarget ¶
type RevisionTarget struct { v1alpha1.TrafficTarget Active bool Protocol net.ProtocolType }
A RevisionTarget adds the Active/Inactive state and the transport protocol of a Revision to a flattened TrafficTarget.
type RevisionTargets ¶ added in v0.4.0
type RevisionTargets []RevisionTarget
RevisionTargets is a collection of revision targets.
func (RevisionTargets) GroupTargets ¶ added in v0.4.0
func (rt RevisionTargets) GroupTargets() (active RevisionTargets, passive RevisionTargets)
GroupTargets partitions the targets by active and inactive sets. GroupTargets ignores the targets with 0 percent.
type TargetError ¶
type TargetError interface { error // MarkBadTrafficTarget marks a RouteStatus with Condition corresponding // to the error case of the traffic target. MarkBadTrafficTarget(rs *v1alpha1.RouteStatus) // IsFailure returns whether a TargetError is a true failure, e.g. // a Configuration fails to become ready. IsFailure() bool }
TargetError gives details about an invalid traffic target.