xds

package
v0.35.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KumaMadsV1ResourceTypeURL = "type.googleapis.com/kuma.observability.v1.MonitoringAssignment"
	KumaMadsV1ResourceType    = "monitoringassignments"
)
View Source
const (
	ProtocolV3 = ProtocolVersion("v3")
)

Variables

View Source
var (
	// DefaultKumaSDConfig is the default Kuma MADS SD configuration.
	DefaultKumaSDConfig = KumaSDConfig{
		HTTPClientConfig: config.DefaultHTTPClientConfig,
		RefreshInterval:  model.Duration(15 * time.Second),
		FetchTimeout:     model.Duration(2 * time.Minute),
	}
)
View Source
var File_observability_v1_mads_proto protoreflect.FileDescriptor

Functions

func NewKumaHTTPDiscovery

func NewKumaHTTPDiscovery(conf *KumaSDConfig, logger log.Logger) (discovery.Discoverer, error)

Types

type HTTPConfig

type HTTPConfig struct {
	config.HTTPClientConfig `yaml:",inline"`
}

type HTTPResourceClient

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

func NewHTTPResourceClient

func NewHTTPResourceClient(conf *HTTPResourceClientConfig, protocolVersion ProtocolVersion) (*HTTPResourceClient, error)

func (*HTTPResourceClient) Close

func (rc *HTTPResourceClient) Close()

func (*HTTPResourceClient) Fetch

Fetch requests the latest state of the resources from the xDS server and cache the version. Returns a nil response if the current local version is up to date.

func (*HTTPResourceClient) ID

func (rc *HTTPResourceClient) ID() string

func (*HTTPResourceClient) ResourceTypeURL

func (rc *HTTPResourceClient) ResourceTypeURL() string

func (*HTTPResourceClient) Server

func (rc *HTTPResourceClient) Server() string

type HTTPResourceClientConfig

type HTTPResourceClientConfig struct {
	// HTTP config.
	config.HTTPClientConfig

	Name string

	// ExtraQueryParams are extra query parameters to attach to the request URL.
	ExtraQueryParams url.Values

	// The timeout for a single fetch request.
	Timeout time.Duration

	// Type is the xds type, e.g., clusters
	// which is used in the discovery POST request.
	ResourceType string
	// ResourceTypeURL is the Google type url for the resource, e.g., type.googleapis.com/envoy.api.v2.Cluster.
	ResourceTypeURL string
	// Server is the xDS management server.
	Server string
	// ClientID is used to identify the client with the management server.
	ClientID string
}

type KumaSDConfig

type KumaSDConfig = SDConfig

func (*KumaSDConfig) Name

func (c *KumaSDConfig) Name() string

func (*KumaSDConfig) NewDiscoverer

func (*KumaSDConfig) SetDirectory

func (c *KumaSDConfig) SetDirectory(dir string)

SetDirectory joins any relative file paths with dir.

func (*KumaSDConfig) UnmarshalYAML

func (c *KumaSDConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type MonitoringAssignment

type MonitoringAssignment struct {

	// Mesh of the dataplane.
	//
	// E.g., `default`
	Mesh string `protobuf:"bytes,2,opt,name=mesh,proto3" json:"mesh,omitempty"`
	// Identifying service the dataplane is proxying.
	//
	// E.g., `backend`
	Service string `protobuf:"bytes,3,opt,name=service,proto3" json:"service,omitempty"`
	// List of targets that need to be monitored.
	Targets []*MonitoringAssignment_Target `protobuf:"bytes,4,rep,name=targets,proto3" json:"targets,omitempty"`
	// Arbitrary Labels associated with every target in the assignment.
	//
	// E.g., `{"zone" : "us-east-1", "team": "infra", "commit_hash": "620506a88"}`.
	Labels map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

MADS resource type.

Describes a group of targets on a single service that need to be monitored.

func (*MonitoringAssignment) Descriptor deprecated

func (*MonitoringAssignment) Descriptor() ([]byte, []int)

Deprecated: Use MonitoringAssignment.ProtoReflect.Descriptor instead.

func (*MonitoringAssignment) GetLabels

func (x *MonitoringAssignment) GetLabels() map[string]string

func (*MonitoringAssignment) GetMesh

func (x *MonitoringAssignment) GetMesh() string

func (*MonitoringAssignment) GetService

func (x *MonitoringAssignment) GetService() string

func (*MonitoringAssignment) GetTargets

func (*MonitoringAssignment) ProtoMessage

func (*MonitoringAssignment) ProtoMessage()

func (*MonitoringAssignment) ProtoReflect

func (x *MonitoringAssignment) ProtoReflect() protoreflect.Message

func (*MonitoringAssignment) Reset

func (x *MonitoringAssignment) Reset()

func (*MonitoringAssignment) String

func (x *MonitoringAssignment) String() string

type MonitoringAssignmentDiscoveryServiceServer

type MonitoringAssignmentDiscoveryServiceServer interface {
	// HTTP
	FetchMonitoringAssignments(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error)
}

MonitoringAssignmentDiscoveryServiceServer is the server API for MonitoringAssignmentDiscoveryService service.

type MonitoringAssignment_Target

type MonitoringAssignment_Target struct {

	// E.g., `backend-01`
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// Scheme on which to scrape the target.
	//E.g., `http`
	Scheme string `protobuf:"bytes,2,opt,name=scheme,proto3" json:"scheme,omitempty"`
	// Address (preferably IP) for the service
	// E.g., `backend.svc` or `10.1.4.32:9090`
	Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
	// Optional path to append to the address for scraping
	//E.g., `/metrics`
	MetricsPath string `protobuf:"bytes,4,opt,name=metrics_path,json=metricsPath,proto3" json:"metrics_path,omitempty"`
	// Arbitrary labels associated with that particular target.
	//
	// E.g.,
	// `{
	//    "commit_hash" : "620506a88",
	//  }`.
	Labels map[string]string `` /* 153-byte string literal not displayed */
	// contains filtered or unexported fields
}

Describes a single target that needs to be monitored.

func (*MonitoringAssignment_Target) Descriptor deprecated

func (*MonitoringAssignment_Target) Descriptor() ([]byte, []int)

Deprecated: Use MonitoringAssignment_Target.ProtoReflect.Descriptor instead.

func (*MonitoringAssignment_Target) GetAddress

func (x *MonitoringAssignment_Target) GetAddress() string

func (*MonitoringAssignment_Target) GetLabels

func (x *MonitoringAssignment_Target) GetLabels() map[string]string

func (*MonitoringAssignment_Target) GetMetricsPath

func (x *MonitoringAssignment_Target) GetMetricsPath() string

func (*MonitoringAssignment_Target) GetName

func (x *MonitoringAssignment_Target) GetName() string

func (*MonitoringAssignment_Target) GetScheme

func (x *MonitoringAssignment_Target) GetScheme() string

func (*MonitoringAssignment_Target) ProtoMessage

func (*MonitoringAssignment_Target) ProtoMessage()

func (*MonitoringAssignment_Target) ProtoReflect

func (*MonitoringAssignment_Target) Reset

func (x *MonitoringAssignment_Target) Reset()

func (*MonitoringAssignment_Target) String

func (x *MonitoringAssignment_Target) String() string

type ProtocolVersion

type ProtocolVersion string

ProtocolVersion is the xDS protocol version.

type ResourceClient

type ResourceClient interface {
	// ResourceTypeURL is the type URL of the resource.
	ResourceTypeURL() string

	// Server is the xDS Management server.
	Server() string

	// Fetch requests the latest view of the entire resource state.
	// If no updates have been made since the last request, the response will be nil.
	Fetch(ctx context.Context) (*v3.DiscoveryResponse, error)

	// ID returns the ID of the client that is sent to the xDS server.
	ID() string

	// Close releases currently held resources.
	Close()
}

ResourceClient exposes the xDS protocol for a single resource type. See https://www.envoyproxy.io/docs/envoy/latest/api-docs/xds_protocol#rest-json-polling-subscriptions .

type SDConfig

type SDConfig struct {
	HTTPClientConfig config.HTTPClientConfig `yaml:",inline"`
	RefreshInterval  model.Duration          `yaml:"refresh_interval,omitempty"`
	FetchTimeout     model.Duration          `yaml:"fetch_timeout,omitempty"`
	Server           string                  `yaml:"server,omitempty"`
}

SDConfig is a base config for xDS-based SD mechanisms.

Jump to

Keyboard shortcuts

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