본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

메시 글로벌 레이트 리밋 정책 설정 레퍼런스

원문 보기 위키 갱신

메시 글로벌 레이트 리밋 정책 설정 레퍼런스 (MeshGlobalRateLimits Policy Configuration Reference)

이 문서는 Kuma 메시에서 메시 전체 단위로 요청 속도를 제한할 때 쓰는 MeshGlobalRateLimit 리소스의 설정 레퍼런스예요. 리소스 전체 구조를 JSON 스키마로 보여주면서, 어떤 클라이언트 그룹에 어떤 기본 레이트 리밋 설정을 적용할지 정의하는 방법을 설명해요. 레이트 리밋 백엔드 서비스의 주소와 타임아웃, 서비스에 접근할 수 없을 때 제한을 적용할지 여부 같은 backend 옵션도 함께 다뤄요. HTTP 트래픽에 레이트 리밋을 켜고 끄는 방법과, 제한에 걸렸을 때 응답에 추가할 헤더 같은 세부 동작까지 설정하는 법을 확인할 수 있어요

출처: 문서

본문

구성

{
  "description": "Spec is the specification of the Kuma MeshGlobalRateLimit resource.",
  "properties": {
    "from": {
      "description": "From list makes a match between clients and corresponding configurations",
      "items": {
        "properties": {
          "default": {
            "description": "Default is a configuration specific to the group of clients referenced in\n'targetRef'",
            "properties": {
              "backend": {
                "description": "Backend defines location of rate limit backend service.",
                "properties": {
                  "rateLimitService": {
                    "properties": {
                      "limitOnServiceFail": {
                        "description": "LimitOnServiceFail will pass limit requests if ratelimit service is not reachable.",
                        "type": "boolean"
                      },
                      "timeout": {
                        "description": "Timeout for rate limit request made form Data Plane Proxy to rate limit service.",
                        "type": "string"
                      },
                      "url": {
                        "description": "Url defines address of rate limit service.",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "rateLimitService"
                ],
                "type": "object"
              },
              "http": {
                "properties": {
                  "disabled": {
                    "description": "Define if rate limiting should be disabled.",
                    "type": "boolean"
                  },
                  "onRateLimit": {
                    "description": "Describes the actions to take on a rate limit event",
                    "properties": {
                      "headers": {
                        "description": "The Headers to be added to the HTTP response on a rate limit event",
                        "properties": {
                          "add": {
                            "items": {
                              "properties": {
                                "name": {
                                  "maxLength": 256,
                                  "minLength": 1,
                                  "pattern": "^[a-z0-9!#$%&'*+\\-.^_\\x60|~]+$",
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ],
                              "type": "object"
                            },
                            "maxItems": 16,
                            "type": "array",
                            "x-kubernetes-list-map-keys": [
                              "name"
                            ],
                            "x-kubernetes-list-type": "map"
                          },
                          "set": {
                            "items": {
                              "properties": {
                                "name": {
                                  "maxLength": 256,
                                  "minLength": 1,
                                  "pattern": "^[a-z0-9!#$%&'*+\\-.^_\\x60|~]+$",
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ],
                              "type": "object"
                            },
                            "maxItems": 16,
                            "type": "array",
                            "x-kubernetes-list-map-keys": [
                              "name"
                            ],
                            "x-kubernetes-list-type": "map"
                          }
                        },
                        "type": "object"
                      },
                      "status": {
                        "description": "The HTTP status code to be set on a rate limit event",
                        "format": "int32",
                        "type": "integer"
                      }
                    },
                    "type": "object"
                  },
                  "ratelimitOnRequest": {
                    "description": "Defines rate limit based on request content",
                    "items": {
                      "properties": {
                        "kind": {
                          "description": "Kind defines type of rate limit config. Possible options: OnHeader.",
                          "enum": [
                            "OnHeader"
                          ],
                          "type": "string"
                        },
                        "limits": {
                          "description": "Limits defines limit configuration.",
                          "items": {
                            "properties": {
                              "requestRate": {
                                "description": "Defines how many requests are allowed per interval.",
                                "properties": {
                                  "interval": {
                                    "description": "The interval the number of units is accounted for. Only 1s, 1m, 1h or 24h can be configured.",
                                    "type": "string"
                                  },
                                  "num": {
                                    "description": "Number of units per interval (depending on usage it can be a number of requests,\nor a number of connections).",
                                    "format": "int32",
                                    "type": "integer"
                                  }
                                },
                                "required": [
                                  "interval",
                                  "num"
                                ],
                                "type": "object"
                              },
                              "value": {
                                "description": "Value of the request element on which rate limit should apply. E.g. header value.",
                                "type": "string"
                              }
                            },
                            "required": [
                              "value"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "name": {
                          "description": "Name of the request element on which rate limit should apply. E.g. header name.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "limits",
                        "name"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "requestRate": {
                    "description": "Defines how many requests are allowed per interval.",
                    "properties": {
                      "interval": {
                        "description": "The interval the number of units is accounted for. Only 1s, 1m, 1h or 24h can be configured.",
                        "type": "string"
                      },
                      "num": {
                        "description": "Number of units per interval (depending on usage it can be a number of requests,\nor a number of connections).",
                        "format": "int32",
                        "type": "integer"
                      }
                    },
                    "required": [
                      "interval",
                      "num"
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "mode": {
                "description": "Mode defines rate limit behavior when limits are reached. Possible options: Limit and Shadow. Setting Shadow will\nnot block over the limit requests but will update metrics. This is useful for testing rate limit configuration.",
                "enum": [
                  "Limit",
                  "Shadow"
                ],
                "type": "string"
              }
            },
            "required": [
              "backend",
              "http"
            ],
            "type": "object"
          },
          "targetRef": {
            "description": "TargetRef is a reference to the resource that represents a group of\nclients.",
            "properties": {
              "kind": {
                "description": "Kind of the referenced resource",
                "enum": [
                  "Mesh",
                  "MeshSubset",
                  "MeshGateway",
                  "MeshService",
                  "MeshExternalService",
                  "MeshMultiZoneService",
                  "MeshServiceSubset",
                  "MeshHTTPRoute",
                  "Dataplane"
                ],
                "type": "string"
              },
              "labels": {
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Labels are used to select group of MeshServices that match labels. Either Labels or\nName and Namespace can be used.",
                "type": "object"
              },
              "mesh": {
                "description": "Mesh is reserved for future use to identify cross mesh resources.",
                "type": "string"
              },
              "name": {
                "description": "Name of the referenced resource. Can only be used with kinds: `MeshService`,\n`MeshServiceSubset` and `MeshGatewayRoute`",
                "type": "string"
              },
              "namespace": {
                "description": "Namespace specifies the namespace of target resource. If empty only resources in policy namespace\nwill be targeted.",
                "type": "string"
              },
              "proxyTypes": {
                "description": "ProxyTypes specifies the data plane types that are subject to the policy. When not specified,\nall data plane types are targeted by the policy.",
                "items": {
                  "enum": [
                    "Sidecar",
                    "Gateway"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "sectionName": {
                "description": "SectionName is used to target specific section of resource.\nFor example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.",
                "type": "string"
              },
              "tags": {
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Tags used to select a subset of proxies by tags. Can only be used with kinds\n`MeshSubset` and `MeshServiceSubset`",
                "type": "object"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          }
        },
        "required": [
          "targetRef"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "targetRef": {
      "description": "TargetRef is a reference to the resource the policy takes an effect on.\nThe resource could be either a real store object or virtual resource\ndefined inplace.",
      "properties": {
        "kind": {
          "description": "Kind of the referenced resource",
          "enum": [
            "Mesh",
            "MeshSubset",
            "MeshGateway",
            "MeshService",
            "MeshExternalService",
            "MeshMultiZoneService",
            "MeshServiceSubset",
            "MeshHTTPRoute",
            "Dataplane"
          ],
          "type": "string"
        },
        "labels": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Labels are used to select group of MeshServices that match labels. Either Labels or\nName and Namespace can be used.",
          "type": "object"
        },
        "mesh": {
          "description": "Mesh is reserved for future use to identify cross mesh resources.",
          "type": "string"
        },
        "name": {
          "description": "Name of the referenced resource. Can only be used with kinds: `MeshService`,\n`MeshServiceSubset` and `MeshGatewayRoute`",
          "type": "string"
        },
        "namespace": {
          "description": "Namespace specifies the namespace of target resource. If empty only resources in policy namespace\nwill be targeted.",
          "type": "string"
        },
        "proxyTypes": {
          "description": "ProxyTypes specifies the data plane types that are subject to the policy. When not specified,\nall data plane types are targeted by the policy.",
          "items": {
            "enum": [
              "Sidecar",
              "Gateway"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "sectionName": {
          "description": "SectionName is used to target specific section of resource.\nFor example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.",
          "type": "string"
        },
        "tags": {
          "additionalProperties": {
            "type": "string"
          },
          "description": "Tags used to select a subset of proxies by tags. Can only be used with kinds\n`MeshSubset` and `MeshServiceSubset`",
          "type": "object"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "to": {
      "description": "To list makes a match between clients and corresponding configurations",
      "items": {
        "properties": {
          "default": {
            "description": "Default is a configuration specific to the group of clients referenced in\n'targetRef'",
            "properties": {
              "backend": {
                "description": "Backend defines location of rate limit backend service.",
                "properties": {
                  "rateLimitService": {
                    "properties": {
                      "limitOnServiceFail": {
                        "description": "LimitOnServiceFail will pass limit requests if ratelimit service is not reachable.",
                        "type": "boolean"
                      },
                      "timeout": {
                        "description": "Timeout for rate limit request made form Data Plane Proxy to rate limit service.",
                        "type": "string"
                      },
                      "url": {
                        "description": "Url defines address of rate limit service.",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  }
                },
                "required": [
                  "rateLimitService"
                ],
                "type": "object"
              },
              "http": {
                "properties": {
                  "disabled": {
                    "description": "Define if rate limiting should be disabled.",
                    "type": "boolean"
                  },
                  "onRateLimit": {
                    "description": "Describes the actions to take on a rate limit event",
                    "properties": {
                      "headers": {
                        "description": "The Headers to be added to the HTTP response on a rate limit event",
                        "properties": {
                          "add": {
                            "items": {
                              "properties": {
                                "name": {
                                  "maxLength": 256,
                                  "minLength": 1,
                                  "pattern": "^[a-z0-9!#$%&'*+\\-.^_\\x60|~]+$",
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ],
                              "type": "object"
                            },
                            "maxItems": 16,
                            "type": "array",
                            "x-kubernetes-list-map-keys": [
                              "name"
                            ],
                            "x-kubernetes-list-type": "map"
                          },
                          "set": {
                            "items": {
                              "properties": {
                                "name": {
                                  "maxLength": 256,
                                  "minLength": 1,
                                  "pattern": "^[a-z0-9!#$%&'*+\\-.^_\\x60|~]+$",
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "name",
                                "value"
                              ],
                              "type": "object"
                            },
                            "maxItems": 16,
                            "type": "array",
                            "x-kubernetes-list-map-keys": [
                              "name"
                            ],
                            "x-kubernetes-list-type": "map"
                          }
                        },
                        "type": "object"
                      },
                      "status": {
                        "description": "The HTTP status code to be set on a rate limit event",
                        "format": "int32",
                        "type": "integer"
                      }
                    },
                    "type": "object"
                  },
                  "ratelimitOnRequest": {
                    "description": "Defines rate limit based on request content",
                    "items": {
                      "properties": {
                        "kind": {
                          "description": "Kind defines type of rate limit config. Possible options: OnHeader.",
                          "enum": [
                            "OnHeader"
                          ],
                          "type": "string"
                        },
                        "limits": {
                          "description": "Limits defines limit configuration.",
                          "items": {
                            "properties": {
                              "requestRate": {
                                "description": "Defines how many requests are allowed per interval.",
                                "properties": {
                                  "interval": {
                                    "description": "The interval the number of units is accounted for. Only 1s, 1m, 1h or 24h can be configured.",
                                    "type": "string"
                                  },
                                  "num": {
                                    "description": "Number of units per interval (depending on usage it can be a number of requests,\nor a number of connections).",
                                    "format": "int32",
                                    "type": "integer"
                                  }
                                },
                                "required": [
                                  "interval",
                                  "num"
                                ],
                                "type": "object"
                              },
                              "value": {
                                "description": "Value of the request element on which rate limit should apply. E.g. header value.",
                                "type": "string"
                              }
                            },
                            "required": [
                              "value"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "name": {
                          "description": "Name of the request element on which rate limit should apply. E.g. header name.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "kind",
                        "limits",
                        "name"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "requestRate": {
                    "description": "Defines how many requests are allowed per interval.",
                    "properties": {
                      "interval": {
                        "description": "The interval the number of units is accounted for. Only 1s, 1m, 1h or 24h can be configured.",
                        "type": "string"
                      },
                      "num": {
                        "description": "Number of units per interval (depending on usage it can be a number of requests,\nor a number of connections).",
                        "format": "int32",
                        "type": "integer"
                      }
                    },
                    "required": [
                      "interval",
                      "num"
                    ],
                    "type": "object"
                  }
                },
                "type": "object"
              },
              "mode": {
                "description": "Mode defines rate limit behavior when limits are reached. Possible options: Limit and Shadow. Setting Shadow will\nnot block over the limit requests but will update metrics. This is useful for testing rate limit configuration.",
                "enum": [
                  "Limit",
                  "Shadow"
                ],
                "type": "string"
              }
            },
            "required": [
              "backend",
              "http"
            ],
            "type": "object"
          },
          "targetRef": {
            "description": "TargetRef is a reference to the resource that represents a group of\nclients.",
            "properties": {
              "kind": {
                "description": "Kind of the referenced resource",
                "enum": [
                  "Mesh",
                  "MeshSubset",
                  "MeshGateway",
                  "MeshService",
                  "MeshExternalService",
                  "MeshMultiZoneService",
                  "MeshServiceSubset",
                  "MeshHTTPRoute",
                  "Dataplane"
                ],
                "type": "string"
              },
              "labels": {
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Labels are used to select group of MeshServices that match labels. Either Labels or\nName and Namespace can be used.",
                "type": "object"
              },
              "mesh": {
                "description": "Mesh is reserved for future use to identify cross mesh resources.",
                "type": "string"
              },
              "name": {
                "description": "Name of the referenced resource. Can only be used with kinds: `MeshService`,\n`MeshServiceSubset` and `MeshGatewayRoute`",
                "type": "string"
              },
              "namespace": {
                "description": "Namespace specifies the namespace of target resource. If empty only resources in policy namespace\nwill be targeted.",
                "type": "string"
              },
              "proxyTypes": {
                "description": "ProxyTypes specifies the data plane types that are subject to the policy. When not specified,\nall data plane types are targeted by the policy.",
                "items": {
                  "enum": [
                    "Sidecar",
                    "Gateway"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "sectionName": {
                "description": "SectionName is used to target specific section of resource.\nFor example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.",
                "type": "string"
              },
              "tags": {
                "additionalProperties": {
                  "type": "string"
                },
                "description": "Tags used to select a subset of proxies by tags. Can only be used with kinds\n`MeshSubset` and `MeshServiceSubset`",
                "type": "object"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          }
        },
        "required": [
          "targetRef"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}

더 알아보기 (Learn more)

이 문서에는 원문에서 추출한 별도의 관련 문서 링크가 없어요.