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

描述
MachineDrainRule is the Schema for the MachineDrainRule API.
类型
object
必填
metadataspec

规格

属性类型描述
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

描述
spec defines the spec of a MachineDrainRule.
类型
object
必填
drain
属性类型描述
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

描述
drain configures if and how Pods are drained.
类型
object
必填
behavior
属性类型描述
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

描述
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
类型
array

.spec.machines[]

描述
MachineDrainRuleMachineSelector defines to which Machines this MachineDrainRule should be applied.
类型
object
属性类型描述
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

描述
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.
类型
object
属性类型描述
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

描述
matchExpressions is a list of label selector requirements. The requirements are ANDed.
类型
array

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

描述
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
类型
object
必填
keyoperator
属性类型描述
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

描述
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.
类型
array

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

类型
string

.spec.machines[].clusterSelector.matchLabels

描述
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.
类型
object

.spec.machines[].selector

描述
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.
类型
object
属性类型描述
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

描述
matchExpressions is a list of label selector requirements. The requirements are ANDed.
类型
array

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

描述
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
类型
object
必填
keyoperator
属性类型描述
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

描述
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.
类型
array

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

类型
string

.spec.machines[].selector.matchLabels

描述
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.
类型
object

.spec.pods

描述
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
类型
array

.spec.pods[]

描述
MachineDrainRulePodSelector defines to which Pods this MachineDrainRule should be applied.
类型
object
属性类型描述
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

描述
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.
类型
object
属性类型描述
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

描述
matchExpressions is a list of label selector requirements. The requirements are ANDed.
类型
array

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

描述
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
类型
object
必填
keyoperator
属性类型描述
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

描述
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.
类型
array

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

类型
string

.spec.pods[].namespaceSelector.matchLabels

描述
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.
类型
object

.spec.pods[].selector

描述
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.
类型
object
属性类型描述
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

描述
matchExpressions is a list of label selector requirements. The requirements are ANDed.
类型
array

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

描述
A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
类型
object
必填
keyoperator
属性类型描述
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

描述
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.
类型
array

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

类型
string

.spec.pods[].selector.matchLabels

描述
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.
类型
object

API 端点

可用的 API 端点如下:

  • /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 方法
DELETE
描述
delete collection of MachineDrainRule
HTTP 响应
HTTP 状态码响应体
200 - OKStatus schema
401 - UnauthorizedEmpty
HTTP 方法
GET
描述
list objects of kind MachineDrainRule
HTTP 响应
HTTP 状态码响应体
200 - OKMachineDrainRuleList schema
401 - UnauthorizedEmpty
HTTP 方法
POST
描述
create a new MachineDrainRule
查询参数
参数类型描述
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.
请求体参数
参数类型描述
bodyMachineDrainRule schemaapplication/json formatted
HTTP 响应
HTTP 状态码响应体
200 - OKMachineDrainRule schema
201 - CreatedMachineDrainRule schema
202 - AcceptedMachineDrainRule schema
401 - UnauthorizedEmpty

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

HTTP 方法
DELETE
描述
delete the specified MachineDrainRule
查询参数
参数类型描述
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 响应
HTTP 状态码响应体
200 - OKStatus schema
202 - AcceptedStatus schema
401 - UnauthorizedEmpty
HTTP 方法
GET
描述
read the specified MachineDrainRule
HTTP 响应
HTTP 状态码响应体
200 - OKMachineDrainRule schema
401 - UnauthorizedEmpty
HTTP 方法
PATCH
描述
partially update the specified MachineDrainRule
查询参数
参数类型描述
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 响应
HTTP 状态码响应体
200 - OKMachineDrainRule schema
401 - UnauthorizedEmpty
HTTP 方法
PUT
描述
replace the specified MachineDrainRule
查询参数
参数类型描述
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.
请求体参数
参数类型描述
bodyMachineDrainRule schemaapplication/json formatted
HTTP 响应
HTTP 状态码响应体
200 - OKMachineDrainRule schema
201 - CreatedMachineDrainRule schema
401 - UnauthorizedEmpty