Documentation ¶
Overview ¶
Package definitions provides type definitions, parsing, marshaling and validation for Kubernetes resources used by Skipper.
Index ¶
- Constants
- func GetHostsFromIngressRulesV1(ing *IngressV1Item) []string
- func ValidateRouteGroup(rg *RouteGroupItem) error
- func ValidateRouteGroups(rgl *RouteGroupList) error
- type BackendPort
- type BackendPortV1
- type BackendReference
- type BackendReferences
- type BackendV1
- type HTTPRuleV1
- type IngressV1Item
- type IngressV1List
- type IngressV1Spec
- type IngressV1Validator
- type Metadata
- type PathRuleV1
- type ResourceID
- type RouteGroupItem
- type RouteGroupList
- type RouteGroupSpec
- type RouteGroupValidator
- type RouteSpec
- type RouteTLSSpec
- type RuleV1
- type Service
- type SkipperBackend
- type TLSV1
- type WeightedBackend
Constants ¶
const ( IngressFilterAnnotation = "zalando.org/skipper-filter" IngressPredicateAnnotation = "zalando.org/skipper-predicate" IngressRoutesAnnotation = "zalando.org/skipper-routes" )
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 GetHostsFromIngressRulesV1 ¶ added in v0.13.198
func GetHostsFromIngressRulesV1(ing *IngressV1Item) []string
func ValidateRouteGroup ¶
func ValidateRouteGroup(rg *RouteGroupItem) error
ValidateRouteGroup validates a RouteGroupItem
func ValidateRouteGroups ¶
func ValidateRouteGroups(rgl *RouteGroupList) error
Types ¶
type BackendPort ¶
type BackendPort struct {
Value interface{}
}
BackendPort is used for TargetPort similar to Kubernetes intOrString type
func (BackendPort) MarshalJSON ¶
func (p BackendPort) MarshalJSON() ([]byte, error)
func (BackendPort) Number ¶
func (p BackendPort) Number() (int, bool)
Number converts BackendPort to int
func (BackendPort) String ¶
func (p BackendPort) String() string
String converts BackendPort to string
func (*BackendPort) UnmarshalJSON ¶
func (p *BackendPort) UnmarshalJSON(value []byte) error
type BackendPortV1 ¶ added in v0.13.149
func (BackendPortV1) String ¶ added in v0.13.149
func (p BackendPortV1) String() string
type BackendReference ¶
type BackendReference struct { // BackendName references the skipperBackend by name BackendName string `json:"backendName"` // Weight defines the traffic weight, if there are 2 or more // default backends Weight int `json:"weight"` }
func (*BackendReference) GetName ¶ added in v0.16.103
func (br *BackendReference) GetName() string
func (*BackendReference) GetWeight ¶ added in v0.16.103
func (br *BackendReference) GetWeight() float64
type BackendReferences ¶ added in v0.16.66
type BackendReferences []*BackendReference
type BackendV1 ¶ added in v0.13.149
type BackendV1 struct {
Service Service `json:"service,omitempty"` // can be nil, because of TypedLocalObjectReference
}
type HTTPRuleV1 ¶ added in v0.13.149
type HTTPRuleV1 struct {
Paths []*PathRuleV1 `json:"paths"`
}
type IngressV1Item ¶ added in v0.13.149
type IngressV1Item struct { Metadata *Metadata `json:"metadata"` Spec *IngressV1Spec `json:"spec"` }
type IngressV1List ¶ added in v0.13.149
type IngressV1List struct {
Items []*IngressV1Item `json:"items"`
}
func ParseIngressV1JSON ¶ added in v0.13.149
func ParseIngressV1JSON(d []byte) (IngressV1List, error)
ParseIngressV1JSON parse JSON into an IngressV1List
type IngressV1Spec ¶ added in v0.13.149
type IngressV1Spec struct { DefaultBackend *BackendV1 `json:"defaultBackend,omitempty"` IngressClassName string `json:"ingressClassName,omitempty"` Rules []*RuleV1 `json:"rules"` IngressTLS []*TLSV1 `json:"tls,omitempty"` }
IngressSpecV1 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#ingressspec-v1-networking-k8s-io
type IngressV1Validator ¶ added in v0.17.1
type IngressV1Validator struct{}
func (*IngressV1Validator) Validate ¶ added in v0.17.1
func (igv *IngressV1Validator) Validate(item *IngressV1Item) error
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"` Labels map[string]string `json:"labels"` }
func (*Metadata) ToResourceID ¶
func (meta *Metadata) ToResourceID() ResourceID
type PathRuleV1 ¶ added in v0.13.149
type ResourceID ¶
ResourceID is a stripped down version of Metadata used to identify resources in a cache map
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
type RouteGroupSpec ¶
type RouteGroupSpec struct { // Hosts specifies the host headers, that will be matched for // all routes created by this route group. 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 BackendReferences `json:"defaultBackends,omitempty"` // Routes specifies the list of route based on path, method // and predicates. Routes []*RouteSpec `json:"routes,omitempty"` // TLS specifies the list of Kubernetes TLS secrets to // be used to terminate the TLS connection TLS []*RouteTLSSpec `json:"tls,omitempty"` }
func (*RouteGroupSpec) UniqueHosts ¶
func (rg *RouteGroupSpec) UniqueHosts() []string
type RouteGroupValidator ¶ added in v0.16.167
type RouteGroupValidator struct{}
func (*RouteGroupValidator) Validate ¶ added in v0.16.167
func (rgv *RouteGroupValidator) Validate(item *RouteGroupItem) error
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 BackendReferences `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 RouteTLSSpec ¶ added in v0.18.98
type RuleV1 ¶ added in v0.13.149
type RuleV1 struct { Host string `json:"host"` Http *HTTPRuleV1 `json:"http"` }
type Service ¶ added in v0.13.149
type Service struct { Name string `json:"name"` Port BackendPortV1 `json:"port"` }
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