ratelimit

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 19 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"
	// TracingEnabledVar is enabled the tracing feature
	TracingEnabledVar = "TRACING_ENABLED"
	// TracingServiceNameVar is service name appears in tracing span
	TracingServiceNameVar = "TRACING_SERVICE_NAME"
	// TracingServiceNamespaceVar is service namespace appears in tracing span
	TracingServiceNamespaceVar = "TRACING_SERVICE_NAMESPACE"
	// TracingServiceInstanceIDVar is service instance id appears in tracing span
	TracingServiceInstanceIDVar = "TRACING_SERVICE_INSTANCE_ID"
	// TracingSamplingRateVar is trace sampling rate
	TracingSamplingRateVar = "TRACING_SAMPLING_RATE"
	// OTELExporterOTLPTraceEndpointVar is target url to which the trace exporter is going to send
	OTELExporterOTLPTraceEndpointVar = "OTEL_EXPORTER_OTLP_ENDPOINT"

	// 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) DaemonSet added in v1.1.0

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

TODO: implement this method

func (*ResourceRender) DaemonSetSpec added in v1.1.3

func (r *ResourceRender) DaemonSetSpec() (*egv1a1.KubernetesDaemonSetSpec, error)

DaemonSetSpec returns the `DaemonSet` sets spec.

func (*ResourceRender) Deployment

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

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

func (*ResourceRender) DeploymentSpec added in v1.1.3

func (r *ResourceRender) DeploymentSpec() (*egv1a1.KubernetesDeploymentSpec, error)

DeploymentSpec returns the `Deployment` sets spec.

func (*ResourceRender) HorizontalPodAutoscaler added in v1.0.0

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

func (*ResourceRender) HorizontalPodAutoscalerSpec added in v1.1.3

func (r *ResourceRender) HorizontalPodAutoscalerSpec() (*egv1a1.KubernetesHorizontalPodAutoscalerSpec, error)

HorizontalPodAutoscalerSpec returns the `HorizontalPodAutoscaler` sets spec.

func (*ResourceRender) Name

func (r *ResourceRender) Name() string

func (*ResourceRender) PodDisruptionBudget added in v1.1.0

func (r *ResourceRender) PodDisruptionBudget() (*policyv1.PodDisruptionBudget, error)

func (*ResourceRender) PodDisruptionBudgetSpec added in v1.1.3

func (r *ResourceRender) PodDisruptionBudgetSpec() (*egv1a1.KubernetesPodDisruptionBudgetSpec, error)

PodDisruptionBudgetSpec returns the `PodDisruptionBudget` sets spec.

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