helpers

package
v0.0.0-...-da93f2a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package helpers contains utility structs that operate on cluster generators.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TLSTransportSockerName is the name of the Envoy transport socket that configures TLS.
	TLSTransportSockerName = "envoy.transport_sockets.tls"

	// DefaultClientSslFilename is the name to use when no SSL client file is provided.
	DefaultClientSslFilename = "client"
)
View Source
var (
	// DNSDefaultPort is the default port for DNS protocol.
	DNSDefaultPort = "53"
)

Functions

func MaybeAddDNSResolver

func MaybeAddDNSResolver(dnsConfiger *ClusterDNSConfiger, cluster *clusterpb.Cluster) error

MaybeAddDNSResolver adds the generated DNS resolvers config to the given cluster.

func MaybeAddGRPCHealthCheck

func MaybeAddGRPCHealthCheck(grpcHealthChecker *ClusterGRPCHealthCheckConfiger, cluster *clusterpb.Cluster) error

MaybeAddGRPCHealthCheck adds the generated backend gRPC health check config to the cluster.

func ParseServiceControlURLFromOPConfig

func ParseServiceControlURLFromOPConfig(serviceConfig *servicepb.Service, opts options.ConfigGeneratorOptions) (url.URL, error)

ParseServiceControlURLFromOPConfig parses the service control URL from OP service config + descriptor + ESPv2 options.

Types

type BaseBackendCluster

type BaseBackendCluster struct {
	ClusterName string
	Hostname    string
	Port        uint32
	Protocol    util.BackendProtocol

	ClusterConnectTimeout  time.Duration
	MaxRequestsThreshold   int
	BackendDnsLookupFamily string

	// DNS adds on additional DNS resolver config to the cluster.
	// Nil if not needed.
	DNS *ClusterDNSConfiger

	// TLS adds on additional TLS transport socket config to the cluster.
	// Nil if not needed.
	TLS *ClusterTLSConfiger
}

BaseBackendCluster is an Envoy cluster to communicate with a backend.

This should NOT be used directly. Use it via an abstraction like RemoteBackendCluster or LocalBackendCluster.

func (*BaseBackendCluster) GenBaseConfig

func (c *BaseBackendCluster) GenBaseConfig() (*clusterpb.Cluster, error)

GenBaseConfig generates the base cluster configuration that is common to all backend clusters.

type ClusterDNSConfiger

type ClusterDNSConfiger struct {
	Address string
}

ClusterDNSConfiger is a helper to set DNS addresses on a cluster.

func NewClusterDNSConfigerFromOPConfig

func NewClusterDNSConfigerFromOPConfig(opts options.ConfigGeneratorOptions) *ClusterDNSConfiger

NewClusterDNSConfigerFromOPConfig creates a ClusterTLSConfiger from OP service config + descriptor + ESPv2 options.

func (*ClusterDNSConfiger) MakeResolversConfig

func (c *ClusterDNSConfiger) MakeResolversConfig() ([]*corepb.Address, error)

MakeResolversConfig creates an address with DNS config for a cluster.

type ClusterGRPCHealthCheckConfiger

type ClusterGRPCHealthCheckConfiger struct {
	ServiceName       string
	Interval          time.Duration
	NoTrafficInterval time.Duration
}

ClusterGRPCHealthCheckConfiger is a helper to set gRPC backend health check config on a cluster.

func NewClusterGRPCHealthCheckConfigerFromOPConfig

func NewClusterGRPCHealthCheckConfigerFromOPConfig(opts options.ConfigGeneratorOptions) *ClusterGRPCHealthCheckConfiger

NewClusterGRPCHealthCheckConfigerFromOPConfig creates a ClusterGRPCHealthCheckConfiger from OP service config + descriptor + ESPv2 options.

func (*ClusterGRPCHealthCheckConfiger) MakeHealthConfig

func (c *ClusterGRPCHealthCheckConfiger) MakeHealthConfig() ([]*corepb.HealthCheck, error)

MakeHealthConfig creates a HealthCheck with gRPC backend health config for a cluster.

type ClusterTLSConfiger

type ClusterTLSConfiger struct {
	RootCertsPath      string
	ClientCertsPath    string
	ClientCipherSuites string
}

ClusterTLSConfiger is a helper to set TLS config on a cluster.

func NewClusterTLSConfigerFromOPConfig

func NewClusterTLSConfigerFromOPConfig(opts options.ConfigGeneratorOptions, isBackendCluster bool) *ClusterTLSConfiger

NewClusterTLSConfigerFromOPConfig creates a ClusterTLSConfiger from OP service config + descriptor + ESPv2 options.

func (*ClusterTLSConfiger) MakeTLSConfig

func (c *ClusterTLSConfiger) MakeTLSConfig(hostname string, alpnProtocols []string) (*corepb.TransportSocket, error)

MakeTLSConfig creates a TransportSocket with TLS config for a cluster.

Jump to

Keyboard shortcuts

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