- URL:
- https://<root>/services/<ServiceName>.<ServiceType>/placementPolicy/edit
- Methods:
POST
- Required Capability:
- Access allowed with the "Security and infrastructure" privilege
- Version Introduced:
- 11.2
Description
The edit
operation allows administrators to set or modify the node affinity and tolerations for a GIS service's pods. Node affinity allows for pods to be scheduled to nodes that have matching label key-value pairs, whereas tolerations allow for pods to be scheduled on tainted nodes that would otherwise repel them if not for matching toleration and taint key-value pairs. For more information on configuring the node
and tolerations
properties, see the Node affinity and Tolerations sections below.
Node affinity
Before establishing node affinity, a label must be placed on an individual node or added to node pools so that newly created or recycled nodes inherit the same label. A label is comprised of key-value pairs (key=value) that are to attract specific pods to be scheduled on that node. This is done by configuring a GIS service's pods node
property to use the same label key and value information as the node. Below is the general JSON syntax for node
:
"nodeAffinity": {
"<requiredDuringSchedulingIgnoredDuringExecution | preferredDuringSchedulingIgnoredDuringExecution>": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "<label key>",
"operator": "<In | NotIn | Exists | DoesNotExist>",
"values": [
"<label value>"
]
}
]
}
]
}
}
The key
and values
information, along with an operator
value that specifies the relationship between node
properties and the node's labels, are evaluated along with whether the matching values are required or preferred during scheduling in order to determine where the service's pods are scheduled.
For example, a node receives the following label:
kubectl label nodes exampleNode sampleLabel=sampleValue
and an administrator wants to require that the key (sample
) and value (sample
) information is present on a GIS service's pods in order for them to be scheduled to a specific node. To achieve that outcome, the node
property would need to be configured with the exact key and value information applied to the node, as well as setting the required
property:
"nodeAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{
"matchExpressions": [
{
"key": "sampleLabel",
"operator": "In",
"values": [
"sampleValue"
]
}
]
}
]
}
}
Node affinity ensures that the scheduler will attempt to schedule pods with their matching nodes. However, it may not prevent other pods, that do not have matching key-value pairs, from being scheduled to labeled nodes. It will also not remove preexisting pods that have been scheduled to the node before the label was added. Administrators wanting to repel all pods that are not for a specific service may also want to taint the node.
Tolerations
Similarly to node affinity, tainting a node requires a key-value pair, as well as an effect, to be applied to a node. Applying a taint to a node ensures that all pods that do not tolerate the node are repelled from it and are scheduled to other available nodes instead. For a pod to tolerate a tainted node, the key
, values
, and effect
properties under tolerations
must either match the tainted values exactly or have just the key
value be present in the tolerations
property. Below is the general JSON syntax for tolerations
:
"tolerations": [
{
"effect": "<NoExecute | NoSchedule | PreferNoSchedule>",
"key": "<taint key>",
"operator": "<Exists | Equal>",
"value": "<taint value>"
}
]
The table below defines the different values that can be assigned to the effect
and operator
properties:
Value | Details |
---|---|
| Possible value for the |
| Possible value for the |
| Possible value for the |
| Possible value for the |
| Possible value for the |
To demonstrate how taints and tolerations interact, consider an administrator that wants to taint a node so that only tolerant pods will be schedule to the node, and that all preexisting pods on the node are expelled if they are not tolerant. To achieve this, a taint must first be applied to the node:
kubectl label nodes exampleNode sampleKey=sampleValue:NoSchedule
The exact values of the key
(sample
), value
(sample
), and effect
(No
) values used to taint the node would need to used to configure the toleration
property:
"tolerations": [
{
"effect": "NoSchedule",
"key": "sampleKey",
"operator": "Equal",
"value": "sampleValue"
}
]
Tainting a node and assigning tolerations to a service's pods ensures that the node is reserved for the pods that need the node's specialized resources, and that other pods that do not need certain resources can run on standard nodes.
Request parameters
Parameter | Details |
---|---|
| Returns the current Syntax
Example
|
| Specifies if the operation should be performed asynchronously. The default value is Values: |
| The response format. The default format is Values: |
Example usage
The following is a sample POST request for the edit
operation that demonstrates configuring tolerations for a feature service's pods:
POST /context/admin/services/CommercialDamageAssessment.FeatureServer/placementPolicy/edit HTTP/1.1
Host: organization.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
servicePlacementPolicy={"placementPolicy": [{"deploymentId": "kfnxectieft8iaxn3qka9","deploymentType": "FeatureServer","podPlacementPolicy":{"nodeAffinity":{},"tolerations": [{"effect": "NoSchedule","key": "label1","operator": "Equal","value": "test1"}]}}]}&f=pjson&token=Mb0ORrkLObNO2Q8FZoUCHHzSMzZi0CbhLHNRYMqqa6URG_ojQJF3rNsJAfRB23MyCrLwSmuaHPUo4AEIrUuoH1-4Ot5xh4565FtlQahXAhK2C7Sy0oydZhBwD8KdFSnVlnLr-e9uI5ovSWZ2lGNn9SwoV2MPMzeAh_5r-q-wgwF8DTT_nhuCXJGkMRy-48jjGS2aN5FI18STHZ8RAuKxGasH90SI3C7njZzlGCUrY5m6BDhCMsdpZA14GwNX8Cis
JSON Response
{"status": "success"}