definitions

package
v0.20.14 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Overview

Package definitions provides type definitions, parsing, marshaling and validation for Kubernetes resources used by Skipper.

Index

Constants

View Source
const (
	IngressFilterAnnotation    = "zalando.org/skipper-filter"
	IngressPredicateAnnotation = "zalando.org/skipper-predicate"
	IngressRoutesAnnotation    = "zalando.org/skipper-routes"
)
View Source
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

type BackendPortV1 struct {
	Name   string `json:"name"`
	Number int    `json:"number"`
}

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

}

BackendV1 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#ingressbackend-v1-networking-k8s-io

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 PathRuleV1 struct {
	Path     string     `json:"path"`
	PathType string     `json:"pathType"`
	Backend  *BackendV1 `json:"backend"`
}

PathRuleV1 https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#httpingresspath-v1-networking-k8s-io

type ResourceID

type ResourceID struct {
	Namespace string
	Name      string
}

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

func (r *RouteSpec) UniqueMethods() []string

type RouteTLSSpec added in v0.18.98

type RouteTLSSpec struct {
	// Hosts specifies the list of hosts included in the
	// TLS certificate
	Hosts []string `json:"hosts,omitempty"`

	// SecretName specifies the Kubernetes TLS secret to be
	// used to terminate the TLS SNI connection
	SecretName string `json:"secretName,omitempty"`
}

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"`
}

Service https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.22/#ingressservicebackend-v1-networking-k8s-io

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

type TLSV1 added in v0.13.198

type TLSV1 struct {
	Hosts      []string `json:"hosts"`
	SecretName string   `json:"secretName"`
}

type WeightedBackend added in v0.16.103

type WeightedBackend interface {
	GetName() string
	GetWeight() float64
}

Jump to

Keyboard shortcuts

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