traffic

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RevisionTarget

type RevisionTarget struct {
	v1alpha1.TrafficTarget
	Active bool
}

A RevisionTarget adds the Active/Inactive state of a Revision to a flattened TrafficTarget.

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.

type TrafficConfig

type TrafficConfig struct {
	// Group of traffic splits.  Un-named targets are grouped together
	// under the key "", and named target are under the respective
	// name.  This is used to configure network configuration to
	// realize a route's setting.
	Targets map[string][]RevisionTarget

	// A list traffic targets, flattened to the Revision level.  This
	// is used to populate the Route.Status.TrafficTarget field.
	RevisionTargets []RevisionTarget

	// The referred Configurations and Revisions.
	Configurations map[string]*v1alpha1.Configuration
	Revisions      map[string]*v1alpha1.Revision
}

TrafficConfig 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) (*TrafficConfig, 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 (*TrafficConfig) GetRevisionTrafficTargets

func (t *TrafficConfig) GetRevisionTrafficTargets() []v1alpha1.TrafficTarget

GetRevisionTrafficTargets return a list of TrafficTarget flattened to the RevisionName, and having ConfigurationName cleared out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL