fix: add involves edge from task to agent:nomos at creation
Plus sync vendor directory for Docker build compatibility.
This commit is contained in:
112
vendor/google.golang.org/grpc/internal/xds/clients/config.go
generated
vendored
Normal file
112
vendor/google.golang.org/grpc/internal/xds/clients/config.go
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2024 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
// Package clients provides implementations of the clients to interact with
|
||||
// xDS and LRS servers.
|
||||
//
|
||||
// # xDS Client
|
||||
//
|
||||
// The xDS client allows applications to:
|
||||
// - Create client instances with in-memory configurations.
|
||||
// - Register watches for named resources.
|
||||
// - Receive resources via the ADS (Aggregated Discovery Service) stream.
|
||||
//
|
||||
// This enables applications to dynamically discover and configure resources
|
||||
// such as listeners, routes, clusters, and endpoints from an xDS management
|
||||
// server.
|
||||
//
|
||||
// # LRS Client
|
||||
//
|
||||
// The LRS (Load Reporting Service) client allows applications to report load
|
||||
// data to an LRS server via the LRS stream. This data can be used for
|
||||
// monitoring, traffic management, and other purposes.
|
||||
//
|
||||
// # Experimental
|
||||
//
|
||||
// NOTICE: This package is EXPERIMENTAL and may be changed or removed
|
||||
// in a later release.
|
||||
package clients
|
||||
|
||||
// ServerIdentifier holds identifying information for connecting to an xDS
|
||||
// management or LRS server.
|
||||
type ServerIdentifier struct {
|
||||
// ServerURI is the target URI of the server.
|
||||
ServerURI string
|
||||
|
||||
// Extensions can be populated with arbitrary data to be passed to the
|
||||
// TransportBuilder and/or xDS Client's ResourceType implementations.
|
||||
// This field can be used to provide additional configuration or context
|
||||
// specific to the user's needs.
|
||||
//
|
||||
// The xDS and LRS clients do not interpret the contents of this field.
|
||||
// It is the responsibility of the user's custom TransportBuilder and/or
|
||||
// ResourceType implementations to handle and interpret these extensions.
|
||||
//
|
||||
// For example, a custom TransportBuilder might use this field to
|
||||
// configure a specific security credentials.
|
||||
//
|
||||
// Extensions may be any type that is comparable, as they are used as map
|
||||
// keys internally. If Extensions are not able to be used as a map key,
|
||||
// the client may panic.
|
||||
//
|
||||
// See: https://go.dev/ref/spec#Comparison_operators
|
||||
//
|
||||
// Any equivalent extensions in all ServerIdentifiers present in a single
|
||||
// client's configuration should have the same value. Not following this
|
||||
// restriction may result in excess resource usage.
|
||||
Extensions any
|
||||
}
|
||||
|
||||
// Node represents the identity of the xDS client, allowing xDS and LRS servers
|
||||
// to identify the source of xDS requests.
|
||||
type Node struct {
|
||||
// ID is a string identifier of the application.
|
||||
ID string
|
||||
// Cluster is the name of the cluster the application belongs to.
|
||||
Cluster string
|
||||
// Locality is the location of the application including region, zone,
|
||||
// sub-zone.
|
||||
Locality Locality
|
||||
// Metadata provides additional context about the application by associating
|
||||
// arbitrary key-value pairs with it.
|
||||
Metadata any
|
||||
// UserAgentName is the user agent name of application.
|
||||
UserAgentName string
|
||||
// UserAgentVersion is the user agent version of application.
|
||||
UserAgentVersion string
|
||||
}
|
||||
|
||||
// Locality represents the location of the xDS client application.
|
||||
type Locality struct {
|
||||
// Region is the region of the xDS client application.
|
||||
Region string
|
||||
// Zone is the area within a region.
|
||||
Zone string
|
||||
// SubZone is the further subdivision within a zone.
|
||||
SubZone string
|
||||
}
|
||||
|
||||
// MetricsReporter is used by the XDSClient to report metrics.
|
||||
type MetricsReporter interface {
|
||||
// ReportMetric reports a metric. The metric will be one of the predefined
|
||||
// set of types depending on the client (XDSClient or LRSClient).
|
||||
//
|
||||
// Each client will produce different metrics. Please see the client's
|
||||
// documentation for a list of possible metrics events.
|
||||
ReportMetric(metric any)
|
||||
}
|
||||
53
vendor/google.golang.org/grpc/internal/xds/clients/transport_builder.go
generated
vendored
Normal file
53
vendor/google.golang.org/grpc/internal/xds/clients/transport_builder.go
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2024 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package clients
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// TransportBuilder provides the functionality to create a communication
|
||||
// channel to an xDS or LRS server.
|
||||
type TransportBuilder interface {
|
||||
// Build creates a new Transport instance to the server based on the
|
||||
// provided ServerIdentifier.
|
||||
Build(serverIdentifier ServerIdentifier) (Transport, error)
|
||||
}
|
||||
|
||||
// Transport provides the functionality to communicate with an xDS or LRS
|
||||
// server using streaming calls.
|
||||
type Transport interface {
|
||||
// NewStream creates a new streaming call to the server for the specific
|
||||
// RPC method name. The returned Stream interface can be used to send and
|
||||
// receive messages on the stream.
|
||||
NewStream(context.Context, string) (Stream, error)
|
||||
|
||||
// Close closes the Transport.
|
||||
Close()
|
||||
}
|
||||
|
||||
// Stream provides methods to send and receive messages on a stream. Messages
|
||||
// are represented as a byte slice.
|
||||
type Stream interface {
|
||||
// Send sends the provided message on the stream.
|
||||
Send([]byte) error
|
||||
|
||||
// Recv blocks until the next message is received on the stream.
|
||||
Recv() ([]byte, error)
|
||||
}
|
||||
123
vendor/google.golang.org/grpc/internal/xds/xds.go
generated
vendored
Normal file
123
vendor/google.golang.org/grpc/internal/xds/xds.go
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2021 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Package xds contains functions, structs, and utilities for working with
|
||||
// handshake cluster names, as well as shared components used by xds balancers
|
||||
// and resolvers. It is separated from the top-level /internal package to
|
||||
// avoid circular dependencies.
|
||||
package xds
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"google.golang.org/grpc/attributes"
|
||||
"google.golang.org/grpc/internal"
|
||||
"google.golang.org/grpc/internal/xds/clients"
|
||||
"google.golang.org/grpc/resolver"
|
||||
)
|
||||
|
||||
// handshakeClusterNameKey is the type used as the key to store cluster name in
|
||||
// the Attributes field of resolver.Address.
|
||||
type handshakeClusterNameKey struct{}
|
||||
|
||||
// SetXDSHandshakeClusterName returns a copy of addr in which the Attributes field
|
||||
// is updated with the cluster name.
|
||||
func SetXDSHandshakeClusterName(addr resolver.Address, clusterName string) resolver.Address {
|
||||
addr.Attributes = addr.Attributes.WithValue(handshakeClusterNameKey{}, clusterName)
|
||||
return addr
|
||||
}
|
||||
|
||||
// GetXDSHandshakeClusterName returns cluster name stored in attr.
|
||||
func GetXDSHandshakeClusterName(attr *attributes.Attributes) (string, bool) {
|
||||
v := attr.Value(handshakeClusterNameKey{})
|
||||
name, ok := v.(string)
|
||||
return name, ok
|
||||
}
|
||||
|
||||
// addressToTelemetryLabels prepares a telemetry label map from resolver
|
||||
// address attributes.
|
||||
func addressToTelemetryLabels(addr resolver.Address) map[string]string {
|
||||
cluster, _ := GetXDSHandshakeClusterName(addr.Attributes)
|
||||
locality := LocalityString(GetLocalityID(addr))
|
||||
return map[string]string{
|
||||
"grpc.lb.locality": locality,
|
||||
"grpc.lb.backend_service": cluster,
|
||||
}
|
||||
}
|
||||
|
||||
// LocalityString generates a string representation of clients.Locality in the
|
||||
// format specified in gRFC A76.
|
||||
func LocalityString(l clients.Locality) string {
|
||||
return fmt.Sprintf("{region=%q, zone=%q, sub_zone=%q}", l.Region, l.Zone, l.SubZone)
|
||||
}
|
||||
|
||||
// IsLocalityEqual allows the values to be compared by Attributes.Equal.
|
||||
func IsLocalityEqual(l clients.Locality, o any) bool {
|
||||
ol, ok := o.(clients.Locality)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return l.Region == ol.Region && l.Zone == ol.Zone && l.SubZone == ol.SubZone
|
||||
}
|
||||
|
||||
// LocalityFromString converts a string representation of clients.locality as
|
||||
// specified in gRFC A76, into a LocalityID struct.
|
||||
func LocalityFromString(s string) (ret clients.Locality, _ error) {
|
||||
_, err := fmt.Sscanf(s, "{region=%q, zone=%q, sub_zone=%q}", &ret.Region, &ret.Zone, &ret.SubZone)
|
||||
if err != nil {
|
||||
return clients.Locality{}, fmt.Errorf("%s is not a well formatted locality ID, error: %v", s, err)
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
type localityKeyType string
|
||||
|
||||
const localityKey = localityKeyType("grpc.xds.internal.address.locality")
|
||||
|
||||
// GetLocalityID returns the locality ID of addr.
|
||||
func GetLocalityID(addr resolver.Address) clients.Locality {
|
||||
path, _ := addr.BalancerAttributes.Value(localityKey).(clients.Locality)
|
||||
return path
|
||||
}
|
||||
|
||||
// SetLocalityID sets locality ID in addr to l.
|
||||
func SetLocalityID(addr resolver.Address, l clients.Locality) resolver.Address {
|
||||
addr.BalancerAttributes = addr.BalancerAttributes.WithValue(localityKey, l)
|
||||
return addr
|
||||
}
|
||||
|
||||
// SetLocalityIDInEndpoint sets locality ID in endpoint to l.
|
||||
func SetLocalityIDInEndpoint(endpoint resolver.Endpoint, l clients.Locality) resolver.Endpoint {
|
||||
endpoint.Attributes = endpoint.Attributes.WithValue(localityKey, l)
|
||||
return endpoint
|
||||
}
|
||||
|
||||
// LocalityIDFromEndpoint returns the locality ID of ep.
|
||||
func LocalityIDFromEndpoint(ep resolver.Endpoint) clients.Locality {
|
||||
path, _ := ep.Attributes.Value(localityKey).(clients.Locality)
|
||||
return path
|
||||
}
|
||||
|
||||
// UnknownCSMLabels are TelemetryLabels emitted from CDS if CSM Telemetry Label
|
||||
// data is not present in the CDS Resource.
|
||||
var UnknownCSMLabels = map[string]string{
|
||||
"csm.service_name": "unknown",
|
||||
"csm.service_namespace_name": "unknown",
|
||||
}
|
||||
|
||||
func init() {
|
||||
internal.AddressToTelemetryLabels = addressToTelemetryLabels
|
||||
}
|
||||
Reference in New Issue
Block a user