istio

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// KContextProtocol const string
	KContextProtocol = "context.protocol"

	// KDestinationIP const string
	KDestinationIP = "destination.ip"

	// KDestinationPort const string
	KDestinationPort = "destination.port"

	// KOriginIP const string
	KOriginIP = "origin.ip"

	// KRequestTime const string
	KRequestTime = "request.time"
	// KRequestBodySize const string
	KRequestBodySize = "request.size"

	// const string
	KRequestTotalSize = "request.total_size"

	// KResponseCode const string
	KResponseCode = "response.code"
	// KResponseDuration const string
	KResponseDuration = "response.duration"
	// KResponseHeaders const string
	KResponseHeaders = "response.headers"
	// KResponseBodySize const string
	KResponseBodySize = "response.size"
	// KResponseTotalSize const string
	KResponseTotalSize = "response.total_size"
	// KResponseTime const string
	KResponseTime = "response.time"

	// KRequestHeaders const string
	KRequestHeaders = "request.headers"
	// KRequestPath const string
	KRequestPath = "request.path"
	// KRequestUrlPath const string
	KRequestUrlPath = "request.url_path"
	// KRequestQueryParams const string
	KRequestQueryParams = "request.query_params"
	// KRequestMethod const string
	KRequestMethod = "request.method"
	// KRequestHost const string
	KRequestHost = "request.host"

	// KDestinationServiceHost const string
	KDestinationServiceHost = "destination.service.host"
	// KDestinationServiceName const string
	KDestinationServiceName = "destination.service.name"
	// KDestinationServiceNamespace const string
	KDestinationServiceNamespace = "destination.service.namespace"
	// KContextReporterKind const string
	KContextReporterKind = "context.reporter.kind"

	// KIstioAttributeHeader is the istio attribute name
	KIstioAttributeHeader = "x-istio-attributes"
)

Define attribute names

Variables

View Source
var (
	// IstioPodInfoPath Sidecar mountPath
	IstioPodInfoPath = "/etc/istio/pod"
)
View Source
var IstioVersion = "unknow"

IstioVersion adapt istio version

Functions

func DisableReconnect

func DisableReconnect()

func EnableReconnect

func EnableReconnect()

func GetPodLabels

func GetPodLabels() map[string]string

GetPodLabels return podLabels map

func RegisterParseAdsConfig added in v0.27.0

func RegisterParseAdsConfig(f func(dynamic, static json.RawMessage) (XdsStreamConfig, error))

func SetMetadata

func SetMetadata(meta *_struct.Struct)

func SetServiceCluster

func SetServiceCluster(sc string)

func SetServiceNode

func SetServiceNode(sn string)

Types

type ADSClient

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

func NewAdsClient

func NewAdsClient(config *v2.MOSNConfig) (*ADSClient, error)

func (*ADSClient) GetStreamClient

func (adsClient *ADSClient) GetStreamClient() (c XdsStreamClient)

func (*ADSClient) ReconnectStreamClient added in v1.4.0

func (adsClient *ADSClient) ReconnectStreamClient()

close stream client and trigger reconnect right now

func (*ADSClient) Start

func (adsClient *ADSClient) Start()

func (*ADSClient) Stop

func (adsClient *ADSClient) Stop()

type Meta

type Meta struct {
	// IstioVersion specifies the Istio version associated with the proxy
	IstioVersion string `json:"ISTIO_VERSION,omitempty"`

	// Labels specifies the set of workload instance (ex: k8s pod) labels associated with this node.
	Labels map[string]string `json:"LABELS,omitempty"`

	// InterceptionMode is the name of the metadata variable that carries info about
	// traffic interception mode at the proxy
	InterceptionMode TrafficInterceptionMode `json:"INTERCEPTION_MODE,omitempty"`

	// ClusterID defines the cluster the node belongs to.
	ClusterID string `json:"CLUSTER_ID,omitempty"`
}

type TrafficInterceptionMode

type TrafficInterceptionMode string
const (
	// InterceptionNone indicates that the workload is not using IPtables for traffic interception
	InterceptionNone TrafficInterceptionMode = "NONE"

	// InterceptionTproxy implies traffic intercepted by IPtables with TPROXY mode
	InterceptionTproxy TrafficInterceptionMode = "TPROXY"

	// InterceptionRedirect implies traffic intercepted by IPtables with REDIRECT mode
	// This is our default mode
	InterceptionRedirect TrafficInterceptionMode = "REDIRECT"
)

type XdsInfo

type XdsInfo struct {
	ServiceCluster string
	ServiceNode    string
	Metadata       *_struct.Struct
}

func GetGlobalXdsInfo

func GetGlobalXdsInfo() XdsInfo

GetGlobalXdsInfo returns a struct, cannot be modified. Update XdsInfo by APIs.

type XdsStreamClient

type XdsStreamClient interface {
	Send(req interface{}) error
	Recv() (interface{}, error)
	HandleResponse(resp interface{})
	Stop()
}

type XdsStreamConfig

type XdsStreamConfig interface {
	CreateXdsStreamClient() (XdsStreamClient, error)
	RefreshDelay() time.Duration
	// InitAdsRequest returns the first request for the ads
	InitAdsRequest() interface{}
}

func ParseAdsConfig

func ParseAdsConfig(dynamic, static json.RawMessage) (XdsStreamConfig, error)

Jump to

Keyboard shortcuts

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