Skip to content

Commit b0496f6

Browse files
committed
edits
1 parent 811b661 commit b0496f6

File tree

3 files changed

+40
-122
lines changed

3 files changed

+40
-122
lines changed

modules/nodes-scheduler-default-about.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ policy. If any of the default predicates and priorities are required,
4949
you must explicitly specify the functions in the policy configuration.
5050
====
5151

52-
.Default scheduler configuration file
52+
.Sample scheduler configuration file
5353
[source,json]
5454
----
5555
{

modules/nodes-scheduler-default-modifying.adoc

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@
1010
You change scheduling behavior by creating or editing your scheduler policy ConfigMap in the `openshift-config` project.
1111
Add and remove predicates and priorities to the ConfigMap to create a _scheduler policy_.
1212

13+
.Typical predicate string
14+
----
15+
\n\t{\"name\" : \"<PredicateName>\", \"label\" : \"<label>\", \"<condition>\" : \"<state>\"},
16+
----
17+
* `name` is the name of the predicate, such as `labelsPresence`.
18+
* `label` and `<label>` is the node label:value pair to match to apply the predicate, such `label:rack`.
19+
* `<condition>` and `<state>` is when the predicate should be applied, such as `presence:true`.
20+
21+
.Typical priority string
22+
----
23+
\n\t{\"name\" : \"<PredicateName>\", \"label\" : \"<label>\", \"<condition>\" : \"<state>\", \"weight\" : <weight>},
24+
----
25+
* `name` is the name of the priority, such as `labelsPresence`.
26+
* `label` and `<label>` is the node `label:value` pair to match to apply the priority, such `label:rack`.
27+
* `<condition>` and `<state>` is when the priority should be applied, such as `presence:true`.
28+
* `weight` and `<weight> is the numerical weight to apply to the priority.
29+
1330
.Procedure
1431

1532
To modify the scheduler policy:
@@ -18,7 +35,7 @@ Edit the scheduler configuration file to configure the desired
1835
predicates and priorities.
1936
+
2037
.Sample modified scheduler configuration map
21-
[source,json]
38+
[source,yaml]
2239
----
2340
kind: ConfigMap
2441
apiVersion: v1
@@ -33,15 +50,18 @@ data:
3350
policy.cfg: "{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"PodFitsHostPorts\"},\n\t{\"name\" : \"PodFitsResources\"},\n\t{\"name\" : \"NoDiskConflict\"},\n\t{\"name\" : \"NoVolumeZoneConflict\"},\n\t{\"name\" : \"MatchNodeSelector\"},\n\t{\"name\" : \"HostName\"}\n\t],\n\"priorities\" : [\n\t{\"name\" : \"LeastRequestedPriority\", \"weight\" : 10},\n\t{\"name\" : \"BalancedResourceAllocation\", \"weight\" : 1},\n\t{\"name\" : \"ServiceSpreadingPriority\", \"weight\" : 1},\n\t{\"name\" : \"EqualPriority\", \"weight\" : 1}\n\t]\n}\n"
3451
----
3552
+
36-
For example, the following adds the `labelPreference` priority giving a weight of 2 to the `rack` label on a node:
53+
For example, the following strings add the `labelpresence` predicate requiring the `rack` label on the nodes and the `labelPreference` priority giving a weight of 2 to the `rack` label:
3754
+
55+
[source,yaml]
3856
----
57+
\n\t{\"name\" : \"labelPresence\", \"label\" : \"rack\", \"presence\" : \"true\"},
3958
\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t
4059
-----
4160

4261
The ConfigMap appears as following with the new priority:
4362
+
63+
[source,yaml]
4464
----
45-
policy.cfg: "{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"PodFitsHostPorts\"},\n\t{\"name\" : \"PodFitsResources\"},\n\t{\"name\" : \"NoDiskConflict\"},\n\t{\"name\" : \"NoVolumeZoneConflict\"},\n\t{\"name\" : \"MatchNodeSelector\"},\n\t{\"name\" : \"HostName\"}\n\t],\n\"priorities\" : [\n\t{\"name\" : \"LeastRequestedPriority\", \"weight\" : 10},\n\t{\"name\" : \"BalancedResourceAllocation\", \"weight\" : 1},\n\t{\"name\" : \"ServiceSpreadingPriority\", \"weight\" : 1},\n\t{\"name\" : \"EqualPriority\", \"weight\" : 1},\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t]\n}\n "
65+
policy.cfg: "{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"PodFitsHostPorts\"},\n\t{\"name\" : \"PodFitsResources\"},\n\t{\"name\" : \"NoDiskConflict\"},\n\t{\"name\" : \"NoVolumeZoneConflict\"},\n\t{\"name\" : \"MatchNodeSelector\"},\n\t{\"name\" : \"HostName\"},\n\t{\"name\" : \"labelPresence\", \"label\" : \"rack\", \"presence\" : \"true\"}\n\t],\n\"priorities\" : [\n\t{\"name\" : \"LeastRequestedPriority\", \"weight\" : 10},\n\t{\"name\" : \"BalancedResourceAllocation\", \"weight\" : 1},\n\t{\"name\" : \"ServiceSpreadingPriority\", \"weight\" : 1},\n\t{\"name\" : \"EqualPriority\", \"weight\" : 1},\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t]\n}\n "
4666
----
4767

modules/nodes-scheduler-default-sample.adoc

Lines changed: 16 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,23 @@
66
= Sample Policy Configurations
77

88
The configuration below specifies the default scheduler configuration, if it
9-
were to be specified via the scheduler policy file.
9+
were to be specified using the scheduler policy file.
1010

1111
[source,yaml]
1212
----
13-
kind: "Policy"
14-
version: "v1"
15-
predicates:
16-
...
17-
- name: "RegionZoneAffinity" <1>
18-
argument:
19-
serviceAffinity: <2>
20-
labels: <3>
21-
- "region"
22-
- "zone"
23-
priorities:
24-
...
25-
- name: "RackSpread" <4>
26-
weight: 1
27-
argument:
28-
serviceAntiAffinity: <5>
29-
label: "rack" <6>
13+
kind: ConfigMap
14+
apiVersion: v1
15+
metadata:
16+
name: mypolicy
17+
namespace: openshift-config
18+
selfLink: /api/v1/namespaces/openshift-config/configmaps/mypolicy
19+
uid: 83917dfb-4422-11e9-b2c9-0a5e37b2b12e
20+
resourceVersion: '1100851'
21+
creationTimestamp: '2019-03-11T17:24:23Z'
22+
data:
23+
policy.cfg: "{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"PodFitsHostPorts\"},\n\t{\"name\" : \"PodFitsResources\"},\n\t{\"name\" : \"NoDiskConflict\"},\n\t{\"name\" : \"NoVolumeZoneConflict\"},\n\t{\"name\" : \"MatchNodeSelector\"},\n\t{\"name\" : \"HostName\"}\n\t],\n\"priorities\" : [\n\t{\"name\" : \"LeastRequestedPriority\", \"weight\" : 10},\n\t{\"name\" : \"BalancedResourceAllocation\", \"weight\" : 1},\n\t{\"name\" : \"ServiceSpreadingPriority\", \"weight\" : 1},\n\t{\"name\" : \"EqualPriority\", \"weight\" : 1},\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t]\n}\n "
3024
----
3125

32-
<1> The name for the predicate.
33-
<2> The type of predicate.
34-
<3> The labels for the predicate.
35-
<4> The name for the priority.
36-
<5> The type of priority.
37-
<6> The labels for the priority.
3826

3927
In all of the sample configurations below, the list of predicates and priority
4028
functions is truncated to include only the ones that pertain to the use case
@@ -45,120 +33,30 @@ The following example defines three topological levels, region (affinity) -> zon
4533

4634
[source,yaml]
4735
----
48-
kind: "Policy"
49-
version: "v1"
50-
predicates:
51-
...
52-
- name: "RegionZoneAffinity"
53-
argument:
54-
serviceAffinity:
55-
labels:
56-
- "region"
57-
- "zone"
58-
priorities:
59-
...
60-
- name: "RackSpread"
61-
weight: 1
62-
argument:
63-
serviceAntiAffinity:
64-
label: "rack"
36+
"{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"RegionZoneAffinity\", \"label\" : \"region\", \"label\" : \"zone\"}\n\t],\n\"priorities\" : [\n\t{\"name\" : \"serviceAntiAffinity\", \"label\" : \"rack\", \"weight\" : 1},\n\t]\n}\n"
6537
----
6638

6739
The following example defines three topological levels, city (affinity) -> building
6840
(anti-affinity) -> room (anti-affinity):
6941

7042
[source,yaml]
7143
----
72-
kind: "Policy"
73-
version: "v1"
74-
predicates:
75-
...
76-
- name: "CityAffinity"
77-
argument:
78-
serviceAffinity:
79-
labels:
80-
- "city"
81-
priorities:
82-
...
83-
- name: "BuildingSpread"
84-
weight: 1
85-
argument:
86-
serviceAntiAffinity:
87-
label: "building"
88-
- name: "RoomSpread"
89-
weight: 1
90-
argument:
91-
serviceAntiAffinity:
92-
label: "room"
44+
"{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"serviceAffinityy\", \"label\" : \"city\"},\n\t],\n\"priorities\" : [\n\t{\"name\" : \"serviceAntiAffinity\", \"label\" : \"building\" \"weight\" : 1}, \n\t{\"name\" : \"serviceAntiAffinity\", \"label\" : \"room\" \"weight\" : 1},\n\t]\n}\n"
9345
----
9446

9547
The following example defines a policy to only use nodes with the 'region' label defined and prefer nodes with the 'zone'
9648
label defined:
9749

9850
[source,yaml]
9951
----
100-
kind: "Policy"
101-
version: "v1"
102-
predicates:
103-
...
104-
- name: "RequireRegion"
105-
argument:
106-
labelsPresence:
107-
labels:
108-
- "region"
109-
presence: true
110-
priorities:
111-
...
112-
- name: "ZonePreferred"
113-
weight: 1
114-
argument:
115-
labelPreference:
116-
label: "zone"
117-
presence: true
52+
"{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"labelsPresence\", \"label\" : \"region\", \"presence\" : \"true\"},\n\t],\n\"priorities\" : [\n\t{\"name\" : \"ZonePreferred\", \"label\" : \"zone\", \"presence\" : \"true\", \"weight\" : 1},\n\t]\n}\n"
11853
----
11954

12055
The following example combines both static and configurable predicates and
12156
also priorities:
12257

12358
[source,yaml]
12459
----
125-
kind: "Policy"
126-
version: "v1"
127-
predicates:
128-
...
129-
- name: "RegionAffinity"
130-
argument:
131-
serviceAffinity:
132-
labels:
133-
- "region"
134-
- name: "RequireRegion"
135-
argument:
136-
labelsPresence:
137-
labels:
138-
- "region"
139-
presence: true
140-
- name: "BuildingNodesAvoid"
141-
argument:
142-
labelsPresence:
143-
labels:
144-
- "building"
145-
presence: false
146-
- name: "PodFitsPorts"
147-
- name: "MatchNodeSelector"
148-
priorities:
149-
...
150-
- name: "ZoneSpread"
151-
weight: 2
152-
argument:
153-
serviceAntiAffinity:
154-
label: "zone"
155-
- name: "ZonePreferred"
156-
weight: 1
157-
argument:
158-
labelPreference:
159-
label: "zone"
160-
presence: true
161-
- name: "ServiceSpreadingPriority"
162-
weight: 1
60+
"{\n\"kind\" : \"Policy\",\n\"apiVersion\" : \"v1\",\n\"predicates\" : [\n\t{\"name\" : \"labelsPresence\", \"label\" : \"building\", \"presence\" : \"true\"}, \n\t{\"name\" : \"PodFitsHostPorts\"},\n\t{\"name\" : \"MatchNodeSelector\"},\n\t],\n\"priorities\" : [\n\t{\"name\" : \"ZonePreferred\", \"label\" : \"zone\", \"presence\" : \"true\", \"weight\" : 1},\n\t]\n}\n \"
16361
----
16462

0 commit comments

Comments
 (0)