---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.17.3
  labels:
    app.kubernetes.io/instance: kueue
    app.kubernetes.io/name: kueue
    app.kubernetes.io/version: v0.12.3
    control-plane: controller-manager
  name: topologies.kueue.x-k8s.io
spec:
  conversion:
    strategy: Webhook
    webhook:
      clientConfig:
        service:
          name: kueue-webhook-service
          namespace: kueue-system
          path: /convert
      conversionReviewVersions:
        - v1
  group: kueue.x-k8s.io
  names:
    kind: Topology
    listKind: TopologyList
    plural: topologies
    singular: topology
  scope: Cluster
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: Topology is the Schema for the topology API
          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: TopologySpec defines the desired state of Topology
              properties:
                levels:
                  description: levels define the levels of topology.
                  items:
                    description: TopologyLevel defines the desired state of TopologyLevel
                    properties:
                      nodeLabel:
                        description: |-
                          nodeLabel indicates the name of the node label for a specific topology
                          level.

                          Examples:
                          - cloud.provider.com/topology-block
                          - cloud.provider.com/topology-rack
                        maxLength: 316
                        minLength: 1
                        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:
                      - nodeLabel
                    type: object
                  maxItems: 8
                  minItems: 1
                  type: array
                  x-kubernetes-list-type: atomic
                  x-kubernetes-validations:
                    - message: field is immutable
                      rule: self == oldSelf
                    - message: must be unique
                      rule: size(self.filter(i, size(self.filter(j, j == i)) > 1)) == 0
                    - message: the kubernetes.io/hostname label can only be used at the lowest level of topology
                      rule: size(self.filter(i, i.nodeLabel == 'kubernetes.io/hostname')) == 0 || self[size(self) - 1].nodeLabel == 'kubernetes.io/hostname'
              required:
                - levels
              type: object
          required:
            - spec
          type: object
      served: true
      storage: true
