서비스 보호 정책 설정 참조
서비스 보호 정책 설정 참조 (Service Protection Policy Configuration Reference)
이 문서는 Kong의 서비스 보호 정책(Service Protection Policy)에서 설정할 수 있는 옵션들을 스키마 형태로 정리한 구성 참조 자료예요
출처: 문서
본문
{
"properties": {
"config": {
"type": "object",
"properties": {
"retry_after_jitter_max": {
"type": "number",
"description": "The upper bound of a jitter (random delay) in seconds to be added to the `Retry-After` header of denied requests (status = `429`) in order to prevent all the clients from coming back at the same time. The lower bound of the jitter is `0`; in this case, the `Retry-After` header is equal to the `RateLimit-Reset` header.",
"default": 0
},
"redis": {
"type": "object",
"properties": {
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1",
"x-referenceable": true
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379,
"x-referenceable": true
},
"database": {
"type": "integer",
"description": "Database to use for the Redis connection when using the `redis` strategy",
"default": 0
},
"sentinel_master": {
"type": "string",
"description": "Sentinel master to use for Redis connections. Defining this value implies using Redis Sentinel."
},
"cluster_max_redirections": {
"type": "integer",
"description": "Maximum retry attempts for redirection.",
"default": 5
},
"connection_is_proxied": {
"type": "boolean",
"description": "If the connection to Redis is proxied (e.g. Envoy), set it `true`. Set the `host` and `port` to point to the proxy address.",
"default": false
},
"connect_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"read_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"sentinel_password": {
"type": "string",
"description": "Sentinel password to authenticate with a Redis Sentinel instance. If undefined, no AUTH commands are sent to Redis Sentinels.",
"x-referenceable": true,
"x-encrypted": true
},
"cloud_authentication": {
"type": "object",
"properties": {
"auth_provider": {
"type": "string",
"enum": [
"aws",
"azure",
"gcp"
],
"description": "Auth providers to be used to authenticate to a Cloud Provider's Redis instance.",
"x-referenceable": true
},
"aws_region": {
"type": "string",
"description": "The region of the AWS ElastiCache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
},
"aws_is_serverless": {
"type": "boolean",
"description": "This flag specifies whether the cluster is serverless when auth_provider is set to `aws`.",
"default": true
},
"aws_access_key_id": {
"type": "string",
"description": "AWS Access Key ID to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_secret_access_key": {
"type": "string",
"description": "AWS Secret Access Key to be used for authentication when `auth_provider` is set to `aws`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_id": {
"type": "string",
"description": "Azure Client ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"azure_client_secret": {
"type": "string",
"description": "Azure Client Secret to be used for authentication when `auth_provider` is set to `azure`.",
"x-encrypted": true,
"x-referenceable": true
},
"azure_tenant_id": {
"type": "string",
"description": "Azure Tenant ID to be used for authentication when `auth_provider` is set to `azure`.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_cache_name": {
"type": "string",
"description": "The name of the AWS Elasticache cluster when `auth_provider` is set to `aws`.",
"x-referenceable": true
},
"aws_assume_role_arn": {
"type": "string",
"description": "The ARN of the IAM role to assume for generating ElastiCache IAM authentication tokens.",
"x-referenceable": true,
"x-encrypted": true
},
"aws_role_session_name": {
"type": "string",
"description": "The session name for the temporary credentials when assuming the IAM role.",
"x-referenceable": true,
"x-encrypted": true
},
"gcp_service_account_json": {
"type": "string",
"description": "GCP Service Account JSON to be used for authentication when `auth_provider` is set to `gcp`.",
"x-referenceable": true,
"x-encrypted": true
}
},
"description": "Cloud auth related configs for connecting to a Cloud Provider's Redis instance."
},
"sentinel_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"host": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Sentinel node addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Sentinel. The minimum length of the array is 1 element."
},
"username": {
"type": "string",
"description": "Username to use for Redis connections. If undefined, ACL authentication won't be performed. This requires Redis v6.0.0+. To be compatible with Redis v5.x.y, you can set it to `default`.",
"x-referenceable": true
},
"sentinel_username": {
"type": "string",
"description": "Sentinel username to authenticate with a Redis Sentinel instance. If undefined, ACL authentication won't be performed. This requires Redis v6.2.0+.",
"x-referenceable": true
},
"keepalive_pool_size": {
"type": "integer",
"maximum": 2147483646,
"minimum": 1,
"description": "The size limit for every cosocket connection pool associated with every remote server, per worker process. If neither `keepalive_pool_size` nor `keepalive_backlog` is specified, no pool is created. If `keepalive_pool_size` isn't specified but `keepalive_backlog` is specified, then the pool uses the default value. Try to increase (e.g. 512) this value if latency is high or throughput is low.",
"default": 256
},
"sentinel_role": {
"type": "string",
"enum": [
"any",
"master",
"slave"
],
"description": "Sentinel role to use for Redis connections when the `redis` strategy is defined. Defining this value implies using Redis Sentinel."
},
"ssl": {
"type": "boolean",
"description": "If set to true, uses SSL to connect to Redis.",
"default": false
},
"send_timeout": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "An integer representing a timeout in milliseconds. Must be between 0 and 2^31-2.",
"default": 2000
},
"password": {
"type": "string",
"description": "Password to use for Redis connections. If undefined, no AUTH commands are sent to Redis.",
"x-referenceable": true,
"x-encrypted": true
},
"keepalive_backlog": {
"type": "integer",
"maximum": 2147483646,
"minimum": 0,
"description": "Limits the total number of opened connections for a pool. If the connection pool is full, connection queues above the limit go into the backlog queue. If the backlog queue is full, subsequent connect operations fail and return `nil`. Queued operations (subject to set timeouts) resume once the number of connections in the pool is less than `keepalive_pool_size`. If latency is high or throughput is low, try increasing this value. Empirically, this value is larger than `keepalive_pool_size`."
},
"cluster_nodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"ip": {
"type": "string",
"description": "A string representing a host name, such as example.com.",
"default": "127.0.0.1"
},
"port": {
"type": "integer",
"maximum": 65535,
"minimum": 0,
"description": "An integer representing a port number between 0 and 65535, inclusive.",
"default": 6379
}
}
},
"minLength": 1,
"description": "Cluster addresses to use for Redis connections when the `redis` strategy is defined. Defining this field implies using a Redis Cluster. The minimum length of the array is 1 element."
},
"ssl_verify": {
"type": "boolean",
"description": "If set to true, verifies the validity of the server SSL certificate. If setting this parameter, also configure `lua_ssl_trusted_certificate` in `kong.conf` to specify the CA (or server) certificate used by your Redis server. You may also need to configure `lua_ssl_verify_depth` accordingly.",
"default": true
},
"server_name": {
"type": "string",
"description": "A string representing an SNI (server name indication) value for TLS.",
"x-referenceable": true
}
}
},
"disable_penalty": {
"type": "boolean",
"description": "If set to `true`, this doesn't count denied requests (status = `429`). If set to `false`, all requests, including denied ones, are counted. This parameter only affects the `sliding` window_type.",
"default": false
},
"error_code": {
"type": "number",
"description": "Set a custom error code to return when the rate limit is exceeded.",
"default": 429
},
"sync_rate": {
"type": "number",
"description": "How often to sync counter data to the central data store. A value of 0 results in synchronous behavior; a value of -1 ignores sync behavior entirely and only stores counters in node memory. A value greater than 0 will sync the counters in the specified number of seconds. The minimum allowed interval is 0.02 seconds (20ms)."
},
"namespace": {
"type": "string",
"description": "The rate limiting library namespace to use for this policy instance. Counter data and sync configuration is isolated in each namespace. NOTE: For the policy instances sharing the same namespace, all the configurations that are required for synchronizing counters, e.g. `strategy`, `redis`, `sync_rate`, `dictionary_name`, need to be the same."
},
"dictionary_name": {
"type": "string",
"description": "The shared dictionary where counters are stored. When the policy is configured to synchronize counter data externally (that is `config.strategy` is `cluster` or `redis` and `config.sync_rate` isn't `-1`), this dictionary serves as a buffer to populate counters in the data store on each synchronization cycle.",
"default": "kong_rate_limiting_counters"
},
"lock_dictionary_name": {
"type": "string",
"description": "The shared dictionary where concurrency control locks are stored. The default shared dictionary is `kong_locks`. The shared dictionary should be declared in nginx-kong.conf.",
"default": "kong_locks"
},
"hide_client_headers": {
"type": "boolean",
"description": "Optionally hide informative response headers that would otherwise provide information about the current status of limits and counters.",
"default": false
},
"error_message": {
"type": "string",
"description": "Set a custom error message to return when the rate limit is exceeded.",
"default": "API rate limit exceeded"
},
"window_size": {
"type": "array",
"items": {
"type": "number"
},
"description": "One or more window sizes to apply a limit to (defined in seconds). There must be a matching number of window limits and sizes specified."
},
"window_type": {
"type": "string",
"enum": [
"fixed",
"sliding"
],
"description": "Sets the time window type to either `sliding` (default) or `fixed`. Sliding windows apply the rate limiting logic while taking into account previous hit rates (from the window that immediately precedes the current) using a dynamic weight. Fixed windows consist of buckets that are statically assigned to a definitive time range, each request is mapped to only one fixed window based on its timestamp and will affect only that window's counters.",
"default": "sliding"
},
"limit": {
"type": "array",
"items": {
"type": "number"
},
"description": "One or more requests-per-window limits to apply. There must be a matching number of window limits and sizes specified."
},
"strategy": {
"type": "string",
"enum": [
"cluster",
"local",
"redis"
],
"description": "The rate-limiting strategy to use for retrieving and incrementing the limits. Available values are: `local`, `redis` and `cluster`.",
"default": "local"
}
},
"required": [
"limit",
"window_size"
]
}
}
}
더 알아보기 (Learn more)
이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.