translation

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationInfo = "htnn.mosn.io/info"

	DefaultEnvoyFilterPriority = -10
)

Variables

This section is empty.

Functions

func AllowRoute

func AllowRoute(cond *gwapiv1.AllowedRoutes, route *gwapiv1b1.HTTPRoute, gwNsName *types.NamespacedName) bool

Types

type Ctx

type Ctx struct {
	context.Context
}

type FilterPolicyWrapper added in v0.3.0

type FilterPolicyWrapper struct {
	*mosniov1.FilterPolicy
	// contains filtered or unexported fields
}

type FinalState

type FinalState struct {
	EnvoyFilters map[component.EnvoyFilterKey]*istiov1a3.EnvoyFilter
}

finalState is the end of the translation. We convert the state to EnvoyFilter and write it to k8s.

type GatewayPolicies added in v0.3.0

type GatewayPolicies struct {
	Port     *ServerPort
	Policies []*FilterPolicyWrapper
}

type HTTPRoutePolicies

type HTTPRoutePolicies struct {
	HTTPRoute     *gwapiv1b1.HTTPRoute
	RoutePolicies map[string][]*FilterPolicyWrapper
	Gateways      []*gwapiv1b1.Gateway
}

type Info

type Info struct {
	// FilterPolicies indicates what FilterPolicies are used to generated the EnvoyFilter.
	FilterPolicies []string `json:"filterpolicies"`
}

func (*Info) Merge

func (info *Info) Merge(other *Info)

func (*Info) String

func (info *Info) String() string

type InitState

type InitState struct {
	VirtualServicePolicies map[types.NamespacedName]*VirtualServicePolicies
	HTTPRoutePolicies      map[types.NamespacedName]*HTTPRoutePolicies

	GatewayPolicies            map[model.GatewaySection]*GatewayPolicies
	GatewayWithoutPolicies     map[model.GatewaySection]*ServerPort
	ServerPortToGatewaySection map[ServerPortKey]*model.GatewaySection
}

InitState is the beginning of our translation.

func NewInitState

func NewInitState() *InitState

func (*InitState) AddIstioGateway added in v0.3.0

func (s *InitState) AddIstioGateway(gw *istiov1a3.Gateway)

func (*InitState) AddK8sGateway added in v0.3.0

func (s *InitState) AddK8sGateway(gw *gwapiv1b1.Gateway)

func (*InitState) AddPolicyForHTTPRoute

func (s *InitState) AddPolicyForHTTPRoute(policy *mosniov1.FilterPolicy, route *gwapiv1b1.HTTPRoute, gws []*gwapiv1b1.Gateway)

func (*InitState) AddPolicyForIstioGateway added in v0.3.0

func (s *InitState) AddPolicyForIstioGateway(policy *mosniov1.FilterPolicy, gw *istiov1a3.Gateway)

func (*InitState) AddPolicyForK8sGateway added in v0.3.0

func (s *InitState) AddPolicyForK8sGateway(policy *mosniov1.FilterPolicy, gw *gwapiv1b1.Gateway)

func (*InitState) AddPolicyForVirtualService

func (s *InitState) AddPolicyForVirtualService(policy *mosniov1.FilterPolicy, vs *istiov1a3.VirtualService, gws []*istiov1a3.Gateway)

func (*InitState) GetGatewaysWithHTTPRoute

func (s *InitState) GetGatewaysWithHTTPRoute(route *gwapiv1b1.HTTPRoute) []*gwapiv1b1.Gateway

func (*InitState) GetGatewaysWithVirtualService

func (s *InitState) GetGatewaysWithVirtualService(vs *istiov1a3.VirtualService) []*istiov1a3.Gateway

func (*InitState) Process

func (s *InitState) Process(originalCtx context.Context) (*FinalState, error)

type PolicyKind added in v0.3.0

type PolicyKind int
const (
	PolicyKindRDS PolicyKind = iota
	PolicyKindLDS
)

type PolicyScope

type PolicyScope int
const (
	// sort from small to large
	PolicyScopeRule    PolicyScope = iota // a route in a VirtualService or a rule in xRoute
	PolicyScopeRoute                      // a VirtualService or a xRoute
	PolicyScopePort                       // a port in a Gateway
	PolicyScopeGateway                    // a Istio/k8s Gateway
)

type Proxy added in v0.3.0

type Proxy struct {
	Namespace string
}

type ServerPort added in v0.3.0

type ServerPort struct {
	Bind     string
	Number   uint32
	Protocol string
}

type ServerPortKey added in v0.3.0

type ServerPortKey struct {
	Namespace string
	ServerPort
}

type VirtualServicePolicies

type VirtualServicePolicies struct {
	VirtualService *istiov1a3.VirtualService
	RoutePolicies  map[string][]*FilterPolicyWrapper
	Gateways       []*istiov1a3.Gateway
}

Jump to

Keyboard shortcuts

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