intercept

package
v2.20.0-test.12 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DescribeIntercepts added in v2.12.0

func DescribeIntercepts(ctx context.Context, iis []*manager.InterceptInfo, volumeMountsPrevented string, debug bool) string

func EnvSyntaxUsage added in v2.20.0

func EnvSyntaxUsage() string

func PrepareMount added in v2.12.0

func PrepareMount(cwd string, mountPoint string) (string, error)

func PreviewURL added in v2.11.0

func PreviewURL(pu string) string

func Result

func Result(r *connector.InterceptResult, err error) error

Types

type Command

type Command struct {
	Name           string // Command[0] || `${Command[0]}-${--namespace}` // which depends on a combinationof --workload and --namespace
	AgentName      string // --workload || Command[0] // only valid if !localOnly
	Port           string // --port // only valid if !localOnly
	ServiceName    string // --service // only valid if !localOnly
	Address        string // --address // only valid if !localOnly
	LocalOnly      bool   // --local-only
	LocalMountPort uint16 // --local-mount-port

	Replace bool // whether --replace was passed

	EnvFile   string // --env-file
	EnvSyntax EnvironmentSyntax
	EnvJSON   string   // --env-json
	Mount     string   // --mount // "true", "false", or desired mount point // only valid if !localOnly
	MountSet  bool     // whether --mount was passed
	ToPod     []string // --to-pod

	DockerRun          bool     // --docker-run
	DockerBuild        string   // --docker-build DIR | URL
	DockerBuildOptions []string // --docker-build-opt key=value, // Optional flag to docker build can be repeated (but not comma separated)
	DockerDebug        string   // --docker-debug DIR | URL
	DockerMount        string   // --docker-mount // where to mount in a docker container. Defaults to mount unless mount is "true" or "false".
	Cmdline            []string // Command[1:]

	Mechanism       string // --mechanism tcp
	MechanismArgs   []string
	ExtendedInfo    []byte
	WaitMessage     string // Message printed when a containerized intercept handler is started and waiting for an interrupt
	FormattedOutput bool
	DetailedOutput  bool
	Silent          bool
}

func (*Command) AddFlags added in v2.12.0

func (a *Command) AddFlags(cmd *cobra.Command)

func (*Command) GetMountPoint added in v2.12.0

func (a *Command) GetMountPoint() (bool, string)

GetMountPoint returns a boolean indicating if mounts are enabled or not, and path indicating a mount point.

func (*Command) Run added in v2.12.0

func (a *Command) Run(cmd *cobra.Command, positional []string) error

func (*Command) ValidArgs added in v2.12.0

func (a *Command) ValidArgs(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

func (*Command) Validate added in v2.12.0

func (a *Command) Validate(cmd *cobra.Command, positional []string) error

func (*Command) ValidateDockerArgs added in v2.12.0

func (a *Command) ValidateDockerArgs() error

type EnvironmentSyntax added in v2.20.0

type EnvironmentSyntax int

func (*EnvironmentSyntax) Set added in v2.20.0

func (e *EnvironmentSyntax) Set(n string) error

Set uses a pointer receiver intentionally, even though the internal type is int, because it must change the actual receiver value.

func (EnvironmentSyntax) String added in v2.20.0

func (e EnvironmentSyntax) String() string

func (EnvironmentSyntax) Type added in v2.20.0

func (e EnvironmentSyntax) Type() string

func (EnvironmentSyntax) WriteEnv added in v2.20.0

func (e EnvironmentSyntax) WriteEnv(k, v string) (r string, err error)

WriteEnv will write the environment variable in a form that will make the target shell parse it correctly and verbatim.

type Info added in v2.11.0

type Info struct {
	ID            string            `json:"id,omitempty"              yaml:"id,omitempty"`
	Name          string            `json:"name,omitempty"            yaml:"name,omitempty"`
	Disposition   string            `json:"disposition,omitempty"     yaml:"disposition,omitempty"`
	Message       string            `json:"message,omitempty"         yaml:"message,omitempty"`
	WorkloadKind  string            `json:"workload_kind,omitempty"   yaml:"workload_kind,omitempty"`
	TargetHost    string            `json:"target_host,omitempty"     yaml:"target_host,omitempty"`
	TargetPort    int32             `json:"target_port,omitempty"     yaml:"target_port,omitempty"`
	ServicePortID string            `json:"service_port_id,omitempty" yaml:"service_port_id,omitempty"`
	Environment   map[string]string `json:"environment,omitempty"     yaml:"environment,omitempty"`
	Mount         *Mount            `json:"mount,omitempty"           yaml:"mount,omitempty"`
	FilterDesc    string            `json:"filter_desc,omitempty"     yaml:"filter_desc,omitempty"`
	Metadata      map[string]string `json:"metadata,omitempty"     yaml:"metadata,omitempty"`
	HttpFilter    []string          `json:"http_filter,omitempty"     yaml:"http_filter,omitempty"`
	Global        bool              `json:"global,omitempty"          yaml:"global,omitempty"`
	PreviewURL    string            `json:"preview_url,omitempty"     yaml:"preview_url,omitempty"`
	Ingress       *Ingress          `json:"ingress,omitempty"         yaml:"ingress,omitempty"`
	// contains filtered or unexported fields
}

func NewInfo added in v2.11.0

func NewInfo(ctx context.Context, ii *manager.InterceptInfo, mountError string) *Info

func (*Info) WriteTo added in v2.12.0

func (ii *Info) WriteTo(w io.Writer) (int64, error)

type Ingress added in v2.11.0

type Ingress struct {
	Host   string `json:"host,omitempty"    yaml:"host,omitempty"`
	Port   int32  `json:"port,omitempty"    yaml:"port,omitempty"`
	UseTLS bool   `json:"use_tls,omitempty" yaml:"use_tls,omitempty"`
	L5Host string `json:"l5host,omitempty"  yaml:"l5host,omitempty"`
}

func NewIngress added in v2.11.0

func NewIngress(ps *manager.PreviewSpec) *Ingress

type Mount added in v2.11.0

type Mount struct {
	LocalDir  string   `json:"local_dir,omitempty"     yaml:"local_dir,omitempty"`
	RemoteDir string   `json:"remote_dir,omitempty"    yaml:"remote_dir,omitempty"`
	Error     string   `json:"error,omitempty"         yaml:"error,omitempty"`
	PodIP     string   `json:"pod_ip,omitempty"        yaml:"pod_ip,omitempty"`
	Port      int32    `json:"port,omitempty"          yaml:"port,omitempty"`
	Mounts    []string `json:"mounts,omitempty"        yaml:"mounts,omitempty"`
}

func NewMount added in v2.11.0

func NewMount(ctx context.Context, ii *manager.InterceptInfo, mountError string) *Mount

type State

type State interface {
	CreateRequest(context.Context) (*connector.CreateInterceptRequest, error)
	Name() string
	Run(context.Context) (*Info, error)
	RunAndLeave() bool
}

func NewState

func NewState(
	args *Command,
) State

Jump to

Keyboard shortcuts

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