dataplane

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package dataplane translates Graph representation of the cluster state into an intermediate representation of data plane configuration. We can think of it as an intermediate state between the cluster resources and NGINX configuration files.

The package includes: - The types to hold the intermediate representation. - The functions to translate the Graph into the representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend added in v0.4.0

type Backend struct {
	// UpstreamName is the name of the upstream for this backend.
	UpstreamName string
	// Weight is the weight of the BackendRef.
	// The possible values of weight are 0-1,000,000.
	// If weight is 0, no traffic should be forwarded for this entry.
	Weight int32
	// Valid indicates whether the Backend is valid.
	Valid bool
}

Backend represents a Backend for a routing rule.

type BackendGroup added in v0.4.0

type BackendGroup struct {
	// Source is the NamespacedName of the HTTPRoute the group belongs to.
	Source types.NamespacedName
	// Backends is a list of Backends in the Group.
	Backends []Backend
	// RuleIdx is the index of the corresponding rule in the HTTPRoute.
	RuleIdx int
}

BackendGroup represents a group of Backends for a routing rule in an HTTPRoute.

func (*BackendGroup) Name added in v0.4.0

func (bg *BackendGroup) Name() string

Name returns the name of the backend group. This name must be unique across all HTTPRoutes and all rules within the same HTTPRoute. The RuleIdx is used to make the name unique across all rules within the same HTTPRoute. The RuleIdx may change for a given rule if an update is made to the HTTPRoute, but it will always match the index of the rule in the stored HTTPRoute.

type Configuration

type Configuration struct {
	// HTTPServers holds all HTTPServers.
	HTTPServers []VirtualServer
	// SSLServers holds all SSLServers.
	SSLServers []VirtualServer
	// Upstreams holds all unique Upstreams.
	Upstreams []Upstream
	// BackendGroups holds all unique BackendGroups.
	BackendGroups []BackendGroup
}

Configuration is an intermediate representation of dataplane configuration.

func BuildConfiguration

func BuildConfiguration(ctx context.Context, g *graph.Graph, resolver resolver.ServiceResolver) Configuration

BuildConfiguration builds the Configuration from the Graph.

type Filters

type Filters struct {
	InvalidFilter          *InvalidFilter
	RequestRedirect        *v1beta1.HTTPRequestRedirectFilter
	RequestHeaderModifiers *HTTPHeaderFilter
}

Filters hold the filters for a MatchRule.

type HTTPHeader added in v0.4.0

type HTTPHeader struct {
	Name  string
	Value string
}

type HTTPHeaderFilter added in v0.4.0

type HTTPHeaderFilter struct {
	Set    []HTTPHeader
	Add    []HTTPHeader
	Remove []string
}

type InvalidFilter

type InvalidFilter struct{}

InvalidFilter is a special filter for handling the case when configured filters are invalid.

type MatchRule

type MatchRule struct {
	// Filters holds the filters for the MatchRule.
	Filters Filters
	// Source is the corresponding HTTPRoute resource.
	Source *v1beta1.HTTPRoute
	// BackendGroup is the group of Backends that the rule routes to.
	BackendGroup BackendGroup
	// MatchIdx is the index of the rule in the Rule.Matches.
	MatchIdx int
	// RuleIdx is the index of the corresponding rule in the HTTPRoute.
	RuleIdx int
}

MatchRule represents a routing rule. It corresponds directly to a Match in the HTTPRoute resource. An HTTPRoute is guaranteed to have at least one rule with one match. If no rule or match is specified by the user, the default rule {{path:{ type: "PathPrefix", value: "/"}}} is set by the schema.

func (*MatchRule) GetMatch

func (r *MatchRule) GetMatch() v1beta1.HTTPRouteMatch

GetMatch returns the HTTPRouteMatch of the Route .

type PathRule

type PathRule struct {
	// Path is a path. For example, '/hello'.
	Path string
	// PathType is simplified path type. For example, prefix or exact.
	PathType PathType
	// MatchRules holds routing rules.
	MatchRules []MatchRule
}

PathRule represents routing rules that share a common path.

type PathType added in v0.4.0

type PathType string
const (
	PathTypePrefix PathType = "prefix"
	PathTypeExact  PathType = "exact"
)

type SSL

type SSL struct {
	// CertificatePath is the path to the certificate file.
	CertificatePath string
}

type Upstream

type Upstream struct {
	// Name is the name of the Upstream. Will be unique for each service/port combination.
	Name string
	// ErrorMsg contains the error message if the Upstream is invalid.
	ErrorMsg string
	// Endpoints are the endpoints of the Upstream.
	Endpoints []resolver.Endpoint
}

type VirtualServer

type VirtualServer struct {
	// SSL holds the SSL configuration options for the server.
	SSL *SSL
	// Hostname is the hostname of the server.
	Hostname string
	// PathRules is a collection of routing rules.
	PathRules []PathRule
	// IsDefault indicates whether the server is the default server.
	IsDefault bool
	// Port is the port of the server.
	Port int32
}

VirtualServer is a virtual server.

Jump to

Keyboard shortcuts

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