agentconfig

package
v2.6.4 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConfigMap is the name of the ConfigMap that contains the agent configs
	ConfigMap = "telepresence-agents"

	ContainerName        = "traffic-agent"
	InitContainerName    = "tel-agent-init"
	AnnotationVolumeName = "traffic-annotations"
	AnnotationMountPoint = "/tel_pod_info"
	ConfigVolumeName     = "traffic-config"
	ConfigMountPoint     = "/etc/traffic-agent"
	ConfigFile           = "config.yaml"
	MountPrefixApp       = "/tel_app_mounts"
	ExportsVolumeName    = "export-volume"
	ExportsMountPoint    = "/tel_app_exports"
	EnvPrefix            = "_TEL_"
	EnvPrefixAgent       = EnvPrefix + "AGENT_"
	EnvPrefixApp         = EnvPrefix + "APP_"

	// EnvInterceptContainer intercepted container propagated to client during intercept
	EnvInterceptContainer = "TELEPRESENCE_CONTAINER"

	// EnvInterceptMounts mount points propagated to client during intercept
	EnvInterceptMounts = "TELEPRESENCE_MOUNTS"

	DomainPrefix     = "telepresence.getambassador.io/"
	InjectAnnotation = DomainPrefix + "inject-" + ContainerName
)

Variables

This section is empty.

Functions

func AgentContainer

func AgentContainer(
	pod *core.Pod,
	config *Sidecar,
) *core.Container

AgentContainer will return a configured traffic-agent

func AgentVolumes

func AgentVolumes(agentName string) []core.Volume

func EachContainer

func EachContainer(pod *core.Pod, config *Sidecar, f func(*core.Container, *Container))

EachContainer will find each container in the given config and match it against a container in the pod using its name. The given function is called once for each match.

func InitContainer

func InitContainer(qualifiedAgentImage string) *core.Container

func IsInterceptFor

func IsInterceptFor(spi string, ic *Intercept) bool

IsInterceptFor returns true when the given ServicePortIdentifier is equal to the config's ServicePortName, or can be parsed to an integer equal to the config's ServicePort

func SpecMatchesIntercept

func SpecMatchesIntercept(spec *manager.InterceptSpec, ic *Intercept) bool

SpecMatchesIntercept answers the question if an InterceptSpec matches the given Intercept config. The spec matches if:

  • its ServiceName is equal to the config's ServiceName
  • its ServicePortIdentifier is equal to the config's ServicePortName, or can be parsed to an integer equal to the config's ServicePort

Types

type Container

type Container struct {
	// Name of the intercepted container
	Name string `json:"name,omitempty" yaml:"name,omitempty"`

	// The intercepts managed by the agent
	Intercepts []*Intercept `json:"intercepts,omitempty" yaml:"intercepts,omitempty"`

	// Prefix used for all keys in the container environment copy
	EnvPrefix string `json:"envPrefix,omitempty" yaml:"envPrefix,omitempty"`

	// Where the agent mounts the agents volumes
	MountPoint string `json:"mountPoint,omitempty" yaml:"mountPoint,omitempty"`

	// Mounts are the actual mount points that are mounted by this container
	Mounts []string
}

Container describes one container that can have one or several intercepts

type Intercept

type Intercept struct {
	// The name of the intercepted container port
	ContainerPortName string `json:"containerPortName,omitempty" yaml:"containerPortName,omitempty"`

	// Name of intercepted service
	ServiceName string `json:"serviceName,omitempty" yaml:"serviceName,omitempty"`

	// UID of intercepted service
	ServiceUID types.UID `json:"serviceUID,omitempty" yaml:"serviceUID,omitempty"`

	// Name of intercepted service port
	ServicePortName string `json:"servicePortName,omitempty" yaml:"servicePortName,omitempty"`

	// TargetPortNumeric is set to true unless the servicePort has a symbolic target port
	TargetPortNumeric bool `json:"targetPortNumeric,omitempty" yaml:"targetPortNumeric,omitempty"`

	// L4 protocol used by the intercepted port
	Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty"`

	// L7 protocol used by the intercepted port
	AppProtocol string `json:"appProtocol,omitempty" yaml:"appProtocol,omitempty"`

	// True if the service is headless
	Headless bool `json:"headless,omitempty" yaml:"headless,omitempty"`

	// The number of the intercepted container port
	ContainerPort uint16 `json:"containerPort,omitempty" yaml:"containerPort,omitempty"`

	// Number of intercepted service port
	ServicePort uint16 `json:"servicePort,omitempty" yaml:"servicePort,omitempty"`

	// The port number that the agent listens to
	AgentPort uint16 `json:"agentPort,omitempty" yaml:"agentPort,omitempty"`
}

Intercept describes the mapping between a service port and an intercepted container port

func PortUniqueIntercepts added in v2.6.3

func PortUniqueIntercepts(cn *Container) []*Intercept

PortUniqueIntercepts returns a slice of intercepts for the container where each intercept is unique with respect to the AgentPort. This method should always be used when iterating the intercepts, except for when an intercept is identified via a service.

type Sidecar

type Sidecar struct {
	// If Create is true, then this Config has not yet been filled in.
	Create bool `json:"create,omitempty" yaml:"create,omitempty"`

	// If Manual is true, then this Config is created manually
	Manual bool `json:"manual,omitempty" yaml:"manual,omitempty"`

	// The fully qualified name of the traffic-agent image, i.e. "docker.io/tel2:2.5.4"
	AgentImage string `json:"agentImage,omitempty" yaml:"agentImage,omitempty"`

	// The name of the traffic-agent instance. Typically, the same as the name of the workload owner
	AgentName string `json:"agentName,omitempty" yaml:"agentName,omitempty"`

	// The namespace of the intercepted pod
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`

	// LogLevel used for all traffic-agent logging
	LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"`

	// The name of the workload that the pod originates from
	WorkloadName string `json:"workloadName,omitempty" yaml:"workloadName,omitempty"`

	// The kind of workload that the pod originates from
	WorkloadKind string `json:"workloadKind,omitempty" yaml:"workloadKind,omitempty"`

	// The host used when connecting to the traffic-manager
	ManagerHost string `json:"managerHost,omitempty" yaml:"managerHost,omitempty"`

	// The port used when connecting to the traffic manager
	ManagerPort int32 `json:"managerPort,omitempty" yaml:"managerPort,omitempty"`

	// The port used by the agents restFUL API server
	APIPort uint16 `json:"apiPort,omitempty" yaml:"apiPort,omitempty"`

	// The intercepts managed by the agent
	Containers []*Container `json:"containers,omitempty" yaml:"containers,omitempty"`
}

The Sidecar configures the traffic-agent sidecar

Jump to

Keyboard shortcuts

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