{
  "description": "MachineHealthCheck is the Schema for the machinehealthchecks 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": "spec is the specification of machine health check policy",
      "properties": {
        "checks": {
          "description": "checks are the checks that are used to evaluate if a Machine is healthy.\n\nIndependent of this configuration the MachineHealthCheck controller will always\nflag Machines with `cluster.x-k8s.io/remediate-machine` annotation and\nMachines with deleted Nodes as unhealthy.\n\nFurthermore, if checks.nodeStartupTimeoutSeconds is not set it\nis defaulted to 10 minutes and evaluated accordingly.",
          "minProperties": 1,
          "properties": {
            "nodeStartupTimeoutSeconds": {
              "description": "nodeStartupTimeoutSeconds allows to set the maximum time for MachineHealthCheck\nto consider a Machine unhealthy if a corresponding Node isn't associated\nthrough a `Spec.ProviderID` field.\n\nThe duration set in this field is compared to the greatest of:\n- Cluster's infrastructure ready condition timestamp (if and when available)\n- Control Plane's initialized condition timestamp (if and when available)\n- Machine's infrastructure ready condition timestamp (if and when available)\n- Machine's metadata creation timestamp\n\nDefaults to 10 minutes.\nIf you wish to disable this feature, set the value explicitly to 0.",
              "format": "int32",
              "minimum": 0,
              "type": "integer"
            },
            "unhealthyNodeConditions": {
              "description": "unhealthyNodeConditions contains a list of conditions that determine\nwhether a node is considered unhealthy. The conditions are combined in a\nlogical OR, i.e. if any of the conditions is met, the node is unhealthy.",
              "items": {
                "description": "UnhealthyNodeCondition represents a Node condition type and value with a timeout\nspecified as a duration.  When the named condition has been in the given\nstatus for at least the timeout value, a node is considered unhealthy.",
                "properties": {
                  "status": {
                    "description": "status of the condition, one of True, False, Unknown.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "timeoutSeconds": {
                    "description": "timeoutSeconds is the duration that a node must be in a given status for,\nafter which the node is considered unhealthy.\nFor example, with a value of \"1h\", the node must match the status\nfor at least 1 hour before being considered unhealthy.",
                    "format": "int32",
                    "minimum": 0,
                    "type": "integer"
                  },
                  "type": {
                    "description": "type of Node condition",
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "timeoutSeconds",
                  "type"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "maxItems": 100,
              "minItems": 1,
              "type": "array",
              "x-kubernetes-list-type": "atomic"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "clusterName": {
          "description": "clusterName is the name of the Cluster this object belongs to.",
          "maxLength": 63,
          "minLength": 1,
          "type": "string"
        },
        "remediation": {
          "description": "remediation configures if and how remediations are triggered if a Machine is unhealthy.\n\nIf remediation or remediation.triggerIf is not set,\nremediation will always be triggered for unhealthy Machines.\n\nIf remediation or remediation.templateRef is not set,\nthe OwnerRemediated condition will be set on unhealthy Machines to trigger remediation via\nthe owner of the Machines, for example a MachineSet or a KubeadmControlPlane.",
          "minProperties": 1,
          "properties": {
            "templateRef": {
              "description": "templateRef is a reference to a remediation template\nprovided by an infrastructure provider.\n\nThis field is completely optional, when filled, the MachineHealthCheck controller\ncreates a new object from the template referenced and hands off remediation of the machine to\na controller that lives outside of Cluster API.",
              "properties": {
                "apiVersion": {
                  "description": "apiVersion of the remediation template.\napiVersion must be fully qualified domain name followed by / and a version.\nNOTE: This field must be kept in sync with the APIVersion of the remediation template.",
                  "maxLength": 317,
                  "minLength": 1,
                  "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\\/[a-z]([-a-z0-9]*[a-z0-9])?$",
                  "type": "string"
                },
                "kind": {
                  "description": "kind of the remediation template.\nkind must consist of alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character.",
                  "maxLength": 63,
                  "minLength": 1,
                  "pattern": "^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$",
                  "type": "string"
                },
                "name": {
                  "description": "name of the remediation template.\nname must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character.",
                  "maxLength": 253,
                  "minLength": 1,
                  "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$",
                  "type": "string"
                }
              },
              "required": [
                "apiVersion",
                "kind",
                "name"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "triggerIf": {
              "description": "triggerIf configures if remediations are triggered.\nIf this field is not set, remediations are always triggered.",
              "minProperties": 1,
              "properties": {
                "unhealthyInRange": {
                  "description": "unhealthyInRange specifies that remediations are only triggered if the number of\nunhealthy Machines is in the configured range.\nTakes precedence over unhealthyLessThanOrEqualTo.\nEg. \"[3-5]\" - This means that remediation will be allowed only when:\n(a) there are at least 3 unhealthy Machines (and)\n(b) there are at most 5 unhealthy Machines",
                  "maxLength": 32,
                  "minLength": 1,
                  "pattern": "^\\[[0-9]+-[0-9]+\\]$",
                  "type": "string"
                },
                "unhealthyLessThanOrEqualTo": {
                  "anyOf": [
                    {
                      "type": "integer"
                    },
                    {
                      "type": "string"
                    }
                  ],
                  "description": "unhealthyLessThanOrEqualTo specifies that remediations are only triggered if the number of\nunhealthy Machines is less than or equal to the configured value.\nunhealthyInRange takes precedence if set.",
                  "x-kubernetes-int-or-string": true
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "selector": {
          "description": "selector is a label selector to match machines whose health will be exercised",
          "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
        }
      },
      "required": [
        "clusterName",
        "selector"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "status is the most recently observed status of MachineHealthCheck resource",
      "minProperties": 1,
      "properties": {
        "conditions": {
          "description": "conditions represents the observations of a MachineHealthCheck's current state.\nKnown condition types are RemediationAllowed, Paused.",
          "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.\nThis 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.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith 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.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis 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",
            "additionalProperties": false
          },
          "maxItems": 32,
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "currentHealthy": {
          "description": "currentHealthy is the total number of healthy machines counted by this machine health check",
          "format": "int32",
          "minimum": 0,
          "type": "integer"
        },
        "deprecated": {
          "description": "deprecated groups all the status fields that are deprecated and will be removed when all the nested field are removed.",
          "properties": {
            "v1beta1": {
              "description": "v1beta1 groups all the status fields that are deprecated and will be removed when support for v1beta1 will be dropped.",
              "properties": {
                "conditions": {
                  "description": "conditions defines current service state of the MachineHealthCheck.\n\nDeprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details.",
                  "items": {
                    "description": "Condition defines an observation of a Cluster API resource operational state.",
                    "properties": {
                      "lastTransitionTime": {
                        "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed. If that is not known, then using the time when\nthe API field changed is acceptable.",
                        "format": "date-time",
                        "type": "string"
                      },
                      "message": {
                        "description": "message is a human readable message indicating details about the transition.\nThis field may be empty.",
                        "maxLength": 10240,
                        "minLength": 1,
                        "type": "string"
                      },
                      "reason": {
                        "description": "reason is the reason for the condition's last transition in CamelCase.\nThe specific API may choose whether or not this field is considered a guaranteed API.\nThis field may be empty.",
                        "maxLength": 256,
                        "minLength": 1,
                        "type": "string"
                      },
                      "severity": {
                        "description": "severity provides an explicit classification of Reason code, so the users or machines can immediately\nunderstand the current situation and act accordingly.\nThe Severity field MUST be set only when Status=False.",
                        "maxLength": 32,
                        "type": "string"
                      },
                      "status": {
                        "description": "status of the condition, one of True, False, Unknown.",
                        "type": "string"
                      },
                      "type": {
                        "description": "type of condition in CamelCase or in foo.example.com/CamelCase.\nMany .condition.type values are consistent across resources like Available, but because arbitrary conditions\ncan be useful (see .node.status.conditions), the ability to deconflict is important.",
                        "maxLength": 256,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "lastTransitionTime",
                      "status",
                      "type"
                    ],
                    "type": "object",
                    "additionalProperties": false
                  },
                  "type": "array"
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "expectedMachines": {
          "description": "expectedMachines is the total number of machines counted by this machine health check",
          "format": "int32",
          "minimum": 0,
          "type": "integer"
        },
        "observedGeneration": {
          "description": "observedGeneration is the latest generation observed by the controller.",
          "format": "int64",
          "minimum": 1,
          "type": "integer"
        },
        "remediationsAllowed": {
          "description": "remediationsAllowed is the number of further remediations allowed by this machine health check before\nmaxUnhealthy short circuiting will be applied",
          "format": "int32",
          "minimum": 0,
          "type": "integer"
        },
        "targets": {
          "description": "targets shows the current list of machines the machine health check is watching",
          "items": {
            "maxLength": 253,
            "minLength": 1,
            "type": "string"
          },
          "maxItems": 10000,
          "type": "array",
          "x-kubernetes-list-type": "atomic"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
