ratelimit

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RedisSocketTypeEnvVar is the redis socket type.
	RedisSocketTypeEnvVar = "REDIS_SOCKET_TYPE"
	// RedisURLEnvVar is the redis url.
	RedisURLEnvVar = "REDIS_URL"
	// RedisTLSEnvVar is the redis tls.
	RedisTLSEnvVar = "REDIS_TLS"
	// RedisTLSClientCertEnvVar is the redis tls client cert.
	RedisTLSClientCertEnvVar = "REDIS_TLS_CLIENT_CERT"
	// RedisTLSClientCertFilename is the redis tls client cert file.
	RedisTLSClientCertFilename = "/redis-certs/tls.crt"
	// RedisTLSClientKeyEnvVar is the redis tls client key.
	RedisTLSClientKeyEnvVar = "REDIS_TLS_CLIENT_KEY"
	// RedisTLSClientKeyFilename is the redis client key file.
	RedisTLSClientKeyFilename = "/redis-certs/tls.key"
	// RuntimeRootEnvVar is the runtime root.
	RuntimeRootEnvVar = "RUNTIME_ROOT"
	// RuntimeSubdirectoryEnvVar is the runtime subdirectory.
	RuntimeSubdirectoryEnvVar = "RUNTIME_SUBDIRECTORY"
	// RuntimeIgnoreDotfilesEnvVar is the runtime ignoredotfiles.
	RuntimeIgnoreDotfilesEnvVar = "RUNTIME_IGNOREDOTFILES"
	// RuntimeWatchRootEnvVar is the runtime watch root.
	RuntimeWatchRootEnvVar = "RUNTIME_WATCH_ROOT"
	// GRPCServerUseTLSEnvVar is tls enable option for grpc server.
	GRPCServerUseTLSEnvVar = "GRPC_SERVER_USE_TLS"
	// GRPCServerTLSCertEnvVar is the grpc server tls cert.
	GRPCServerTLSCertEnvVar = "GRPC_SERVER_TLS_CERT"
	// GRPCTLSCertFilename is the GRPC tls cert file.
	GRPCTLSCertFilename = "/certs/tls.crt"
	// GRPCServerTLSKeyEnvVarEnvVar is the grpc server tls key.
	GRPCServerTLSKeyEnvVarEnvVar = "GRPC_SERVER_TLS_KEY"
	// GRPCTLSKeyFilename is the grpc server key file.
	GRPCTLSKeyFilename = "/certs/tls.key"
	// GRPCServerTLSCACertEnvVar is the grpc server tls ca cert.
	GRPCServerTLSCACertEnvVar = "GRPC_SERVER_TLS_CA_CERT"
	// GRPCTLSCACertFilename is the grpc server tls ca cert file.
	GRPCTLSCACertFilename = "/certs/ca.crt"
	// ConfigGRPCXDSServerUseTLSEnvVar is tls enable option for grpc xds server.
	ConfigGRPCXDSServerUseTLSEnvVar = "CONFIG_GRPC_XDS_SERVER_USE_TLS"
	// ConfigGRPCXDSClientTLSCertEnvVar is the grpc xds client tls cert.
	ConfigGRPCXDSClientTLSCertEnvVar = "CONFIG_GRPC_XDS_CLIENT_TLS_CERT"
	// ConfigGRPCXDSClientTLSKeyEnvVar is the grpc xds client tls key.
	ConfigGRPCXDSClientTLSKeyEnvVar = "CONFIG_GRPC_XDS_CLIENT_TLS_KEY"
	// ConfigGRPCXDSServerTLSCACertEnvVar is the grpc xds server tls ca cert.
	ConfigGRPCXDSServerTLSCACertEnvVar = "CONFIG_GRPC_XDS_SERVER_TLS_CACERT"
	// LogLevelEnvVar is the log level.
	LogLevelEnvVar = "LOG_LEVEL"
	// UseStatsdEnvVar is the use statsd.
	UseStatsdEnvVar = "USE_STATSD"
	// ForceStartWithoutInitialConfigEnvVar enables start the ratelimit server without initial config.
	ForceStartWithoutInitialConfigEnvVar = "FORCE_START_WITHOUT_INITIAL_CONFIG"
	// ConfigTypeEnvVar is the configuration loading method for ratelimit.
	ConfigTypeEnvVar = "CONFIG_TYPE"
	// ConfigGrpcXdsServerURLEnvVar is the url of ratelimit config xds server.
	ConfigGrpcXdsServerURLEnvVar = "CONFIG_GRPC_XDS_SERVER_URL"
	// ConfigGrpcXdsNodeIDEnvVar is the id of ratelimit node.
	ConfigGrpcXdsNodeIDEnvVar = "CONFIG_GRPC_XDS_NODE_ID"

	// InfraName is the name for rate-limit resources.
	InfraName = "envoy-ratelimit"
	// InfraGRPCPort is the grpc port that the rate limit service listens on.
	InfraGRPCPort = 8081
	// XdsGrpcSotwConfigServerPort is the listening port of the ratelimit xDS config server.
	XdsGrpcSotwConfigServerPort = 18001
	// XdsGrpcSotwConfigServerHost is the hostname of the ratelimit xDS config server.
	XdsGrpcSotwConfigServerHost = "envoy-gateway"
	// ReadinessPath is readiness path for readiness probe.
	ReadinessPath = "/healthcheck"
	// ReadinessPort is readiness port for readiness probe.
	ReadinessPort  = 8080
	StatsdPort     = 9125
	PrometheusPort = 19001
)
View Source
const (
	ResourceKindService        = "Service"
	ResourceKindDeployment     = "Deployment"
	ResourceKindServiceAccount = "ServiceAccount"
)

ResourceKind indicates the main resources of envoy-ratelimit, but also the key for the uid of their ownerReference.

Variables

This section is empty.

Functions

func GetServiceURL

func GetServiceURL(namespace string, dnsDomain string) string

GetServiceURL returns the URL for the rate limit service.

func LabelSelector added in v1.0.0

func LabelSelector() []string

LabelSelector returns the string slice form labels used for all envoy rate limit resources.

func Validate

func Validate(ctx context.Context, client client.Client, gateway *egv1a1.EnvoyGateway, namespace string) error

Validate the ratelimit tls secret validating.

Types

type ResourceRender

type ResourceRender struct {
	// Namespace is the Namespace used for managed infra.
	Namespace string
	// contains filtered or unexported fields
}

func NewResourceRender

func NewResourceRender(ns string, gateway *egv1a1.EnvoyGateway, ownerReferenceUID map[string]types.UID) *ResourceRender

NewResourceRender returns a new ResourceRender.

func (*ResourceRender) ConfigMap

func (r *ResourceRender) ConfigMap() (*corev1.ConfigMap, error)

ConfigMap returns the expected rate limit ConfigMap based on the provided infra.

func (*ResourceRender) Deployment

func (r *ResourceRender) Deployment() (*appsv1.Deployment, error)

Deployment returns the expected rate limit Deployment based on the provided infra.

func (*ResourceRender) HorizontalPodAutoscaler added in v1.0.0

func (r *ResourceRender) HorizontalPodAutoscaler() (*autoscalingv2.HorizontalPodAutoscaler, error)

func (*ResourceRender) Name

func (r *ResourceRender) Name() string

func (*ResourceRender) Service

func (r *ResourceRender) Service() (*corev1.Service, error)

Service returns the expected rate limit Service based on the provided infra.

func (*ResourceRender) ServiceAccount

func (r *ResourceRender) ServiceAccount() (*corev1.ServiceAccount, error)

ServiceAccount returns the expected rateLimit serviceAccount.

Jump to

Keyboard shortcuts

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