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 ValidateIngressV1(_ *IngressV1Item) error
- func ValidateIngressesV1(ingressList IngressV1List) error
- func ValidateRouteGroup(rg *RouteGroupItem) error
- func ValidateRouteGroups(rl *RouteGroupList) error
- type BackendPort
- type BackendPortV1
- type BackendReference
- type BackendV1
- type HTTPRuleV1
- type IngressV1Item
- type IngressV1List
- type IngressV1Spec
- type Metadata
- type PathRuleV1
- type ResourceID
- type RouteGroupItem
- type RouteGroupList
- type RouteGroupSpec
- type RouteSpec
- type RuleV1
- type Service
- type SkipperBackend
- type TLSV1
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 GetHostsFromIngressRulesV1 ¶ added in v0.13.198
func GetHostsFromIngressRulesV1(ing *IngressV1Item) []string
func ValidateIngressV1 ¶ added in v0.13.149
func ValidateIngressV1(_ *IngressV1Item) error
TODO: implement once IngressItem has a validate method ValidateIngressV1 is a no-op
func ValidateIngressesV1 ¶ added in v0.13.149
func ValidateIngressesV1(ingressList IngressV1List) 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 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 BackendV1 ¶ added in v0.13.149
type BackendV1 struct { Service Service `json:"service,omitempty"` // can be nil, because of TypedLocalObjectReference // 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 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
func ParseIngressV1YAML ¶ added in v0.13.149
func ParseIngressV1YAML(d []byte) (IngressV1List, error)
ParseIngressV1YAML parse YAML 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 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
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 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