serviceconnect

package
v0.0.0-...-b702281 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

View Source
const (
	BridgeNetworkMode = "bridge"
	AWSVPCNetworkMode = "awsvpc"
)
View Source
const AppNetUID = 20000 // arbitrarily selected

Variables

This section is empty.

Functions

func GetServiceConnectConfigKey

func GetServiceConnectConfigKey() string

func GetServiceConnectContainerNameKey

func GetServiceConnectContainerNameKey() string

func ValidateServiceConnectConfig

func ValidateServiceConnectConfig(scConfig *Config,
	taskContainers []*ecsacs.Container,
	taskNetworkMode string,
	ipv6Enabled bool) error

ValidateServiceConnectConfig validates service connect container name, fields in egress config, dns config and ingress config when 1) fields consumed and proceeded by ECS Agent 2) fields with a global standard, e.g. CIDR format

Types

type Config

type Config struct {
	ContainerName string               `json:"containerName"`
	IngressConfig []IngressConfigEntry `json:"ingressConfig,omitempty"`
	EgressConfig  *EgressConfig        `json:"egressConfig,omitempty"`
	DNSConfig     []DNSConfigEntry     `json:"dnsConfig,omitempty"`

	// Admin configuration for operating with AppNet Agent
	RuntimeConfig RuntimeConfig `json:"runtimeConfig"`
	// NetworkConfig contains additional network information for setting up task network namespace
	NetworkConfig NetworkConfig `json:"networkConfig"`
}

Config represents the Service Connect configuration for a task.

func ParseServiceConnectAttachment

func ParseServiceConnectAttachment(scAttachment *ecsacs.Attachment) (*Config, error)

ParseServiceConnectAttachment parses the service connect container name and service connect config value from the given attachment.

type DNSConfigEntry

type DNSConfigEntry struct {
	HostName string `json:"hostName"`
	Address  string `json:"address"`
}

DNSConfigEntry represents a mapping between a VIP in the SC VIP-CIDR and an upstream SC service. e.g. DummySCService.my.corp -> 169.254.1.1

type EgressConfig

type EgressConfig struct {
	// ListenerName is the name of the listener for SC service with name ServiceName.
	ListenerName string `json:"listenerName"`
	// EgressPort represent the port number Envoy will bind to. This port is selected at random by ECS Agent during
	// task startup. Port will be in the ephemeral range.
	ListenerPort uint16 `json:"listenerPort,omitempty"`
	// VIP is the representation of an SC VIP-CIDR
	VIP VIP `json:"vip"`
}

EgressConfig is the egress configuration for a given SC service.

type IngressConfigEntry

type IngressConfigEntry struct {
	// ListenerName is the name of the listener for an SC service.
	ListenerName string `json:"listenerName"`
	// ListenerPort is the port where Envoy listens for ingress traffic for a given SC service.
	ListenerPort uint16 `json:"listenerPort"`
	// InterceptPort is only relevant for awsvpc mode. If present, SC CNI Plugin will configure netfilter rules to redirect
	// traffic destined to this port to ListenerPort.
	InterceptPort *uint16 `json:"interceptPort,omitempty"`
	// HostPort is only relevant for bridge network mode non-default case, where SC ingress host port is predefined in
	// SC Service creation/modification time.
	HostPort *uint16 `json:"hostPort,omitempty"`
}

IngressConfigEntry is the ingress configuration for a given SC service.

type NetworkConfig

type NetworkConfig struct {
	SCPauseIPv4Addr string `json:"scPauseIPv4Addr,omitempty"`
	SCPauseIPv6Addr string `json:"scPauseIPv6Addr,omitempty"`
}

NetworkConfig contains additional network information for setting up task network namespace. This includes SC pause container IP address - used for bridge-mode CNI configuration

type RuntimeConfig

type RuntimeConfig struct {
	// Host path for the administration socket
	AdminSocketPath string `json:"adminSocketPath"`
	// HTTP Path + Params to get statistical information
	StatsRequest string `json:"statsRequest"`
	// HTTP Path + Params to drain ServiceConnect connections
	DrainRequest string `json:"drainRequest"`
}

RuntimeConfig contains the runtime information for administering AppNet Agent

type VIP

type VIP struct {
	IPV4CIDR string `json:"ipv4Cidr,omitempty"`
	IPV6CIDR string `json:"ipv6Cidr,omitempty"`
}

VIP is the representation of an SC VIP-CIDR e.g. 169.254.0.0/16

Jump to

Keyboard shortcuts

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