Kgateway HTTPListenerPolicy API

Apply policies to all HTTP and HTTPS listeners defined on a Gateway. Configure listener-level settings that affect all traffic passing through the specified listeners.

OpenAPI Specification

kgateway-httplistenerpolicy-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: kgateway Kubernetes Gateway AIBackend HTTPListenerPolicy API
  description: kgateway is the most widely deployed gateway in Kubernetes for microservices and AI agents. It is a feature-rich, fast, and flexible Kubernetes-native ingress controller and next-generation API gateway built on top of Envoy proxy and the Kubernetes Gateway API. kgateway provides custom resource definitions (CRDs) under the gateway.kgateway.dev API group for configuring traffic policies, backends, direct responses, gateway extensions, gateway parameters, HTTP listener policies, and AI backends. These resources are managed through the Kubernetes API server.
  version: 2.1.0
  contact:
    name: kgateway
    url: https://kgateway.dev
  license:
    name: Apache 2.0
    url: https://github.com/kgateway-dev/kgateway/blob/main/LICENSE
servers:
- url: https://{kubernetes-api-server}/apis/gateway.kgateway.dev/v1alpha1
  description: Kubernetes API Server - kgateway Custom Resources
  variables:
    kubernetes-api-server:
      default: kubernetes.default.svc
      description: The Kubernetes API server hostname
security:
- BearerAuth: []
tags:
- name: HTTPListenerPolicy
  description: Apply policies to all HTTP and HTTPS listeners defined on a Gateway. Configure listener-level settings that affect all traffic passing through the specified listeners.
paths:
  /namespaces/{namespace}/httplistenerpolicies:
    get:
      operationId: listHTTPListenerPolicies
      summary: Kgateway List HTTPListenerPolicy resources
      description: List all HTTPListenerPolicy resources in the specified namespace. HTTPListenerPolicies apply policies to all HTTP and HTTPS listeners on a Gateway.
      tags:
      - HTTPListenerPolicy
      parameters:
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/LabelSelector'
      - $ref: '#/components/parameters/Limit'
      - $ref: '#/components/parameters/Continue'
      responses:
        '200':
          description: Successfully retrieved list of HTTPListenerPolicy resources.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPListenerPolicyList'
        '401':
          description: Unauthorized
    post:
      operationId: createHTTPListenerPolicy
      summary: Kgateway Create an HTTPListenerPolicy
      description: Create an HTTPListenerPolicy resource to apply policies to all HTTP and HTTPS listeners defined on a Gateway.
      tags:
      - HTTPListenerPolicy
      parameters:
      - $ref: '#/components/parameters/Namespace'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HTTPListenerPolicy'
      responses:
        '201':
          description: Successfully created HTTPListenerPolicy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPListenerPolicy'
        '401':
          description: Unauthorized
        '409':
          description: Conflict - resource already exists
  /namespaces/{namespace}/httplistenerpolicies/{name}:
    get:
      operationId: getHTTPListenerPolicy
      summary: Kgateway Get an HTTPListenerPolicy
      description: Retrieve a specific HTTPListenerPolicy resource by name and namespace.
      tags:
      - HTTPListenerPolicy
      parameters:
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/Name'
      responses:
        '200':
          description: Successfully retrieved HTTPListenerPolicy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPListenerPolicy'
        '401':
          description: Unauthorized
        '404':
          description: HTTPListenerPolicy not found
    put:
      operationId: replaceHTTPListenerPolicy
      summary: Kgateway Replace an HTTPListenerPolicy
      description: Replace a specific HTTPListenerPolicy resource.
      tags:
      - HTTPListenerPolicy
      parameters:
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/Name'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HTTPListenerPolicy'
      responses:
        '200':
          description: Successfully replaced HTTPListenerPolicy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPListenerPolicy'
        '401':
          description: Unauthorized
        '404':
          description: HTTPListenerPolicy not found
    delete:
      operationId: deleteHTTPListenerPolicy
      summary: Kgateway Delete an HTTPListenerPolicy
      description: Delete a specific HTTPListenerPolicy resource.
      tags:
      - HTTPListenerPolicy
      parameters:
      - $ref: '#/components/parameters/Namespace'
      - $ref: '#/components/parameters/Name'
      responses:
        '200':
          description: Successfully deleted HTTPListenerPolicy.
        '401':
          description: Unauthorized
        '404':
          description: HTTPListenerPolicy not found
components:
  parameters:
    Name:
      name: name
      in: path
      required: true
      description: The name of the resource.
      schema:
        type: string
    Namespace:
      name: namespace
      in: path
      required: true
      description: The Kubernetes namespace.
      schema:
        type: string
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of resources to return.
      schema:
        type: integer
    Continue:
      name: continue
      in: query
      required: false
      description: Continue token for paginated list requests.
      schema:
        type: string
    LabelSelector:
      name: labelSelector
      in: query
      required: false
      description: A selector to restrict the list of returned objects by labels.
      schema:
        type: string
  schemas:
    ObjectMeta:
      type: object
      description: Standard Kubernetes object metadata.
      properties:
        name:
          type: string
          description: Name of the resource.
        namespace:
          type: string
          description: Namespace of the resource.
        labels:
          type: object
          additionalProperties:
            type: string
          description: Map of string keys and values for organizing resources.
        annotations:
          type: object
          additionalProperties:
            type: string
          description: Annotations for storing arbitrary metadata.
        resourceVersion:
          type: string
          description: An opaque value that represents the internal version of this object.
        creationTimestamp:
          type: string
          format: date-time
          description: Timestamp representing the server time when this object was created.
    PolicyTargetRef:
      type: object
      description: Reference to a target resource for policy attachment.
      properties:
        group:
          type: string
          description: Group is the group of the target resource.
          default: gateway.networking.k8s.io
        kind:
          type: string
          description: Kind is the kind of the target resource.
          enum:
          - Gateway
          - HTTPRoute
        name:
          type: string
          description: Name is the name of the target resource.
        namespace:
          type: string
          description: Namespace is the namespace of the target resource.
        sectionName:
          type: string
          description: SectionName is the name of a section within the target resource to apply the policy to.
      required:
      - kind
      - name
    HTTPListenerPolicy:
      type: object
      description: HTTPListenerPolicy applies policies to all HTTP and HTTPS listeners on a Gateway.
      properties:
        apiVersion:
          type: string
          enum:
          - gateway.kgateway.dev/v1alpha1
        kind:
          type: string
          enum:
          - HTTPListenerPolicy
        metadata:
          $ref: '#/components/schemas/ObjectMeta'
        spec:
          type: object
          description: HTTPListenerPolicySpec defines the desired state of an HTTPListenerPolicy.
          properties:
            targetRefs:
              type: array
              description: References to the Gateway listeners to which this policy applies.
              items:
                $ref: '#/components/schemas/PolicyTargetRef'
            accessLogging:
              type: object
              description: Access logging configuration.
            buffer:
              type: object
              description: Request buffering configuration.
              properties:
                maxRequestBytes:
                  type: integer
                  description: Maximum request body size in bytes.
            celValidation:
              type: object
              description: CEL-based request validation.
              properties:
                rules:
                  type: array
                  items:
                    type: object
                    properties:
                      expression:
                        type: string
                        description: CEL expression to evaluate.
                      action:
                        type: string
                        enum:
                        - Deny
                        - Allow
            basicAuth:
              type: object
              description: Basic authentication configuration.
              properties:
                credentialsSecretRef:
                  type: object
                  description: Reference to a Kubernetes secret containing htpasswd-format credentials.
                  properties:
                    name:
                      type: string
                    namespace:
                      type: string
          required:
          - targetRefs
        status:
          type: object
          description: Status of the HTTPListenerPolicy.
          properties:
            conditions:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                  status:
                    type: string
                  reason:
                    type: string
                  message:
                    type: string
                  lastTransitionTime:
                    type: string
                    format: date-time
    HTTPListenerPolicyList:
      type: object
      description: List of HTTPListenerPolicy resources.
      properties:
        apiVersion:
          type: string
        kind:
          type: string
          enum:
          - HTTPListenerPolicyList
        metadata:
          type: object
          properties:
            continue:
              type: string
            resourceVersion:
              type: string
        items:
          type: array
          items:
            $ref: '#/components/schemas/HTTPListenerPolicy'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Kubernetes API bearer token authentication. Use a service account token or kubeconfig token.
externalDocs:
  description: kgateway API Reference Documentation
  url: https://kgateway.dev/docs/envoy/latest/reference/api/