1// Copyright 2019 Istio Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15// Package envvar is the package for Galley-wide environment variables. 16package envvar 17 18import ( 19 "time" 20 21 "istio.io/pkg/env" 22) 23 24var ( 25 // AuthzFailureLogBurstSize is used to limit logging rate of authz failures. This controls how 26 // many authz failures are logs as a burst every AUTHZ_FAILURE_LOG_FREQ. 27 AuthzFailureLogBurstSize = env.RegisterIntVar("AUTHZ_FAILURE_LOG_BURST_SIZE", 1, "") 28 29 // AuthzFailureLogFreq is used to limit logging rate of authz failures. This controls how 30 // frequently bursts of authz failures are logged. 31 AuthzFailureLogFreq = env.RegisterDurationVar("AUTHZ_FAILURE_LOG_FREQ", time.Minute, "") 32 33 // SourceServerStreamBurstSize is the burst size to be used for rate limiting in the source server 34 // to control how many streams can be estabilished per SOURCE_SERVER_STREAM_FREQ 35 SourceServerStreamBurstSize = env.RegisterIntVar("SOURCE_SERVER_STREAM_BURST_SIZE", 100, "") 36 37 // SourceServerStreamFreq is the frequency that is used by the rate limiter in Source Server Stream 38 SourceServerStreamFreq = env.RegisterDurationVar("SOURCE_SERVER_STREAM_FREQ", time.Second, "") 39 40 // MCPSourceReqBurstSize is the burst size to be used for rate limiting in the MCP sources to control number of 41 // requests processed per stream every MCP_SOURCE_REQ_FREQ 42 MCPSourceReqBurstSize = env.RegisterIntVar("MCP_SOURCE_REQ_BURST_SIZE", 100, "") 43 44 // MCPSourceReqFreq is the frequency that is used by the rate limiter in MCP Sources 45 MCPSourceReqFreq = env.RegisterDurationVar("MCP_SOURCE_REQ_FREQ", time.Second, "") 46 47 // EnableIncrementalMCP is an option to enable incremental mcp 48 EnableIncrementalMCP = env.RegisterBoolVar("ENABLE_INCREMENTAL_MCP", false, "") 49) 50 51// RegisteredEnvVarNames returns the names of registered environment variables. 52func RegisteredEnvVarNames() []string { 53 return []string{ 54 // AuthFailure RateLimiter 55 AuthzFailureLogFreq.Name, 56 AuthzFailureLogBurstSize.Name, 57 // SourceServer RateLimiter 58 SourceServerStreamBurstSize.Name, 59 SourceServerStreamFreq.Name, 60 // MCP Source RateLimiter 61 MCPSourceReqBurstSize.Name, 62 MCPSourceReqFreq.Name, 63 } 64} 65