v2

package
v0.0.0-...-d8a8f93 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 37 Imported by: 0

README

Debug interface

The debug handlers are configured on the monitoring port (default 9093) as well as on the http port (8080).


PILOT=istio-pilot.istio-system:9093

# What is sent to envoy
# Listeners and routes
curl $PILOT/debug/adsz

# Endpoints
curl $PILOT/debug/edsz

# Clusters
curl $PILOT/debug/cdsz


Each handler takes an extra parameter, "debug=0|1" which flips the verbosity of the messages for that component (similar with envoy).

An extra parameter "push=1" triggers a config push to all connected endpoints.

Handlers should list, in json format:

  • one entry for each connected envoy
  • the timestamp of the connection

In addition, Pilot debug interface can show pilot's internal view of the config:



# General metrics
curl $PILOT/metrics

# All services/external services from all registries
curl $PILOT/debug/registryz

# All endpoints
curl $PILOT/debug/endpointz[?brief=1]

# All configs.
curl $PILOT/debug/configz

Example for EDS:

{

   // Cluster
   "echosrv.istio-system.svc.cluster.local|grpc-ping": {
    "EdsClients": {
      // One for each connected envoy.
      "sidecar~172.17.0.8~echosrv-deployment-5b7878cc9-dlm8j.istio-system~istio-system.svc.cluster.local-116": {
        // Should match the info in the node (this is the real remote address)
        "PeerAddr": "172.17.0.8:42044",
        "Clusters": [
          // Should match the cluster, this is what is monitored
          "echosrv.istio-system.svc.cluster.local|grpc-ping"
        ],
        // Time the sidecar connected to pilot
        "Connect": "2018-03-22T15:01:07.527304202Z"
      },
      "sidecar~172.17.0.9~echosrv-deployment-5b7878cc9-wb9b7.istio-system~istio-system.svc.cluster.local-75": {
        "PeerAddr": "172.17.0.9:47182",
        "Clusters": [
          "echosrv.istio-system.svc.cluster.local|grpc-ping"
        ],
        "Connect": "2018-03-22T15:01:00.465066249Z"
      }
    },
    // The info pushed to each connected sidecar watching the cluster.
    "LoadAssignment": {
      "cluster_name": "echosrv.istio-system.svc.cluster.local|grpc-ping",
      "endpoints": [
        {
          "locality": {},
          "lb_endpoints": [
           {
              // Should match the endpoint and port from 'kubectl get ep'
              "endpoint": {
                "address": {
                  "Address": {
                    "SocketAddress": {
                      "address": "172.17.0.8",
                      "PortSpecifier": {
                        "PortValue": 8079
                      },
                      "ipv4_compat": true
                    }
                  }
                }
              }
            },
          ]
          }
      ]
      }
    }


Log messages

Verbose messages for v2 is controlled by env variables PILOT_DEBUG_{EDS,CDS,LDS}. Setting it to "0" disables debug, setting it to "1" enables - debug is currently enabled by default, since it is not very verbose.

Messages are prefixed with EDS/LDS/CDS.

What we log and how to use it:

  • sidecar connecting to pilot: "EDS/CSD/LDS: REQ ...". This includes the node, IP and the discovery request proto. Should show up when the sidecar starts up.
  • sidecar disconnecting from pilot: xDS: close. This happens when a pod is stopped.
  • push events - whenever we push a config the the sidecar.
  • "XDS: Registry event..." - indicates a registry event, should be followed by PUSH messages for each endpoint.
  • "EDS: no instances": pay close attention to this event, it indicates that Envoy asked for a cluster but pilot doesn't have any valid instance. At some point after, when the instance eventually shows up you should see an EDS PUSH message.

In addition, the registry has slightly more verbose messages about the events, so it is possible to map an event in the registry to config pushes.

Example requests and responses

EDS:


    node:<id:"ingress~~istio-ingress-6796c456f4-7zqtm.istio-system~istio-system.svc.cluster.local"
    cluster:"istio-ingress"
    build_version:"0/1.6.0-dev//RELEASE" >
    resource_names:"echosrv.istio-system.svc.cluster.local|http-echo"
    type_url:"type.googleapis.com/envoy.api.v2.ClusterLoadAssignment"

Documentation

Index

Constants

View Source
const (

	// ClusterType is used for cluster discovery. Typically first request received
	ClusterType = typePrefix + "Cluster"
	// EndpointType is used for EDS and ADS endpoint discovery. Typically second request.
	EndpointType = typePrefix + "ClusterLoadAssignment"
	// ListenerType is sent after clusters and endpoints.
	ListenerType = typePrefix + "Listener"
	// RouteType is sent after listeners.
	RouteType = typePrefix + "RouteConfiguration"
)

Variables

View Source
var (

	// SendTimeout is the max time to wait for a ADS send to complete. This helps detect
	// clients in a bad state (not reading). In future it may include checking for ACK
	SendTimeout = 5 * time.Second

	// PushTimeout is the time to wait for a push on a client. Pilot iterates over
	// clients and pushes them serially for now, to avoid large CPU/memory spikes.
	// We measure and reports cases where pusing a client takes longer.
	PushTimeout = 5 * time.Second
)

Functions

func ConfigDump

func ConfigDump(w http.ResponseWriter, req *http.Request)

ConfigDump returns information in the form of the Envoy admin API config dump for the specified proxy The dump will only contain dynamic listeners/clusters/routes and can be used to compare what an Envoy instance should look like according to Pilot vs what it currently does look like.

func PushAll

func PushAll()

PushAll implements old style invalidation, generated when any rule or endpoint changes. Primary code path is from v1 discoveryService.clearCache(), which is added as a handler to the model ConfigStorageCache and Controller.

func Syncz

func Syncz(w http.ResponseWriter, req *http.Request)

Syncz dumps the synchronization status of all Envoys connected to this Pilot instance

Types

type AuthenticationDebug

type AuthenticationDebug struct {
	Host                     string `json:"host"`
	Port                     int    `json:"port"`
	AuthenticationPolicyName string `json:"authentication_policy_name"`
	DestinationRuleName      string `json:"destination_rule_name"`
	ServerProtocol           string `json:"server_protocol"`
	ClientProtocol           string `json:"client_protocol"`
	TLSConflictStatus        string `json:"TLS_conflict_status"`
}

AuthenticationDebug holds debug information for service authentication policy.

type DiscoveryServer

type DiscoveryServer struct {

	// MemRegistry is used for debug and load testing, allow adding services. Visible for testing.
	MemRegistry *MemServiceDiscovery

	// ConfigGenerator is responsible for generating data plane configuration using Istio networking
	// APIs and service registry info
	ConfigGenerator core.ConfigGenerator
	// contains filtered or unexported fields
}

DiscoveryServer is Pilot's gRPC implementation for Envoy's v2 xds APIs

func NewDiscoveryServer

func NewDiscoveryServer(env model.Environment, generator core.ConfigGenerator) *DiscoveryServer

NewDiscoveryServer creates DiscoveryServer that sources data from Pilot's internal mesh data structures

func (*DiscoveryServer) ClearCacheFunc

func (s *DiscoveryServer) ClearCacheFunc() func()

ClearCacheFunc returns a function that invalidates v2 caches and triggers a push. This is used for transition, once the new config model is in place we'll have separate functions for each event and push only configs that need to be pushed. This is currently called from v1 and has attenuation/throttling.

func (*DiscoveryServer) FetchEndpoints

FetchEndpoints implements xdsapi.EndpointDiscoveryServiceServer.FetchEndpoints().

func (*DiscoveryServer) InitDebug

func (s *DiscoveryServer) InitDebug(mux *http.ServeMux, sctl *aggregate.Controller)

InitDebug initializes the debug handlers and adds a debug in-memory registry.

func (*DiscoveryServer) Register

func (s *DiscoveryServer) Register(rpcs *grpc.Server)

Register adds the ADS and EDS handles to the grpc server

func (*DiscoveryServer) StreamAggregatedResources

StreamAggregatedResources implements the ADS interface.

func (*DiscoveryServer) StreamEndpoints

StreamEndpoints implements xdsapi.EndpointDiscoveryServiceServer.StreamEndpoints().

func (*DiscoveryServer) StreamLoadStats

StreamLoadStats implements xdsapi.EndpointDiscoveryServiceServer.StreamLoadStats().

type DiscoveryStream

type DiscoveryStream interface {
	Send(*xdsapi.DiscoveryResponse) error
	Recv() (*xdsapi.DiscoveryRequest, error)
	grpc.ServerStream
}

DiscoveryStream is a common interface for EDS and ADS. It also has a shorter name.

type EdsCluster

type EdsCluster struct {
	LoadAssignment *xdsapi.ClusterLoadAssignment

	// FirstUse is the time the cluster was first used, for debugging
	FirstUse time.Time

	// EdsClients keeps track of all nodes monitoring the cluster.
	EdsClients map[string]*XdsConnection `json:"-"`

	// NonEmptyTime is the time the cluster first had a non-empty set of endpoints
	NonEmptyTime time.Time
	// contains filtered or unexported fields
}

EdsCluster tracks eds-related info for monitored clusters. In practice it'll include all clusters until we support on-demand cluster loading.

type MemServiceDiscovery

type MemServiceDiscovery struct {
	WantGetProxyServiceInstances  []*model.ServiceInstance
	ServicesError                 error
	GetServiceError               error
	InstancesError                error
	GetProxyServiceInstancesError error
	// contains filtered or unexported fields
}

MemServiceDiscovery is a mock discovery interface

func NewMemServiceDiscovery

func NewMemServiceDiscovery(services map[model.Hostname]*model.Service, versions int) *MemServiceDiscovery

NewMemServiceDiscovery builds an in-memory MemServiceDiscovery

func (*MemServiceDiscovery) AddEndpoint

func (sd *MemServiceDiscovery) AddEndpoint(service model.Hostname, servicePortName string, servicePort int, address string, port int) *model.ServiceInstance

AddEndpoint adds an endpoint to a service.

func (*MemServiceDiscovery) AddInstance

func (sd *MemServiceDiscovery) AddInstance(service model.Hostname, instance *model.ServiceInstance)

AddInstance adds an in-memory instance.

func (*MemServiceDiscovery) AddService

func (sd *MemServiceDiscovery) AddService(name model.Hostname, svc *model.Service)

AddService adds an in-memory service.

func (*MemServiceDiscovery) ClearErrors

func (sd *MemServiceDiscovery) ClearErrors()

ClearErrors clear errors used for mocking failures during model.MemServiceDiscovery interface methods

func (*MemServiceDiscovery) GetIstioServiceAccounts

func (sd *MemServiceDiscovery) GetIstioServiceAccounts(hostname model.Hostname, ports []string) []string

GetIstioServiceAccounts gets the Istio service accounts for a service hostname.

func (*MemServiceDiscovery) GetProxyServiceInstances

func (sd *MemServiceDiscovery) GetProxyServiceInstances(node *model.Proxy) ([]*model.ServiceInstance, error)

GetProxyServiceInstances returns service instances associated with a node, resulting in 'in' services.

func (*MemServiceDiscovery) GetService

func (sd *MemServiceDiscovery) GetService(hostname model.Hostname) (*model.Service, error)

GetService implements discovery interface Each call to GetService() should return a new *model.Service

func (*MemServiceDiscovery) GetServiceAttributes

func (sd *MemServiceDiscovery) GetServiceAttributes(hostname model.Hostname) (*model.ServiceAttributes, error)

GetServiceAttributes implements discovery interface.

func (*MemServiceDiscovery) Instances

func (sd *MemServiceDiscovery) Instances(hostname model.Hostname, ports []string,
	labels model.LabelsCollection) ([]*model.ServiceInstance, error)

Instances filters the service instances by labels. This assumes single port, as is used by EDS/ADS.

func (*MemServiceDiscovery) InstancesByPort

func (sd *MemServiceDiscovery) InstancesByPort(hostname model.Hostname, port int,
	labels model.LabelsCollection) ([]*model.ServiceInstance, error)

InstancesByPort filters the service instances by labels. This assumes single port, as is used by EDS/ADS.

func (*MemServiceDiscovery) ManagementPorts

func (sd *MemServiceDiscovery) ManagementPorts(addr string) model.PortList

ManagementPorts implements discovery interface

func (*MemServiceDiscovery) Services

func (sd *MemServiceDiscovery) Services() ([]*model.Service, error)

Services implements discovery interface Each call to Services() should return a list of new *model.Service

func (*MemServiceDiscovery) WorkloadHealthCheckInfo

func (sd *MemServiceDiscovery) WorkloadHealthCheckInfo(addr string) model.ProbeList

WorkloadHealthCheckInfo implements discovery interface

type SyncStatus

type SyncStatus struct {
	ProxyID         string `json:"proxy,omitempty"`
	ClusterSent     string `json:"cluster_sent,omitempty"`
	ClusterAcked    string `json:"cluster_acked,omitempty"`
	ListenerSent    string `json:"listener_sent,omitempty"`
	ListenerAcked   string `json:"listener_acked,omitempty"`
	RouteSent       string `json:"route_sent,omitempty"`
	RouteAcked      string `json:"route_acked,omitempty"`
	EndpointSent    string `json:"endpoint_sent,omitempty"`
	EndpointAcked   string `json:"endpoint_acked,omitempty"`
	EndpointPercent int    `json:"endpoint_percent,omitempty"`
}

SyncStatus is the synchronization status between Pilot and a given Envoy

type XdsConnection

type XdsConnection struct {

	// PeerAddr is the address of the client envoy, from network layer
	PeerAddr string

	// Time of connection, for debugging
	Connect time.Time

	// ConID is the connection identifier, used as a key in the connection table.
	// Currently based on the node name and a counter.
	ConID string

	HTTPListeners []*xdsapi.Listener                    `json:"-"`
	RouteConfigs  map[string]*xdsapi.RouteConfiguration `json:"-"`
	HTTPClusters  []*xdsapi.Cluster

	// Last nonce sent and ack'd (timestamps) used for debugging
	ClusterNonceSent, ClusterNonceAcked   string
	ListenerNonceSent, ListenerNonceAcked string
	RouteNonceSent, RouteNonceAcked       string
	EndpointNonceSent, EndpointNonceAcked string
	RoutePercent, EndpointPercent         int

	// current list of clusters monitored by the client
	Clusters []string

	// Routes is the list of watched Routes.
	Routes []string

	// LDSWatch is set if the remote server is watching Listeners
	LDSWatch bool
	// CDSWatch is set if the remote server is watching Clusters
	CDSWatch bool

	// Time of last push
	LastPush time.Time

	// Time of last push failure.
	LastPushFailure time.Time
	// contains filtered or unexported fields
}

XdsConnection is a listener connection type.

type XdsEvent

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

XdsEvent represents a config or registry event that results in a push.

Jump to

Keyboard shortcuts

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