services

package
v1.15.10 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlooServiceName = "gloo"
	FdsServiceName  = "fds"
	UdsServiceName  = "uds"
)
View Source
const (
	DefaultHost       = "127.0.0.1"
	DefaultPort       = 8200
	DefaultVaultToken = "root"
)

Variables

This section is empty.

Functions

func AllocateGlooPort

func AllocateGlooPort() int32

func ContainerExistsWithName added in v1.15.0

func ContainerExistsWithName(containerName string) string

ContainerExistsWithName returns an empty string if the container does not exist

func ExecOnContainer added in v1.15.0

func ExecOnContainer(containerName string, args []string) ([]byte, error)

func GetContainerNetwork added in v1.15.0

func GetContainerNetwork() string

func GetDockerHost added in v1.15.0

func GetDockerHost(containerName string) string

func GetLogLevel added in v1.15.0

func GetLogLevel(serviceName string) zapcore.Level

GetLogLevel returns the log level for the given service

func IsDebugLogLevel added in v1.15.0

func IsDebugLogLevel(serviceName string) bool

IsDebugLogLevel returns true if the given service is logging at the debug level

func LoadUserDefinedLogLevel added in v1.15.0

func LoadUserDefinedLogLevel(userDefinedLogLevel string)

LoadUserDefinedLogLevel loads the log level from the provided string and resets the entire LogProvider state to the values in that string

func LoadUserDefinedLogLevelFromEnv added in v1.15.0

func LoadUserDefinedLogLevelFromEnv()

LoadUserDefinedLogLevelFromEnv loads the log level from the environment variable and resets the entire LogProvider state to the values in that environment variable

func MustGetSugaredLogger added in v1.15.0

func MustGetSugaredLogger(serviceName string) *zap.SugaredLogger

MustGetSugaredLogger returns a sugared logger for the given service This logger is configured with the appropriate log level

func MustStopAndRemoveContainer added in v1.15.0

func MustStopAndRemoveContainer(containerName string)

func RunContainer added in v1.15.0

func RunContainer(containerName string, args []string) error

func RunPetstore added in v0.18.3

func RunPetstore(ctx context.Context, port int) error

func RunningInDocker added in v1.15.0

func RunningInDocker() bool

func SetLogLevel added in v1.15.0

func SetLogLevel(serviceName string, logLevel zapcore.Level)

SetLogLevel sets the log level for the given service

func StopContainer added in v1.15.0

func StopContainer(containerName string)

func WaitUntilContainerRemoved added in v1.15.0

func WaitUntilContainerRemoved(containerName string) error

WaitUntilContainerRemoved polls docker for removal of the container named containerName - block until successful or fail after a small number of retries

Types

type ConsulFactory

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

func NewConsulFactory

func NewConsulFactory() (*ConsulFactory, error)

NewConsulFactory returns a ConsulFactory

func (*ConsulFactory) Clean

func (cf *ConsulFactory) Clean() error

func (*ConsulFactory) MustConsulInstance added in v1.14.0

func (cf *ConsulFactory) MustConsulInstance() *ConsulInstance

func (*ConsulFactory) NewConsulInstance

func (cf *ConsulFactory) NewConsulInstance() (*ConsulInstance, error)

type ConsulInstance

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

func (*ConsulInstance) AddConfig

func (i *ConsulInstance) AddConfig(svcId, content string) error

func (*ConsulInstance) AddConfigFromStruct

func (i *ConsulInstance) AddConfigFromStruct(svcId string, cfg interface{}) error

func (*ConsulInstance) Binary

func (i *ConsulInstance) Binary() string

func (*ConsulInstance) Clean

func (i *ConsulInstance) Clean()

Clean stops the ConsulInstance

func (*ConsulInstance) Client added in v1.14.7

func (i *ConsulInstance) Client() *api.Client

Client returns the Consul API client, constructing one if necessary

func (*ConsulInstance) Put added in v1.14.7

func (i *ConsulInstance) Put(key string, value []byte) error

Put wraps the Consul KV Put API call

func (*ConsulInstance) RegisterLiveService added in v1.13.0

func (i *ConsulInstance) RegisterLiveService(svcName, svcId, address string, tags []string, port uint32) error

RegisterLiveService While it may be tempting to just reload all config using `consul reload` or marshalling new json and sending SIGHUP to the process (per https://www.consul.io/commands/reload), it is preferable to live update using the consul APIs as this is a more realistic flow and doesn't fire our watches too actively (which can both make debugging hard and hide bugs)

func (*ConsulInstance) RegisterService added in v0.17.4

func (i *ConsulInstance) RegisterService(svcName, svcId, address string, tags []string, port uint32) error

func (*ConsulInstance) ReloadConfig

func (i *ConsulInstance) ReloadConfig() error

func (*ConsulInstance) Run

func (i *ConsulInstance) Run(ctx context.Context) error

Run starts the ConsulInstance When the provided context is Done, the ConsulInstance is cleaned up

func (*ConsulInstance) Silence

func (i *ConsulInstance) Silence()

type ExtensionsBuilders added in v1.15.0

type ExtensionsBuilders struct {
	Gloo func(ctx context.Context, opts bootstrap.Opts) setup.Extensions
	Fds  func(ctx context.Context, opts bootstrap.Opts) fds_syncer.Extensions
}

type Ports added in v1.15.0

type Ports struct {
	Gloo       int32
	Validation int32
	RestXds    int32
}

type RunOptions

type RunOptions struct {
	NsToWrite string
	NsToWatch []string
	WhatToRun What
	Settings  *gloov1.Settings

	// ExtensionsBuilders are injection points for Enterprise functionality
	ExtensionsBuilders ExtensionsBuilders

	// Deprecated: do not write tests that require a Kubernetes client
	// This is an artifact of legacy tests which interacted with Kubernetes directly
	// If you need a KubeClient, you should be introducing a test in the `test/kube2e` package
	KubeClient kubernetes.Interface
	// contains filtered or unexported fields
}

RunOptions are options for running an in-memory e2e test

type TestClients

type TestClients struct {
	GatewayClient        gatewayv1.GatewayClient
	HttpGatewayClient    gatewayv1.MatchableHttpGatewayClient
	TcpGatewayClient     gatewayv1.MatchableTcpGatewayClient
	VirtualServiceClient gatewayv1.VirtualServiceClient
	RouteTableClient     gatewayv1.RouteTableClient
	ProxyClient          gloov1.ProxyClient
	UpstreamClient       gloov1.UpstreamClient
	SecretClient         gloov1.SecretClient
	ArtifactClient       gloov1.ArtifactClient
	ServiceClient        skkube.ServiceClient

	AuthConfigClient      extauthv1.AuthConfigClient
	RateLimitConfigClient v1alpha1.RateLimitConfigClient
	GraphQLApiClient      graphqlv1beta1.GraphQLApiClient

	GlooPort    int
	RestXdsPort int
}

TestClients represents the set of ResourceClients available for tests

func RunGlooGatewayUdsFds

func RunGlooGatewayUdsFds(ctx context.Context, runOptions *RunOptions) TestClients

RunGlooGatewayUdsFds runs the Gloo Edge control plane components in goroutines and stores configuration in-memory. This is used by the e2e tests in `test/e2e` package.

func (TestClients) DeleteSnapshot added in v1.9.25

func (c TestClients) DeleteSnapshot(ctx context.Context, snapshot *gloosnapshot.ApiSnapshot) error

DeleteSnapshot deletes all resources in the ApiSnapshot from the cache

func (TestClients) WriteSnapshot added in v1.9.25

func (c TestClients) WriteSnapshot(ctx context.Context, snapshot *gloosnapshot.ApiSnapshot) error

WriteSnapshot writes all resources in the ApiSnapshot to the cache

type VaultFactory

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

func NewVaultFactory

func NewVaultFactory() (*VaultFactory, error)

NewVaultFactory returns a VaultFactory

func (*VaultFactory) Clean

func (vf *VaultFactory) Clean() error

func (*VaultFactory) MustVaultInstance added in v1.14.0

func (vf *VaultFactory) MustVaultInstance() *VaultInstance

func (*VaultFactory) NewVaultInstance

func (vf *VaultFactory) NewVaultInstance() (*VaultInstance, error)

type VaultInstance

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

func (*VaultInstance) Address added in v1.9.25

func (i *VaultInstance) Address() string

func (*VaultInstance) Binary

func (i *VaultInstance) Binary() string

func (*VaultInstance) Clean

func (i *VaultInstance) Clean()

func (*VaultInstance) EnableAWSCredentialsAuthMethod added in v1.15.3

func (i *VaultInstance) EnableAWSCredentialsAuthMethod(settings *v1.Settings_VaultSecrets, awsAuthRole string) error

func (*VaultInstance) EnableAWSSTSAuthMethod added in v1.15.3

func (i *VaultInstance) EnableAWSSTSAuthMethod(awsAuthRole, serverIdHeader, stsRegion string) error

func (*VaultInstance) EnableSecretEngine added in v1.9.25

func (i *VaultInstance) EnableSecretEngine(secretEngine string) error

func (*VaultInstance) Exec

func (i *VaultInstance) Exec(args ...string) (string, error)

func (*VaultInstance) Host added in v1.14.0

func (i *VaultInstance) Host() string

func (*VaultInstance) Run

func (i *VaultInstance) Run(ctx context.Context) error

func (*VaultInstance) Token

func (i *VaultInstance) Token() string

func (*VaultInstance) WriteSecret added in v1.14.0

func (i *VaultInstance) WriteSecret(secret *v1.Secret) error

WriteSecret persists a Secret in Vault

type What

type What struct {
	DisableGateway bool
	DisableUds     bool
	DisableFds     bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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