Documentation ¶
Overview ¶
Package definitions provides type definitions, parsing, marshaling and
validation for Kubernetes resources used by Skipper.
Index ¶
- Constants
- func ValidateIngress(_ *IngressItem) error
- func ValidateIngresses(ingressList IngressList) error
- func ValidateRouteGroup(rg *RouteGroupItem) error
- func ValidateRouteGroups(rl *RouteGroupList) error
- type Backend
- type BackendPort
- type BackendReference
- type HTTPRule
- type IngressItem
- type IngressList
- type IngressSpec
- type Metadata
- type PathRule
- type ResourceID
- type RouteGroupItem
- type RouteGroupList
- type RouteGroupSpec
- type RouteSpec
- type Rule
- type SkipperBackend
Constants ¶
const (
ServiceBackend = eskip.LBBackend + 1 + iota
)
adding Kubernetes specific backend types here. To be discussed. The main reason is to differentiate between service and external, in a way where we can also use the current global option to decide whether the service should then be converted to LB. Or shall we expect the route group already contain the pod endpoints, and ignore the global option for skipper? --> As CRD we have to lookup endpoints ourselves, maybe via kube.go
Variables ¶
This section is empty.
Functions ¶
func ValidateIngress ¶
func ValidateIngress(_ *IngressItem) error
TODO: implement once IngressItem has a validate method ValidateIngress is a no-op
func ValidateIngresses ¶
func ValidateIngresses(ingressList IngressList) error
ValidateIngresses is a no-op
func ValidateRouteGroup ¶
func ValidateRouteGroup(rg *RouteGroupItem) error
ValidateRouteGroup validates a RouteGroupItem
func ValidateRouteGroups ¶
func ValidateRouteGroups(rl *RouteGroupList) error
ValidateRouteGroups validates a RouteGroupList
Types ¶
type Backend ¶
type Backend struct { ServiceName string `json:"serviceName"` ServicePort BackendPort `json:"servicePort"` // Traffic field used for custom traffic weights, but not part of the ingress spec. Traffic float64 // number of True predicates to add to support multi color traffic switching NoopCount int }
type BackendPort ¶
type BackendPort struct {
Value interface{}
}
func (BackendPort) MarshalJSON ¶
func (p BackendPort) MarshalJSON() ([]byte, error)
func (BackendPort) Name ¶
func (p BackendPort) Name() (string, bool)
func (BackendPort) Number ¶
func (p BackendPort) Number() (int, bool)
func (BackendPort) String ¶
func (p BackendPort) String() string
func (*BackendPort) UnmarshalJSON ¶
func (p *BackendPort) UnmarshalJSON(value []byte) error
type BackendReference ¶
type IngressItem ¶
type IngressItem struct { Metadata *Metadata `json:"metadata"` Spec *IngressSpec `json:"spec"` }
type IngressList ¶
type IngressList struct {
Items []*IngressItem `json:"items"`
}
func ParseIngressJSON ¶
func ParseIngressJSON(d []byte) (IngressList, error)
ParseIngressJSON parse JSON into an IngressList
func ParseIngressYAML ¶
func ParseIngressYAML(d []byte) (IngressList, error)
ParseIngressYAML parse YAML into an IngressList
type IngressSpec ¶
type Metadata ¶
type Metadata struct { Namespace string `json:"namespace"` Name string `json:"name"` Created time.Time `json:"creationTimestamp"` Uid string `json:"uid"` Annotations map[string]string `json:"annotations"` }
func (*Metadata) ToResourceID ¶
func (meta *Metadata) ToResourceID() ResourceID
type ResourceID ¶
type RouteGroupItem ¶
type RouteGroupItem struct { Metadata *Metadata `json:"metadata"` Spec *RouteGroupSpec `json:"spec"` }
type RouteGroupList ¶
type RouteGroupList struct {
Items []*RouteGroupItem `json:"items"`
}
func ParseRouteGroupsJSON ¶
func ParseRouteGroupsJSON(d []byte) (RouteGroupList, error)
ParseRouteGroupsJSON parses a json list of RouteGroups into RouteGroupList
func ParseRouteGroupsYAML ¶
func ParseRouteGroupsYAML(d []byte) (RouteGroupList, error)
ParseRouteGroupsYAML parses a YAML list of RouteGroups into RouteGroupList
type RouteGroupSpec ¶
type RouteGroupSpec struct { // Hosts specifies the host headers, that will be matched for // all routes created by this route group. No hosts mean // catchall. Hosts []string `json:"hosts,omitempty"` // Backends specify the list of backends that can be // referenced from routes or DefaultBackends. Backends []*SkipperBackend `json:"backends"` // DefaultBackends should be in most cases only one default // backend which is applied to all routes, if no override was // added to a route. A special case is Traffic Switching which // will have more than one default backend definition. DefaultBackends []*BackendReference `json:"defaultBackends,omitempty"` // Routes specifies the list of route based on path, method // and predicates. It defaults to catchall, if there are no // routes. Routes []*RouteSpec `json:"routes,omitempty"` }
func (*RouteGroupSpec) UniqueHosts ¶
func (rg *RouteGroupSpec) UniqueHosts() []string
type RouteSpec ¶
type RouteSpec struct { // Path specifies Path predicate, only one of Path or PathSubtree is allowed Path string `json:"path,omitempty"` // PathSubtree specifies PathSubtree predicate, only one of Path or PathSubtree is allowed PathSubtree string `json:"pathSubtree,omitempty"` // PathRegexp can be added additionally PathRegexp string `json:"pathRegexp,omitempty"` // Backends specifies the list of backendReference that should // be applied to override the defaultBackends Backends []*BackendReference `json:"backends,omitempty"` // Filters specifies the list of filters applied to the RouteSpec Filters []string `json:"filters,omitempty"` // Predicates specifies the list of predicates applied to the RouteSpec Predicates []string `json:"predicates,omitempty"` // Methods defines valid HTTP methods for the specified RouteSpec Methods []string `json:"methods,omitempty"` }
func (*RouteSpec) UniqueMethods ¶
type SkipperBackend ¶
type SkipperBackend struct { // Name is the backendName that can be referenced as backendReference Name string // Type is the parsed backend type Type eskip.BackendType // Address is required for Type network. Address follows the // URL spec without path, query and fragment. For example // https://user:password@example.org Address string // ServiceName is required for Type service ServiceName string // ServicePort is required for Type service ServicePort int // Algorithm is required for Type lb Algorithm loadbalancer.Algorithm // Endpoints is required for Type lb Endpoints []string // contains filtered or unexported fields }
skipperBackend is the type safe version of skipperBackendParser
func (*SkipperBackend) UnmarshalJSON ¶
func (sb *SkipperBackend) UnmarshalJSON(value []byte) error
UnmarshalJSON creates a new skipperBackend, safe to be called on nil pointer