controlplane

package
v2.3.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRoute

func DefaultRoute() *route.Route

func DefaultRouteToCluster added in v2.3.10

func DefaultRouteToCluster(clusterName string) *route.Route

func Main

func Main(ctx context.Context, filename string, port uint, logger *log.Logger) error

func OriginCluster

func OriginCluster() *cluster.Cluster

func RunServer

func RunServer(ctx context.Context, server serverv3.Server, port uint) error

func ToCluster

func ToCluster(clusterName string) *cluster.Cluster

func ToEndPoint

func ToEndPoint(clusterName string, localTunIP string, port int32) *endpoint.ClusterLoadAssignment

func ToListener

func ToListener(listenerName string, routeName string, port int32, p corev1.Protocol, isFargateMode bool) *listener.Listener

func ToRoute

func ToRoute(clusterName string, headers map[string]string) *route.Route

func Watch

func Watch(watcher *fsnotify.Watcher, filename string, notifyCh chan<- NotifyMessage) error

Types

type ContainerPort added in v2.3.10

type ContainerPort struct {
	// If specified, this must be an IANA_SVC_NAME and unique within the pod. Each
	// named port in a pod must have a unique name. Name for the port that can be
	// referred to by services.
	// +optional
	Name string `json:"name,omitempty"`
	// Number of port to expose on the host.
	// If specified, this must be a valid port number, 0 < x < 65536.
	// envoy listener port, if is not 0, means fargate mode
	// +optional
	EnvoyListenerPort int32 `json:"envoyListenerPort,omitempty"`
	// Number of port to expose on the pod's IP address.
	// This must be a valid port number, 0 < x < 65536.
	ContainerPort int32 `json:"containerPort"`
	// Protocol for port. Must be UDP, TCP, or SCTP.
	// Defaults to "TCP".
	// +optional
	// +default="TCP"
	Protocol corev1.Protocol `json:"protocol,omitempty"`
}

func ConvertContainerPort added in v2.3.10

func ConvertContainerPort(ports ...corev1.ContainerPort) []ContainerPort

type NotifyMessage

type NotifyMessage struct {
	Operation OperationType
	FilePath  string
}

type OperationType

type OperationType int
const (
	Create OperationType = iota
	Remove
	Modify
)

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

func NewProcessor

func NewProcessor(cache cache.SnapshotCache, log *log.Logger) *Processor

func (*Processor) ProcessFile

func (p *Processor) ProcessFile(file NotifyMessage) error

type Rule

type Rule struct {
	Headers      map[string]string
	LocalTunIPv4 string
	LocalTunIPv6 string
	// for no privileged mode (AWS Fargate mode), don't have cap NET_ADMIN and privileged: true. so we can not use OSI layer 3 proxy
	// containerPort -> envoyRulePort:localPort
	// envoyRulePort for envoy forward to localhost:envoyRulePort
	// localPort for local pc listen localhost:localPort
	// use ssh reverse tunnel, envoy rule endpoint localhost:envoyRulePort will forward to local pc localhost:localPort
	// localPort is required and envoyRulePort is optional
	PortMap map[int32]string
}

type Virtual

type Virtual struct {
	Uid   string // group.resource.name
	Ports []ContainerPort
	Rules []*Rule
}

func ParseYaml

func ParseYaml(file string) ([]*Virtual, error)

func (*Virtual) To

func (a *Virtual) To(enableIPv6 bool) (
	listeners []types.Resource,
	clusters []types.Resource,
	routes []types.Resource,
	endpoints []types.Resource,
)

Jump to

Keyboard shortcuts

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