---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: httplocalratelimitpolicies.policy.linkerd.io
  annotations:
    {{ include "partials.annotations.created-by" . }}
  labels:
    helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
    linkerd.io/control-plane-ns: {{.Release.Namespace}}
spec:
  group: policy.linkerd.io
  names:
    kind: HTTPLocalRateLimitPolicy
    listKind: HTTPLocalRateLimitPolicyList
    plural: httplocalratelimitpolicies
    singular: httplocalratelimitpolicy
  scope: Namespaced
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      schema:
        openAPIV3Schema:
          type: object
          required: [spec]
          properties:
            spec:
              type: object
              required: [targetRef]
              properties:
                targetRef:
                  description: >-
                    TargetRef references a resource to which the rate limit
                    policy applies. Only Server is allowed.
                  type: object
                  required: [kind, name]
                  properties:
                    group:
                      description: >-
                        Group is the group of the referent. When empty, the
                        Kubernetes core API group is inferred.
                      maxLength: 253
                      pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
                      type: string
                    kind:
                      description: Kind is the kind of the referent.
                      maxLength: 63
                      minLength: 1
                      pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
                      type: string
                    name:
                      description: Name is the name of the referent.
                      maxLength: 253
                      minLength: 1
                      type: string
                total:
                  description: >-
                    Overall rate-limit, which all traffic coming to this
                    target should abide.
                    If unset no overall limit is applied.
                  type: object
                  required: [requestsPerSecond]
                  properties:
                    requestsPerSecond:
                      format: int64
                      type: integer
                identity:
                  description: >-
                    Fairness for individual identities; each separate client,
                    grouped by identity, will have this rate-limit. The
                    requestsPerSecond value should be less than or equal to the
                    total requestsPerSecond (if set).
                  type: object
                  required: [requestsPerSecond]
                  properties:
                    requestsPerSecond:
                      format: int64
                      type: integer
                overrides:
                  description: >-
                    Overrides for traffic from a specific client. The
                    requestsPerSecond value should be less than or equal to the
                    total requestsPerSecond (if set).
                  type: array
                  items:
                    type: object
                    required: [requestsPerSecond, clientRefs]
                    properties:
                      requestsPerSecond:
                        format: int64
                        type: integer
                      clientRefs:
                        type: array
                        items:
                          type: object
                          required: [kind, name]
                          properties:
                            group:
                              description: >-
                                Group is the group of the referent. When empty, the
                                Kubernetes core API group is inferred.
                              maxLength: 253
                              pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
                              type: string
                            kind:
                              description: Kind is the kind of the referent.
                              maxLength: 63
                              minLength: 1
                              pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
                              type: string
                            namespace:
                              description: >-
                                  Namespace is the namespace of the referent.
                                  When unspecified (or empty string), this refers to the
                                  local namespace of the Policy.
                              maxLength: 63
                              minLength: 1
                              pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
                              type: string
                            name:
                              description: Name is the name of the referent.
                              maxLength: 253
                              minLength: 1
                              type: string
            status:
              type: object
              properties:
                conditions:
                  type: array
                  items:
                    type: object
                    properties:
                      lastTransitionTime:
                        description: lastTransitionTime is the last time the
                          condition transitioned from one status to another.
                        format: date-time
                        type: string
                      status:
                        description: status of the condition (one of True, False, Unknown)
                        enum:
                        - "True"
                        - "False"
                        - Unknown
                        type: string
                      type:
                        description: type of the condition in CamelCase or in
                          foo.example.com/CamelCase.
                        maxLength: 316
                        pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
                        type: string
                      reason:
                        description: reason contains a programmatic identifier
                          indicating the reason for the condition's last
                          transition. Producers of specific condition types may
                          define expected values and meanings for this field, and
                          whether the values are considered a guaranteed API. The
                          value should be a CamelCase string. This field may not
                          be empty.
                        maxLength: 1024
                        minLength: 1
                        pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                        type: string
                      message:
                        description: message is a human readable message
                          indicating details about the transition. This may be an
                          empty string.
                        maxLength: 32768
                        type: string
                  required:
                  - status
                  - type
                targetRef:
                  properties:
                    group:
                      default: policy.linkerd.io
                      maxLength: 253
                      pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
                      type: string
                    kind:
                      default: Server
                      maxLength: 63
                      minLength: 1
                      pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
                      type: string
                    name:
                      maxLength: 253
                      minLength: 1
                      type: string
                  required:
                  - name
                  type: object
              required:
              - targetRef
      additionalPrinterColumns:
      - name: Target_kind
        description: The resource kind to which the rate-limit applies
        type: string
        jsonPath: .spec.targetRef.kind
      - name: Target_name
        type: string
        description: The resource name to which the rate-limit applies
        jsonPath: .spec.targetRef.name
      - name: Total_RPS
        description: The overall rate-limit
        type: integer
        format: int32
        jsonPath: .spec.total.requestsPerSecond
      - name: Identity_RPS
        description: The rate-limit per identity
        type: integer
        format: int32
        jsonPath: .spec.identity.requestsPerSecond
