{
  "description": "Cohort defines the Cohorts API.\n\nHierarchical Cohorts (any Cohort which has a parent) are compatible\nwith Fair Sharing as of v0.11. Using these features together in\nV0.9 and V0.10 is unsupported, and results in undefined behavior.",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore 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.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "spec is the specification of the Cohort.",
      "properties": {
        "fairSharing": {
          "description": "fairSharing defines the properties of the Cohort when\nparticipating in FairSharing. The values are only relevant\nif FairSharing is enabled in the Kueue configuration.",
          "properties": {
            "weight": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "string"
                }
              ],
              "default": 1,
              "description": "weight gives a comparative advantage to this ClusterQueue\nor Cohort when competing for unused resources in the\nCohort.  The share is based on the dominant resource usage\nabove nominal quotas for each resource, divided by the\nweight.  Admission prioritizes scheduling workloads from\nClusterQueues and Cohorts with the lowest share and\npreempting workloads from the ClusterQueues and Cohorts\nwith the highest share.  A zero weight implies infinite\nshare value, meaning that this Node will always be at\ndisadvantage against other ClusterQueues and Cohorts.\nWhen not 0, Weight must be greater than 10^-9.",
              "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
              "x-kubernetes-int-or-string": true
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "parentName": {
          "description": "parentName references the name of the Cohort's parent, if\nany. It satisfies one of three cases:\n1) Unset. This Cohort is the root of its Cohort tree.\n2) References a non-existent Cohort. We use default Cohort (no borrowing/lending limits).\n3) References an existent Cohort.\n\nIf a cycle is created, we disable all members of the\nCohort, including ClusterQueues, until the cycle is\nremoved.  We prevent further admission while the cycle\nexists.",
          "maxLength": 253,
          "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
          "type": "string"
        },
        "resourceGroups": {
          "description": "resourceGroups describes groupings of Resources and\nFlavors.  Each ResourceGroup defines a list of Resources\nand a list of Flavors which provide quotas for these\nResources. Each Resource and each Flavor may only form part\nof one ResourceGroup.  There may be up to 16 ResourceGroups\nwithin a Cohort.\n\nPlease note that nominalQuota defined at the Cohort level\nrepresents additional resources on top of those defined by\nClusterQueues within the Cohort. The Cohort's nominalQuota\nmay be thought of as a shared pool for the ClusterQueues\nwithin it. Additionally, this quota may also be lent out to\nparent Cohort(s), subject to LendingLimit.\n\nBorrowingLimit limits how much members of this Cohort\nsubtree can borrow from the parent subtree.\n\nLendingLimit limits how much members of this Cohort subtree\ncan lend to the parent subtree.\n\nBorrowing and Lending limits must only be set when the\nCohort has a parent.  Otherwise, the Cohort create/update\nwill be rejected by the webhook.",
          "items": {
            "properties": {
              "coveredResources": {
                "description": "coveredResources is the list of resources covered by the flavors in this\ngroup.\nExamples: cpu, memory, vendor.com/gpu.\nThe list cannot be empty and it can contain up to 64 resources. With a total\nof up to 256 covered resources across all resource groups in the ClusterQueue.",
                "items": {
                  "description": "ResourceName is the name identifying various resources in a ResourceList.",
                  "type": "string"
                },
                "maxItems": 64,
                "minItems": 1,
                "type": "array",
                "x-kubernetes-list-type": "atomic"
              },
              "flavors": {
                "description": "flavors is the list of flavors that provide the resources of this group.\nTypically, different flavors represent different hardware models\n(e.g., gpu models, cpu architectures) or pricing models (on-demand vs spot\ncpus).\nEach flavor MUST list all the resources listed for this group in the same\norder as the .resources field.\nThe list cannot be empty and it can contain up to 64 flavors, with a max of\n256 total flavors across all resource groups in the ClusterQueue.",
                "items": {
                  "properties": {
                    "name": {
                      "description": "name of this flavor. The name should match the .metadata.name of a\nResourceFlavor. If a matching ResourceFlavor does not exist, the\nClusterQueue will have an Active condition set to False.",
                      "maxLength": 253,
                      "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                      "type": "string"
                    },
                    "resources": {
                      "description": "resources is the list of quotas for this flavor per resource.\nThere could be up to 64 resources.",
                      "items": {
                        "properties": {
                          "borrowingLimit": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "string"
                              }
                            ],
                            "description": "borrowingLimit is the maximum amount of quota for the [flavor, resource]\ncombination that this ClusterQueue is allowed to borrow from the unused\nquota of other ClusterQueues in the same cohort.\nIn total, at a given time, Workloads in a ClusterQueue can consume a\nquantity of quota equal to nominalQuota+borrowingLimit, assuming the other\nClusterQueues in the cohort have enough unused quota.\nIf null, it means that there is no borrowing limit.\nIf not null, it must be non-negative.\nborrowingLimit must be null if spec.cohort is empty.",
                            "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                            "x-kubernetes-int-or-string": true
                          },
                          "lendingLimit": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "string"
                              }
                            ],
                            "description": "lendingLimit is the maximum amount of unused quota for the [flavor, resource]\ncombination that this ClusterQueue can lend to other ClusterQueues in the same cohort.\nIn total, at a given time, ClusterQueue reserves for its exclusive use\na quantity of quota equals to nominalQuota - lendingLimit.\nIf null, it means that there is no lending limit, meaning that\nall the nominalQuota can be borrowed by other clusterQueues in the cohort.\nIf not null, it must be non-negative.\nlendingLimit must be null if spec.cohort is empty.\nThis field is in beta stage and is enabled by default.",
                            "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                            "x-kubernetes-int-or-string": true
                          },
                          "name": {
                            "description": "name of this resource.",
                            "type": "string"
                          },
                          "nominalQuota": {
                            "anyOf": [
                              {
                                "type": "integer"
                              },
                              {
                                "type": "string"
                              }
                            ],
                            "description": "nominalQuota is the quantity of this resource that is available for\nWorkloads admitted by this ClusterQueue at a point in time.\nThe nominalQuota must be non-negative.\nnominalQuota should represent the resources in the cluster available for\nrunning jobs (after discounting resources consumed by system components\nand pods not managed by kueue). In an autoscaled cluster, nominalQuota\nshould account for resources that can be provided by a component such as\nKubernetes cluster-autoscaler.\n\nIf the ClusterQueue belongs to a cohort, the sum of the quotas for each\n(flavor, resource) combination defines the maximum quantity that can be\nallocated by a ClusterQueue in the cohort.",
                            "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                            "x-kubernetes-int-or-string": true
                          }
                        },
                        "required": [
                          "name",
                          "nominalQuota"
                        ],
                        "type": "object",
                        "additionalProperties": false
                      },
                      "maxItems": 64,
                      "minItems": 1,
                      "type": "array",
                      "x-kubernetes-list-map-keys": [
                        "name"
                      ],
                      "x-kubernetes-list-type": "map"
                    }
                  },
                  "required": [
                    "name",
                    "resources"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "maxItems": 64,
                "minItems": 1,
                "type": "array",
                "x-kubernetes-list-map-keys": [
                  "name"
                ],
                "x-kubernetes-list-type": "map"
              }
            },
            "required": [
              "coveredResources",
              "flavors"
            ],
            "type": "object",
            "x-kubernetes-validations": [
              {
                "message": "flavors must have the same number of resources as the coveredResources",
                "rule": "self.flavors.all(x, size(x.resources) == size(self.coveredResources))"
              }
            ],
            "additionalProperties": false
          },
          "maxItems": 16,
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        }
      },
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "status is the status of the Cohort.",
      "properties": {
        "fairSharing": {
          "description": "fairSharing contains the current state for this Cohort\nwhen participating in Fair Sharing.\nThe is recorded only when Fair Sharing is enabled in the Kueue configuration.",
          "properties": {
            "weightedShare": {
              "description": "weightedShare represents the maximum of the ratios of usage\nabove nominal quota to the lendable resources in the\nCohort, among all the resources provided by the Node, and\ndivided by the weight.  If zero, it means that the usage of\nthe Node is below the nominal quota.  If the Node has a\nweight of zero and is borrowing, this will return\n9223372036854775807, the maximum possible share value.",
              "format": "int64",
              "type": "integer"
            }
          },
          "required": [
            "weightedShare"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
