---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.21.0
  name: quantityledgers.capsule.clastix.io
spec:
  group: capsule.clastix.io
  names:
    kind: QuantityLedger
    listKind: QuantityLedgerList
    plural: quantityledgers
    shortNames:
    - ql
    singular: quantityledger
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.targetRef.kind
      name: TargetKind
      type: string
    - jsonPath: .spec.targetRef.namespace
      name: TargetNamespace
      type: string
    - jsonPath: .spec.targetRef.name
      name: TargetName
      type: string
    - jsonPath: .status.reserved
      name: Reserved
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1beta2
    schema:
      openAPIV3Schema:
        properties:
          apiVersion:
            description: |-
              APIVersion defines the versioned schema of this representation of an object.
              Servers should convert recognized schemas to the latest internal value, and
              may reject unrecognized values.
              More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
            type: string
          kind:
            description: |-
              Kind is a string value representing the REST resource this object represents.
              Servers may infer this from the endpoint the client submits requests to.
              Cannot be updated.
              In CamelCase.
              More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
            type: string
          metadata:
            type: object
          spec:
            description: QuotaLedgerSpec contains the immutable target reference.
            properties:
              targetRef:
                description: TargetRef points to the quota object that this ledger
                  belongs to.
                properties:
                  apiGroup:
                    description: APIGroup of the target quota resource, for example
                      "capsule.clastix.io".
                    type: string
                  kind:
                    description: Kind of the target quota resource, for example "CustomQuota"
                      or "GlobalCustomQuota".
                    minLength: 1
                    type: string
                  name:
                    description: Name of the target quota resource.
                    minLength: 1
                    type: string
                  namespace:
                    description: |-
                      Namespace of the target quota resource.
                      Must be empty for cluster-scoped targets.
                    type: string
                  uid:
                    description: |-
                      UID of the target quota resource.
                      Optional, but useful for stale reference detection.
                    type: string
                required:
                - kind
                - name
                type: object
            required:
            - targetRef
            type: object
          status:
            description: |-
              QuantityLedgerStatus contains the mutable coordination state used by admission
              and quota controllers.
            properties:
              allocated:
                anyOf:
                - type: integer
                - type: string
                description: |-
                  Allocated is the admission-owned total that has been accepted by the webhook.
                  It must be updated only through optimistic concurrency on QuantityLedger.
                pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                x-kubernetes-int-or-string: true
              conditions:
                description: Conditions for the resource claim
                items:
                  description: Condition contains details for one aspect of the current
                    state of this API Resource.
                  properties:
                    lastTransitionTime:
                      description: |-
                        lastTransitionTime is the last time the condition transitioned from one status to another.
                        This should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.
                      format: date-time
                      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
                    observedGeneration:
                      description: |-
                        observedGeneration represents the .metadata.generation that the condition was set based upon.
                        For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
                        with respect to the current state of the instance.
                      format: int64
                      minimum: 0
                      type: integer
                    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
                    status:
                      description: status of the condition, one of True, False, Unknown.
                      enum:
                      - "True"
                      - "False"
                      - Unknown
                      type: string
                    type:
                      description: type of 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
                  required:
                  - lastTransitionTime
                  - message
                  - reason
                  - status
                  - type
                  type: object
                type: array
              pendingDeletes:
                description: Pending delete hints carried over from admission delete
                  handling.
                items:
                  description: |-
                    QuantityLedgerPendingDelete tracks objects that are expected to disappear from claims
                    soon, but may still temporarily appear during rebuild due to propagation delay.
                  properties:
                    createdAt:
                      format: date-time
                      type: string
                    id:
                      description: |-
                        ID identifies the admission request that added this hint. It allows a
                        failed multi-quota admission to roll back only its own hint.
                      type: string
                    objectRef:
                      description: |-
                        QuotaLedgerObjectRef identifies the object for which a reservation exists.
                        UID may be empty for CREATE admission before the object is persisted.
                      properties:
                        apiGroup:
                          description: APIGroup of the tracked object.
                          type: string
                        apiVersion:
                          description: APIVersion of the tracked object, for example
                            "v1".
                          minLength: 1
                          type: string
                        kind:
                          description: Kind of the tracked object, for example "Pod".
                          minLength: 1
                          type: string
                        name:
                          description: Name of the tracked object.
                          type: string
                        namespace:
                          description: Namespace of the tracked object.
                          type: string
                        uid:
                          description: UID of the tracked object.
                          type: string
                      required:
                      - apiVersion
                      - kind
                      type: object
                  required:
                  - createdAt
                  - objectRef
                  type: object
                type: array
              reservations:
                description: Active inflight reservations for this quota.
                items:
                  description: |-
                    QuantityLedgerReservation represents one active inflight reservation.
                    ID should be stable for retries of the same admission request.
                    In practice, admission.Request.UID is a good default.
                  properties:
                    createdAt:
                      description: Time the reservation was first created.
                      format: date-time
                      type: string
                    delta:
                      anyOf:
                      - type: integer
                      - type: string
                      description: |-
                        Delta is the additional amount held against the quota while the admitted
                        object is materializing. For creates this is normally equal to Usage. For
                        updates it is max(newUsage-oldUsage, 0), so admission never releases
                        capacity before the API server has persisted the update.

                        A nil value is interpreted as Usage for backwards compatibility with
                        ledgers written before this field was introduced.
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                    expiresAt:
                      description: Time after which the reservation may be considered
                        stale.
                      format: date-time
                      type: string
                    id:
                      description: Unique reservation identifier.
                      minLength: 1
                      type: string
                    objectRef:
                      description: Object that this reservation is intended to create/update.
                      properties:
                        apiGroup:
                          description: APIGroup of the tracked object.
                          type: string
                        apiVersion:
                          description: APIVersion of the tracked object, for example
                            "v1".
                          minLength: 1
                          type: string
                        kind:
                          description: Kind of the tracked object, for example "Pod".
                          minLength: 1
                          type: string
                        name:
                          description: Name of the tracked object.
                          type: string
                        namespace:
                          description: Namespace of the tracked object.
                          type: string
                        uid:
                          description: UID of the tracked object.
                          type: string
                      required:
                      - apiVersion
                      - kind
                      type: object
                    updatedAt:
                      description: Time the reservation was last refreshed or updated.
                      format: date-time
                      type: string
                    usage:
                      anyOf:
                      - type: integer
                      - type: string
                      description: Amount reserved for this request.
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                  required:
                  - createdAt
                  - id
                  - objectRef
                  - updatedAt
                  - usage
                  type: object
                type: array
              reserved:
                anyOf:
                - type: integer
                - type: string
                description: |-
                  Reserved is the aggregate sum of all active reservations.
                  Controllers/webhooks should treat this as derived data from Reservations.
                pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                x-kubernetes-int-or-string: true
              resourceQuota:
                description: |-
                  ResourceQuota contains coordination state for GlobalResourceQuota.
                  It is unset for CustomQuota and GlobalCustomQuota ledgers.
                properties:
                  allocated:
                    additionalProperties:
                      anyOf:
                      - type: integer
                      - type: string
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                    description: Allocated is Used plus all active reservations.
                    type: object
                  initialized:
                    description: |-
                      Initialized is true after every selected namespace has reported
                      ResourceQuota status for this quota.
                    type: boolean
                  namespaces:
                    description: Namespaces is the selected namespace set represented
                      by Used.
                    items:
                      type: string
                    type: array
                  observedGeneration:
                    description: |-
                      ObservedGeneration is the GlobalResourceQuota generation represented by
                      this ledger state.
                    format: int64
                    type: integer
                  reservations:
                    description: Reservations contains inflight admission operations.
                    items:
                      description: |-
                        QuantityLedgerResourceQuotaReservation is an atomic reservation against all
                        resources tracked by a GlobalResourceQuota.
                      properties:
                        createdAt:
                          format: date-time
                          type: string
                        delta:
                          additionalProperties:
                            anyOf:
                            - type: integer
                            - type: string
                            pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                            x-kubernetes-int-or-string: true
                          description: Delta is the positive amount held while ResourceQuota
                            status catches up.
                          type: object
                        expiresAt:
                          format: date-time
                          type: string
                        id:
                          description: Unique reservation identifier.
                          minLength: 1
                          type: string
                        objectRef:
                          description: Object that this reservation is intended to
                            create/update.
                          properties:
                            apiGroup:
                              description: APIGroup of the tracked object.
                              type: string
                            apiVersion:
                              description: APIVersion of the tracked object, for example
                                "v1".
                              minLength: 1
                              type: string
                            kind:
                              description: Kind of the tracked object, for example
                                "Pod".
                              minLength: 1
                              type: string
                            name:
                              description: Name of the tracked object.
                              type: string
                            namespace:
                              description: Namespace of the tracked object.
                              type: string
                            uid:
                              description: UID of the tracked object.
                              type: string
                          required:
                          - apiVersion
                          - kind
                          type: object
                        updatedAt:
                          format: date-time
                          type: string
                        usage:
                          additionalProperties:
                            anyOf:
                            - type: integer
                            - type: string
                            pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                            x-kubernetes-int-or-string: true
                          description: Usage is the calculated usage of the admitted
                            object.
                          type: object
                      required:
                      - createdAt
                      - id
                      - objectRef
                      - updatedAt
                      type: object
                    type: array
                  reserved:
                    additionalProperties:
                      anyOf:
                      - type: integer
                      - type: string
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                    description: Reserved is derived from Reservations.
                    type: object
                  used:
                    additionalProperties:
                      anyOf:
                      - type: integer
                      - type: string
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                    description: |-
                      Used is the usage observed from ResourceQuota status across all selected
                      namespaces.
                    type: object
                type: object
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
