implement canary annotation and alternative backends
Adds the ability to create alternative backends. Alternative backends enable traffic shaping by sharing a single location but routing to different backends depending on the TrafficShapingPolicy defined by AlternativeBackends. When the list of upstreams and servers are retrieved, we then call mergeAlternativeBackends which iterates through the paths of every ingress and checks if the backend supporting the path is a AlternativeBackend. If so, we then iterate through the map of servers and find the real backend that the AlternativeBackend should fall under. Once found, the AlternativeBackend is embedded in the list of VirtualBackends for the real backend. If no matching real backend for a AlternativeBackend is found, then the AlternativeBackend is deleted as it cannot be backed by any server.
This commit is contained in:
parent
5ceb723963
commit
412cd70d3a
18 changed files with 859 additions and 23 deletions
|
|
@ -32,6 +32,14 @@ var (
|
|||
ErrInvalidAnnotationName = errors.New("invalid annotation name")
|
||||
)
|
||||
|
||||
// NewInvalidAnnotationConfiguration returns a new InvalidConfiguration error for use when
|
||||
// annotations are not correctly configured
|
||||
func NewInvalidAnnotationConfiguration(name string, reason string) error {
|
||||
return InvalidConfiguration{
|
||||
Name: fmt.Sprintf("the annotation %v does not contain a valid configuration: %v", name, reason),
|
||||
}
|
||||
}
|
||||
|
||||
// NewInvalidAnnotationContent returns a new InvalidContent error
|
||||
func NewInvalidAnnotationContent(name string, val interface{}) error {
|
||||
return InvalidContent{
|
||||
|
|
@ -46,6 +54,15 @@ func NewLocationDenied(reason string) error {
|
|||
}
|
||||
}
|
||||
|
||||
// InvalidConfiguration Error
|
||||
type InvalidConfiguration struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func (e InvalidConfiguration) Error() string {
|
||||
return e.Name
|
||||
}
|
||||
|
||||
// InvalidContent error
|
||||
type InvalidContent struct {
|
||||
Name string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue