MachineDrainRule [cluster.x-k8s.io/v1beta1]

Description
MachineDrainRule is the Schema for the MachineDrainRule API.
Type
object
Required
metadataspec

Specification

PropertyTypeDescription
apiVersionstring

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

kindstring

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

metadataObjectMeta

ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.

specobject

spec defines the spec of a MachineDrainRule.

.spec

Description
spec defines the spec of a MachineDrainRule.
Type
object
Required
drain
PropertyTypeDescription
drainobject

drain configures if and how Pods are drained.

machinesarray

machines defines to which Machines this MachineDrainRule should be applied.

If machines is not set, the MachineDrainRule applies to all Machines in the Namespace. If machines contains multiple selectors, the results are ORed. Within a single Machine selector the results of selector and clusterSelector are ANDed. Machines will be selected from all Clusters in the Namespace unless otherwise restricted with the clusterSelector.

Example: Selects control plane Machines in all Clusters or Machines with label "os" == "linux" in Clusters with label "stage" == "production".

  • selector: matchExpressions:
    • key: cluster.x-k8s.io/control-plane operator: Exists
  • selector: matchLabels: os: linux clusterSelector: matchExpressions:
    • key: stage operator: In values:
      • production
podsarray

pods defines to which Pods this MachineDrainRule should be applied.

If pods is not set, the MachineDrainRule applies to all Pods in all Namespaces. If pods contains multiple selectors, the results are ORed. Within a single Pod selector the results of selector and namespaceSelector are ANDed. Pods will be selected from all Namespaces unless otherwise restricted with the namespaceSelector.

Example: Selects Pods with label "app" == "logging" in all Namespaces or Pods with label "app" == "prometheus" in the "monitoring" Namespace.

  • selector: matchExpressions:
    • key: app operator: In values:
      • logging
  • selector: matchLabels: app: prometheus namespaceSelector: matchLabels: kubernetes.io/metadata.name: monitoring

.spec.drain

Description
drain configures if and how Pods are drained.
Type
object
Required
behavior
PropertyTypeDescription
behaviorstring

behavior defines the drain behavior. Can be either "Drain", "Skip", or "WaitCompleted". "Drain" means that the Pods to which this MachineDrainRule applies will be drained. If behavior is set to "Drain" the order in which Pods are drained can be configured with the order field. When draining Pods of a Node the Pods will be grouped by order and one group after another will be drained (by increasing order). Cluster API will wait until all Pods of a group are terminated / removed from the Node before starting with the next group. "Skip" means that the Pods to which this MachineDrainRule applies will be skipped during drain. "WaitCompleted" means that the pods to which this MachineDrainRule applies will never be evicted and we wait for them to be completed, it is enforced that pods marked with this behavior always have Order=0.

orderinteger

order defines the order in which Pods are drained. Pods with higher order are drained after Pods with lower order. order can only be set if behavior is set to "Drain". If order is not set, 0 will be used. Valid values for order are from -2147483648 to 2147483647 (inclusive).

.spec.machines

Description
machines defines to which Machines this MachineDrainRule should be applied. If machines is not set, the MachineDrainRule applies to all Machines in the Namespace. If machines contains multiple selectors, the results are ORed. Within a single Machine selector the results of selector and clusterSelector are ANDed. Machines will be selected from all Clusters in the Namespace unless otherwise restricted with the clusterSelector. Example: Selects control plane Machines in all Clusters or Machines with label "os" == "linux" in Clusters with label "stage" == "production". - selector: matchExpressions: - key: cluster.x-k8s.io/control-plane operator: Exists - selector: matchLabels: os: linux clusterSelector: matchExpressions: - key: stage operator: In values: - production
Type
array

.spec.machines[]

Description
MachineDrainRuleMachineSelector defines to which Machines this MachineDrainRule should be applied.
Type
object
PropertyTypeDescription
clusterSelectorobject

clusterSelector is a label selector which selects Machines by the labels of their Clusters. This field follows standard label selector semantics; if not present or empty, it selects Machines of all Clusters.

If selector is also set, then the selector as a whole selects Machines matching selector belonging to Clusters selected by clusterSelector. If selector is not set, it selects all Machines belonging to Clusters selected by clusterSelector.

selectorobject

selector is a label selector which selects Machines by their labels. This field follows standard label selector semantics; if not present or empty, it selects all Machines.

If clusterSelector is also set, then the selector as a whole selects Machines matching selector belonging to Clusters selected by clusterSelector. If clusterSelector is not set, it selects all Machines matching selector in all Clusters.

.spec.machines[].clusterSelector

Description
clusterSelector is a label selector which selects Machines by the labels of their Clusters. This field follows standard label selector semantics; if not present or empty, it selects Machines of all Clusters. If selector is also set, then the selector as a whole selects Machines matching selector belonging to Clusters selected by clusterSelector. If selector is not set, it selects all Machines belonging to Clusters selected by clusterSelector.
Type
object
PropertyTypeDescription
matchExpressionsarray

matchExpressions is a list of label selector requirements. The requirements are ANDed.

matchLabelsobject

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

.spec.machines[].clusterSelector.matchExpressions

Description
matchExpressions is a list of label selector requirements. The requirements are ANDed.
Type
array

.spec.machines[].clusterSelector.matchExpressions[]

Description
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Type
object
Required
keyoperator
PropertyTypeDescription
keystring

key is the label key that the selector applies to.

operatorstring

operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

valuesarray

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

.spec.machines[].clusterSelector.matchExpressions[].values

Description
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
Type
array

.spec.machines[].clusterSelector.matchExpressions[].values[]

Type
string

.spec.machines[].clusterSelector.matchLabels

Description
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
Type
object

.spec.machines[].selector

Description
selector is a label selector which selects Machines by their labels. This field follows standard label selector semantics; if not present or empty, it selects all Machines. If clusterSelector is also set, then the selector as a whole selects Machines matching selector belonging to Clusters selected by clusterSelector. If clusterSelector is not set, it selects all Machines matching selector in all Clusters.
Type
object
PropertyTypeDescription
matchExpressionsarray

matchExpressions is a list of label selector requirements. The requirements are ANDed.

matchLabelsobject

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

.spec.machines[].selector.matchExpressions

Description
matchExpressions is a list of label selector requirements. The requirements are ANDed.
Type
array

.spec.machines[].selector.matchExpressions[]

Description
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Type
object
Required
keyoperator
PropertyTypeDescription
keystring

key is the label key that the selector applies to.

operatorstring

operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

valuesarray

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

.spec.machines[].selector.matchExpressions[].values

Description
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
Type
array

.spec.machines[].selector.matchExpressions[].values[]

Type
string

.spec.machines[].selector.matchLabels

Description
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
Type
object

.spec.pods

Description
pods defines to which Pods this MachineDrainRule should be applied. If pods is not set, the MachineDrainRule applies to all Pods in all Namespaces. If pods contains multiple selectors, the results are ORed. Within a single Pod selector the results of selector and namespaceSelector are ANDed. Pods will be selected from all Namespaces unless otherwise restricted with the namespaceSelector. Example: Selects Pods with label "app" == "logging" in all Namespaces or Pods with label "app" == "prometheus" in the "monitoring" Namespace. - selector: matchExpressions: - key: app operator: In values: - logging - selector: matchLabels: app: prometheus namespaceSelector: matchLabels: kubernetes.io/metadata.name: monitoring
Type
array

.spec.pods[]

Description
MachineDrainRulePodSelector defines to which Pods this MachineDrainRule should be applied.
Type
object
PropertyTypeDescription
namespaceSelectorobject

namespaceSelector is a label selector which selects Pods by the labels of their Namespaces. This field follows standard label selector semantics; if not present or empty, it selects Pods of all Namespaces.

If selector is also set, then the selector as a whole selects Pods matching selector in Namespaces selected by namespaceSelector. If selector is not set, it selects all Pods in Namespaces selected by namespaceSelector.

selectorobject

selector is a label selector which selects Pods by their labels. This field follows standard label selector semantics; if not present or empty, it selects all Pods.

If namespaceSelector is also set, then the selector as a whole selects Pods matching selector in Namespaces selected by namespaceSelector. If namespaceSelector is not set, it selects all Pods matching selector in all Namespaces.

.spec.pods[].namespaceSelector

Description
namespaceSelector is a label selector which selects Pods by the labels of their Namespaces. This field follows standard label selector semantics; if not present or empty, it selects Pods of all Namespaces. If selector is also set, then the selector as a whole selects Pods matching selector in Namespaces selected by namespaceSelector. If selector is not set, it selects all Pods in Namespaces selected by namespaceSelector.
Type
object
PropertyTypeDescription
matchExpressionsarray

matchExpressions is a list of label selector requirements. The requirements are ANDed.

matchLabelsobject

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

.spec.pods[].namespaceSelector.matchExpressions

Description
matchExpressions is a list of label selector requirements. The requirements are ANDed.
Type
array

.spec.pods[].namespaceSelector.matchExpressions[]

Description
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Type
object
Required
keyoperator
PropertyTypeDescription
keystring

key is the label key that the selector applies to.

operatorstring

operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

valuesarray

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

.spec.pods[].namespaceSelector.matchExpressions[].values

Description
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
Type
array

.spec.pods[].namespaceSelector.matchExpressions[].values[]

Type
string

.spec.pods[].namespaceSelector.matchLabels

Description
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
Type
object

.spec.pods[].selector

Description
selector is a label selector which selects Pods by their labels. This field follows standard label selector semantics; if not present or empty, it selects all Pods. If namespaceSelector is also set, then the selector as a whole selects Pods matching selector in Namespaces selected by namespaceSelector. If namespaceSelector is not set, it selects all Pods matching selector in all Namespaces.
Type
object
PropertyTypeDescription
matchExpressionsarray

matchExpressions is a list of label selector requirements. The requirements are ANDed.

matchLabelsobject

matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.

.spec.pods[].selector.matchExpressions

Description
matchExpressions is a list of label selector requirements. The requirements are ANDed.
Type
array

.spec.pods[].selector.matchExpressions[]

Description
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
Type
object
Required
keyoperator
PropertyTypeDescription
keystring

key is the label key that the selector applies to.

operatorstring

operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.

valuesarray

values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.

.spec.pods[].selector.matchExpressions[].values

Description
values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.
Type
array

.spec.pods[].selector.matchExpressions[].values[]

Type
string

.spec.pods[].selector.matchLabels

Description
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
Type
object

API Endpoints

The following API endpoints are available:

  • /apis/cluster.x-k8s.io/v1beta1/namespaces/{namespace}/machinedrainrules
    • DELETE: delete collection of MachineDrainRule
    • GET: list objects of kind MachineDrainRule
    • POST: create a new MachineDrainRule
  • /apis/cluster.x-k8s.io/v1beta1/namespaces/{namespace}/machinedrainrules/{name}
    • DELETE: delete the specified MachineDrainRule
    • GET: read the specified MachineDrainRule
    • PATCH: partially update the specified MachineDrainRule
    • PUT: replace the specified MachineDrainRule

/apis/cluster.x-k8s.io/v1beta1/namespaces/{namespace}/machinedrainrules

HTTP method
DELETE
Description
delete collection of MachineDrainRule
HTTP responses
HTTP codeResponse body
200 - OKStatus schema
401 - UnauthorizedEmpty
HTTP method
GET
Description
list objects of kind MachineDrainRule
HTTP responses
HTTP codeResponse body
200 - OKMachineDrainRuleList schema
401 - UnauthorizedEmpty
HTTP method
POST
Description
create a new MachineDrainRule
Query parameters
ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.
Body parameters
ParameterTypeDescription
bodyMachineDrainRule schemaapplication/json formatted
HTTP responses
HTTP codeResponse body
200 - OKMachineDrainRule schema
201 - CreatedMachineDrainRule schema
202 - AcceptedMachineDrainRule schema
401 - UnauthorizedEmpty

/apis/cluster.x-k8s.io/v1beta1/namespaces/{namespace}/machinedrainrules/{name}

HTTP method
DELETE
Description
delete the specified MachineDrainRule
Query parameters
ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
HTTP responses
HTTP codeResponse body
200 - OKStatus schema
202 - AcceptedStatus schema
401 - UnauthorizedEmpty
HTTP method
GET
Description
read the specified MachineDrainRule
HTTP responses
HTTP codeResponse body
200 - OKMachineDrainRule schema
401 - UnauthorizedEmpty
HTTP method
PATCH
Description
partially update the specified MachineDrainRule
Query parameters
ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.
HTTP responses
HTTP codeResponse body
200 - OKMachineDrainRule schema
401 - UnauthorizedEmpty
HTTP method
PUT
Description
replace the specified MachineDrainRule
Query parameters
ParameterTypeDescription
dryRunstringWhen present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
fieldValidationstringfieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered.
Body parameters
ParameterTypeDescription
bodyMachineDrainRule schemaapplication/json formatted
HTTP responses
HTTP codeResponse body
200 - OKMachineDrainRule schema
201 - CreatedMachineDrainRule schema
401 - UnauthorizedEmpty