{
  "description": "MachineDrainRule is the Schema for the MachineDrainRule 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 defines the spec of a MachineDrainRule.",
      "properties": {
        "drain": {
          "description": "drain configures if and how Pods are drained.",
          "properties": {
            "behavior": {
              "description": "behavior defines the drain behavior.\nCan be either \"Drain\", \"Skip\", or \"WaitCompleted\".\n\"Drain\" means that the Pods to which this MachineDrainRule applies will be drained.\nIf behavior is set to \"Drain\" the order in which Pods are drained can be configured\nwith the order field. When draining Pods of a Node the Pods will be grouped by order\nand one group after another will be drained (by increasing order). Cluster API will\nwait until all Pods of a group are terminated / removed from the Node before starting\nwith the next group.\n\"Skip\" means that the Pods to which this MachineDrainRule applies will be skipped during drain.\n\"WaitCompleted\" means that the pods to which this MachineDrainRule applies will never be evicted\nand we wait for them to be completed, it is enforced that pods marked with this behavior always have Order=0.",
              "enum": [
                "Drain",
                "Skip",
                "WaitCompleted"
              ],
              "type": "string"
            },
            "order": {
              "description": "order defines the order in which Pods are drained.\nPods with higher order are drained after Pods with lower order.\norder can only be set if behavior is set to \"Drain\".\nIf order is not set, 0 will be used.\nValid values for order are from -2147483648 to 2147483647 (inclusive).",
              "format": "int32",
              "type": "integer"
            }
          },
          "required": [
            "behavior"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "machines": {
          "description": "machines defines to which Machines this MachineDrainRule should be applied.\n\nIf machines is not set, the MachineDrainRule applies to all Machines in the Namespace.\nIf machines contains multiple selectors, the results are ORed.\nWithin a single Machine selector the results of selector and clusterSelector are ANDed.\nMachines will be selected from all Clusters in the Namespace unless otherwise\nrestricted with the clusterSelector.\n\nExample: Selects control plane Machines in all Clusters or\n         Machines with label \"os\" == \"linux\" in Clusters with label\n         \"stage\" == \"production\".\n\n - selector:\n     matchExpressions:\n     - key: cluster.x-k8s.io/control-plane\n       operator: Exists\n - selector:\n     matchLabels:\n       os: linux\n   clusterSelector:\n     matchExpressions:\n     - key: stage\n       operator: In\n       values:\n       - production",
          "items": {
            "description": "MachineDrainRuleMachineSelector defines to which Machines this MachineDrainRule should be applied.",
            "minProperties": 1,
            "properties": {
              "clusterSelector": {
                "description": "clusterSelector is a label selector which selects Machines by the labels of\ntheir Clusters.\nThis field follows standard label selector semantics; if not present or\nempty, it selects Machines of all Clusters.\n\nIf selector is also set, then the selector as a whole selects\nMachines matching selector belonging to Clusters selected by clusterSelector.\nIf selector is not set, it selects all Machines belonging to Clusters\nselected by clusterSelector.",
                "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
              },
              "selector": {
                "description": "selector is a label selector which selects Machines by their labels.\nThis field follows standard label selector semantics; if not present or\nempty, it selects all Machines.\n\nIf clusterSelector is also set, then the selector as a whole selects\nMachines matching selector belonging to Clusters selected by clusterSelector.\nIf clusterSelector is not set, it selects all Machines matching selector in\nall Clusters.",
                "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
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "maxItems": 32,
          "minItems": 1,
          "type": "array",
          "x-kubernetes-list-type": "atomic",
          "x-kubernetes-validations": [
            {
              "message": "entries in machines must be unique",
              "rule": "self.all(x, self.exists_one(y, x == y))"
            }
          ]
        },
        "pods": {
          "description": "pods defines to which Pods this MachineDrainRule should be applied.\n\nIf pods is not set, the MachineDrainRule applies to all Pods in all Namespaces.\nIf pods contains multiple selectors, the results are ORed.\nWithin a single Pod selector the results of selector and namespaceSelector are ANDed.\nPods will be selected from all Namespaces unless otherwise\nrestricted with the namespaceSelector.\n\nExample: Selects Pods with label \"app\" == \"logging\" in all Namespaces or\n         Pods with label \"app\" == \"prometheus\" in the \"monitoring\"\n         Namespace.\n\n - selector:\n     matchExpressions:\n     - key: app\n       operator: In\n       values:\n       - logging\n - selector:\n     matchLabels:\n       app: prometheus\n   namespaceSelector:\n     matchLabels:\n       kubernetes.io/metadata.name: monitoring",
          "items": {
            "description": "MachineDrainRulePodSelector defines to which Pods this MachineDrainRule should be applied.",
            "minProperties": 1,
            "properties": {
              "namespaceSelector": {
                "description": "namespaceSelector is a label selector which selects Pods by the labels of\ntheir Namespaces.\nThis field follows standard label selector semantics; if not present or\nempty, it selects Pods of all Namespaces.\n\nIf selector is also set, then the selector as a whole selects\nPods matching selector in Namespaces selected by namespaceSelector.\nIf selector is not set, it selects all Pods in Namespaces selected by\nnamespaceSelector.",
                "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
              },
              "selector": {
                "description": "selector is a label selector which selects Pods by their labels.\nThis field follows standard label selector semantics; if not present or\nempty, it selects all Pods.\n\nIf namespaceSelector is also set, then the selector as a whole selects\nPods matching selector in Namespaces selected by namespaceSelector.\nIf namespaceSelector is not set, it selects all Pods matching selector in\nall Namespaces.",
                "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
              }
            },
            "type": "object",
            "additionalProperties": false
          },
          "maxItems": 32,
          "minItems": 1,
          "type": "array",
          "x-kubernetes-list-type": "atomic",
          "x-kubernetes-validations": [
            {
              "message": "entries in pods must be unique",
              "rule": "self.all(x, self.exists_one(y, x == y))"
            }
          ]
        }
      },
      "required": [
        "drain"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "metadata",
    "spec"
  ],
  "type": "object"
}
