{
  "description": "Classifier is the Schema for the classifiers API",
  "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": "ClassifierSpec defines the desired state of Classifier",
      "properties": {
        "classifierLabels": {
          "description": "ClassifierLabels is set of labels, key,value pair, that will be added to each\ncluster matching Classifier instance",
          "items": {
            "properties": {
              "key": {
                "description": "Key is the label key",
                "type": "string"
              },
              "value": {
                "description": "Value is the label value",
                "type": "string"
              }
            },
            "required": [
              "key",
              "value"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "deployedResourceConstraint": {
          "description": "DeployedResourceConstraint allows to classify based on current deployed resources",
          "properties": {
            "aggregatedClassification": {
              "description": "AggregatedClassification is optional and can be used to specify a Lua function\nthat will be used to further detect whether the subset of the resources\nselected using the ResourceSelector field are a match for this Classifier.\nThe function will receive the array of resources selected by ResourceSelectors.\nIf this field is not specified, a cluster is a match for Classifier instance,\nif all ResourceSelectors returns at least one match.\nThis field allows to perform more complex evaluation  on the resources, looking\nat all resources together.\nThis can be useful for more sophisticated tasks, such as identifying resources\nthat are related to each other or that have similar properties.\nThe Lua function must return a struct with:\n- \"matching\" field: boolean indicating whether cluster is a match;\n- \"message\" field: (optional) message.",
              "type": "string"
            },
            "resourceSelectors": {
              "description": "ResourceSelectors identifies what resources to select\nIf no AggregatedClassification is specified, a cluster is\na match for Classifier instance, if all ResourceSelectors returns at\nleast one match.",
              "items": {
                "description": "ResourceSelector defines what resources are a match",
                "properties": {
                  "evaluate": {
                    "description": "Evaluate contains a function \"evaluate\" in lua language.\nThe function will be passed one of the object selected based on\nabove criteria.\nMust return struct with field \"matching\" representing whether\nobject is a match and an optional \"message\" field.",
                    "type": "string"
                  },
                  "evaluateCEL": {
                    "description": "EvaluateCEL contains a list of named CEL (Common Expression Language) rules.\nEach rule will be evaluated in order against each object selected based on\nthe criteria defined above. Each rule's expression must return a boolean value\nindicating whether the object is a match.\n\nEvaluation stops at the first rule that returns true; subsequent\nrules will not be evaluated.",
                    "items": {
                      "description": "CELRule defines a named CEL rule used in EvaluateCEL.",
                      "properties": {
                        "name": {
                          "description": "Name is a human-readable identifier for the rule.",
                          "type": "string"
                        },
                        "rule": {
                          "description": "Rule is the CEL (Common Expression Language) expression to evaluate.\nIt must return a bool",
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "rule"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "type": "array"
                  },
                  "group": {
                    "description": "Group of the resource deployed in the Cluster.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind of the resource deployed in the Cluster.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "labelFilters": {
                    "description": "LabelFilters allows to filter resources based on current labels.",
                    "items": {
                      "properties": {
                        "key": {
                          "description": "Key is the label key",
                          "type": "string"
                        },
                        "operation": {
                          "description": "Operation is the comparison operation",
                          "enum": [
                            "Equal",
                            "Different",
                            "Has",
                            "DoesNotHave"
                          ],
                          "type": "string"
                        },
                        "value": {
                          "description": "Value is the label value",
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "operation"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "type": "array"
                  },
                  "name": {
                    "description": "Name of the resource deployed in the  Cluster.",
                    "type": "string"
                  },
                  "namespace": {
                    "description": "Namespace of the resource deployed in the  Cluster.\nEmpty for resources scoped at cluster level.\nFor namespaced resources, an empty string \"\" indicates all namespaces.",
                    "type": "string"
                  },
                  "selector": {
                    "description": "Selector is a standard Kubernetes label selector. Resources are selected\nif their labels match the selector. This field uses the standard\nKubernetes label matching syntax (e.g., {\"environment\": \"production\"}).\nIf both LabelFilters and Selector are specified, the requirements from\nboth are logically ANDed.",
                    "properties": {
                      "matchExpressions": {
                        "description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
                        "items": {
                          "description": "A label selector requirement is a selector that contains values, a key, and an operator that\nrelates the key and values.",
                          "properties": {
                            "key": {
                              "description": "key is the label key that the selector applies to.",
                              "type": "string"
                            },
                            "operator": {
                              "description": "operator represents a key's relationship to a set of values.\nValid operators are In, NotIn, Exists and DoesNotExist.",
                              "type": "string"
                            },
                            "values": {
                              "description": "values is an array of string values. If the operator is In or NotIn,\nthe values array must be non-empty. If the operator is Exists or DoesNotExist,\nthe values array must be empty. This array is replaced during a strategic\nmerge patch.",
                              "items": {
                                "type": "string"
                              },
                              "type": "array",
                              "x-kubernetes-list-type": "atomic"
                            }
                          },
                          "required": [
                            "key",
                            "operator"
                          ],
                          "type": "object",
                          "additionalProperties": false
                        },
                        "type": "array",
                        "x-kubernetes-list-type": "atomic"
                      },
                      "matchLabels": {
                        "additionalProperties": {
                          "type": "string"
                        },
                        "description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels\nmap is equivalent to an element of matchExpressions, whose key field is \"key\", the\noperator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
                        "type": "object"
                      }
                    },
                    "type": "object",
                    "x-kubernetes-map-type": "atomic",
                    "additionalProperties": false
                  },
                  "version": {
                    "description": "Version of the resource deployed in the Cluster.",
                    "type": "string"
                  }
                },
                "required": [
                  "group",
                  "kind",
                  "version"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            }
          },
          "required": [
            "resourceSelectors"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "kubernetesVersionConstraints": {
          "description": "KubernetesVersionConstraints allows to classify based on current kubernetes version",
          "items": {
            "properties": {
              "comparison": {
                "description": "Comparison indicate how to compare cluster kubernetes version with the specified version",
                "enum": [
                  "Equal",
                  "NotEqual",
                  "GreaterThan",
                  "LessThan",
                  "GreaterThanOrEqualTo",
                  "LessThanOrEqualTo"
                ],
                "type": "string"
              },
              "version": {
                "description": "Version is the kubernetes version",
                "type": "string"
              }
            },
            "required": [
              "comparison",
              "version"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        }
      },
      "required": [
        "classifierLabels"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "ClassifierStatus defines the observed state of Classifier",
      "properties": {
        "clusterInfo": {
          "description": "ClusterInfo reference all the cluster-api Cluster where Classifier\nhas been/is being deployed",
          "items": {
            "properties": {
              "cluster": {
                "description": "Cluster references the Cluster",
                "properties": {
                  "apiVersion": {
                    "description": "API version of the referent.",
                    "type": "string"
                  },
                  "fieldPath": {
                    "description": "If referring to a piece of an object instead of an entire object, this string\nshould contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].\nFor example, if the object reference is to a container within a pod, this would take on a value like:\n\"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered\nthe event) or if no container name is specified \"spec.containers[2]\" (container with\nindex 2 in this pod). This syntax is chosen only to have some well-defined way of\nreferencing a part of an object.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind of the referent.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
                    "type": "string"
                  },
                  "name": {
                    "description": "Name of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                    "type": "string"
                  },
                  "namespace": {
                    "description": "Namespace of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
                    "type": "string"
                  },
                  "resourceVersion": {
                    "description": "Specific resourceVersion to which this reference is made, if any.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
                    "type": "string"
                  },
                  "uid": {
                    "description": "UID of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
                    "type": "string"
                  }
                },
                "type": "object",
                "x-kubernetes-map-type": "atomic",
                "additionalProperties": false
              },
              "failureMessage": {
                "description": "FailureMessage provides more information about the error.",
                "type": "string"
              },
              "hash": {
                "description": "Hash represents the hash of the Classifier currently deployed\nin the Cluster",
                "format": "byte",
                "type": "string"
              },
              "status": {
                "description": "Status represents the state of the feature in the workload cluster",
                "enum": [
                  "Provisioning",
                  "Provisioned",
                  "Failed",
                  "FailedNonRetriable",
                  "Removing",
                  "Removed"
                ],
                "type": "string"
              }
            },
            "required": [
              "cluster",
              "hash"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "machingClusterStatuses": {
          "description": "MatchingClusterRefs reference all the cluster-api Cluster currently matching\nClassifier",
          "items": {
            "properties": {
              "clusterRef": {
                "description": "ClusterRef references the matching Cluster",
                "properties": {
                  "apiVersion": {
                    "description": "API version of the referent.",
                    "type": "string"
                  },
                  "fieldPath": {
                    "description": "If referring to a piece of an object instead of an entire object, this string\nshould contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2].\nFor example, if the object reference is to a container within a pod, this would take on a value like:\n\"spec.containers{name}\" (where \"name\" refers to the name of the container that triggered\nthe event) or if no container name is specified \"spec.containers[2]\" (container with\nindex 2 in this pod). This syntax is chosen only to have some well-defined way of\nreferencing a part of an object.",
                    "type": "string"
                  },
                  "kind": {
                    "description": "Kind of the referent.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
                    "type": "string"
                  },
                  "name": {
                    "description": "Name of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                    "type": "string"
                  },
                  "namespace": {
                    "description": "Namespace of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/",
                    "type": "string"
                  },
                  "resourceVersion": {
                    "description": "Specific resourceVersion to which this reference is made, if any.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency",
                    "type": "string"
                  },
                  "uid": {
                    "description": "UID of the referent.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids",
                    "type": "string"
                  }
                },
                "type": "object",
                "x-kubernetes-map-type": "atomic",
                "additionalProperties": false
              },
              "managedLabels": {
                "description": "ManagedLabels indicates the labels being managed on\nthe cluster by this Classifier instance",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "unManagedLabels": {
                "description": "UnManagedLabel indicates the labels this Classifier instance\nwould like to manage but cannot because different instance is\nalready managing it",
                "items": {
                  "properties": {
                    "failureMessage": {
                      "description": "FailureMessage is a human consumable message explaining the\nmisconfiguration",
                      "type": "string"
                    },
                    "key": {
                      "description": "Key represents a label Classifier would like to manage\nbut cannot because currently managed by different instance",
                      "type": "string"
                    }
                  },
                  "required": [
                    "key"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": "array"
              }
            },
            "required": [
              "clusterRef"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
