Skip to content

Commit 47af3a7

Browse files
authored
Merge pull request #14058 from mburke5678/BZ-1684395
the description of scheduler policy-configmap's project is conflicting
2 parents 4de10a0 + 4d4c083 commit 47af3a7

6 files changed

+176
-270
lines changed

modules/nodes-scheduler-default-about.adoc

Lines changed: 17 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -49,94 +49,26 @@ 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
{
56-
"apiVersion": "v1",
57-
"kind": "Policy",
58-
"predicates": [
59-
{
60-
"name": "NoVolumeZoneConflict"
61-
},
62-
{
63-
"name": "MaxEBSVolumeCount"
64-
},
65-
{
66-
"name": "MaxGCEPDVolumeCount"
67-
},
68-
{
69-
"name": "MaxAzureDiskVolumeCount"
70-
},
71-
{
72-
"name": "MatchInterPodAffinity"
73-
},
74-
{
75-
"name": "NoDiskConflict"
76-
},
77-
{
78-
"name": "GeneralPredicates"
79-
},
80-
{
81-
"name": "PodToleratesNodeTaints"
82-
},
83-
{
84-
"name": "CheckNodeMemoryPressure"
85-
},
86-
{
87-
"name": "CheckNodeDiskPressure"
88-
},
89-
{
90-
"argument": {
91-
"serviceAffinity": {
92-
"labels": [
93-
"region"
94-
]
95-
}
96-
},
97-
"name": "Region"
98-
99-
}
100-
],
101-
"priorities": [
102-
{
103-
"name": "SelectorSpreadPriority",
104-
"weight": 1
105-
},
106-
{
107-
"name": "InterPodAffinityPriority",
108-
"weight": 1
109-
},
110-
{
111-
"name": "LeastRequestedPriority",
112-
"weight": 1
113-
},
114-
{
115-
"name": "BalancedResourceAllocation",
116-
"weight": 1
117-
},
118-
{
119-
"name": "NodePreferAvoidPodsPriority",
120-
"weight": 10000
121-
},
122-
{
123-
"name": "NodeAffinityPriority",
124-
"weight": 1
125-
},
126-
{
127-
"name": "TaintTolerationPriority",
128-
"weight": 1
129-
},
130-
{
131-
"argument": {
132-
"serviceAntiAffinity": {
133-
"label": "zone"
134-
}
135-
},
136-
"name": "Zone",
137-
"weight": 2
138-
}
139-
]
56+
"kind" : "Policy",
57+
"apiVersion" : "v1",
58+
"predicates" : [
59+
{"name" : "PodFitsHostPorts"},
60+
{"name" : "PodFitsResources"},
61+
{"name" : "NoDiskConflict"},
62+
{"name" : "NoVolumeZoneConflict"},
63+
{"name" : "MatchNodeSelector"},
64+
{"name" : "HostName"}
65+
],
66+
"priorities" : [
67+
{"name" : "LeastRequestedPriority", "weight" : 1},
68+
{"name" : "BalancedResourceAllocation", "weight" : 1},
69+
{"name" : "ServiceSpreadingPriority", "weight" : 1},
70+
{"name" : "EqualPriority", "weight" : 1}
71+
]
14072
}
14173
----
14274

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * nodes/nodes-scheduler-default.adoc
4+
5+
[id='nodes-scheduler-default-creating_{context}']
6+
= Creating a scheduler policy file
7+
8+
//Made changes to this file to match https://github.com/openshift/openshift-docs/pull/13626/files#diff-ba6ab177a3e2867eaefe07f48bd6e158
9+
10+
You can control change the default scheduling behavior using a ConfigMap in the `openshift-config` project.
11+
Add and remove predicates and priorities to the ConfigMap to create a _scheduler policy_.
12+
13+
.Sample scheduler configuration map
14+
[source,yaml]
15+
----
16+
kind: ConfigMap
17+
apiVersion: v1
18+
metadata:
19+
name: scheduler-policy
20+
namespace: openshift-config
21+
selfLink: /api/v1/namespaces/openshift-config/configmaps/mypolicy
22+
uid: 83917dfb-4422-11e9-b2c9-0a5e37b2b12e
23+
resourceVersion: '1049773'
24+
creationTimestamp: '2019-03-11T17:24:23Z'
25+
data:
26+
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"
27+
----
28+
29+
.Procedure
30+
31+
To create the scheduler policy:
32+
33+
. Create the a JSON file with the desired predicates and priorities.
34+
+
35+
.Sample scheduler JSON file
36+
[source,json]
37+
----
38+
{
39+
"kind" : "Policy",
40+
"apiVersion" : "v1",
41+
"predicates" : [ <1>
42+
{"name" : "PodFitsHostPorts"},
43+
{"name" : "PodFitsResources"},
44+
{"name" : "NoDiskConflict"},
45+
{"name" : "NoVolumeZoneConflict"},
46+
{"name" : "MatchNodeSelector"},
47+
{"name" : "HostName"}
48+
],
49+
"priorities" : [ <2>
50+
{"name" : "LeastRequestedPriority", "weight" : 1},
51+
{"name" : "BalancedResourceAllocation", "weight" : 1},
52+
{"name" : "ServiceSpreadingPriority", "weight" : 1},
53+
{"name" : "EqualPriority", "weight" : 1}
54+
]
55+
}
56+
----
57+
<1> Add the predicates as needed.
58+
<2> Add the priorities as needed.
59+
60+
. Create a ConfigMap based on the JSON file:
61+
+
62+
----
63+
$ oc create configmap -n openshift-config --from-file=policy.cfg <configmap-name>
64+
----
65+
+
66+
For example:
67+
+
68+
----
69+
$ oc create configmap -n openshift-config --from-file=policy.cfg scheduler-policy
70+
71+
configmap/scheduler-policy created
72+
----
73+
74+
. Edit the *_scheduler.yaml_* file, installed by default, to add the ConfigMap.
75+
+
76+
----
77+
apiVersion: config.openshift.io/v1
78+
kind: Scheduler
79+
metadata:
80+
name: cluster
81+
spec: {}
82+
policy:
83+
name: scheduler-policy
84+
----
85+
86+
. Create the `scheduler` object:
87+
+
88+
----
89+
$ oc create -f scheduler.yaml
90+
----

modules/nodes-scheduler-default-modifying.adoc

Lines changed: 47 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,77 +7,60 @@
77

88
//Made changes to this file to match https://github.com/openshift/openshift-docs/pull/13626/files#diff-ba6ab177a3e2867eaefe07f48bd6e158
99

10-
You change scheduling behavior by editing the ConfigMap named `policy-configmap`, by default in `openshift-config` project.
10+
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:
1633

17-
. Edit the scheduler configuration file to configure the desired
34+
Edit the scheduler configuration file to configure the desired
1835
predicates and priorities.
19-
+
20-
.Sample modified scheduler configuration file
21-
[source,json]
36+
37+
.Sample modified scheduler configuration map
38+
[source,yaml]
2239
----
23-
apiVersion: componentconfig/v1alpha1
24-
kind: KubeSchedulerConfiguration
25-
clientConnection:
26-
kubeconfig: /etc/kubernetes/static-pod-resources/secrets/scheduler-kubeconfig/kubeconfig
27-
algorithmSource:
28-
policy:
29-
configMap:
30-
name: "policy-configmap"
31-
namespace: "openshift-config" <1>
32-
"predicates": [ <2>
33-
{
34-
"name": "PodFitsResources"
35-
},
36-
{
37-
"name": "NoDiskConflict"
38-
},
39-
{
40-
"name": "MatchNodeSelector"
41-
},
42-
{
43-
"name": "HostName"
44-
},
45-
{
46-
"argument": {
47-
"serviceAffinity": {
48-
"labels": [
49-
"region"
50-
]
51-
}
52-
},
53-
"name": "Region"
54-
}
55-
],
56-
"priorities": [ <3>
57-
{
58-
"name": "LeastRequestedPriority",
59-
"weight": 1
60-
},
61-
{
62-
"name": "BalancedResourceAllocation",
63-
"weight": 1
64-
},
65-
{
66-
"name": "ServiceSpreadingPriority",
67-
"weight": 1
68-
},
69-
{
70-
"argument": {
71-
"serviceAntiAffinity": {
72-
"label": "zone"
73-
}
74-
},
75-
"name": "Zone",
76-
"weight": 2
77-
}
78-
]
40+
kind: ConfigMap
41+
apiVersion: v1
42+
metadata:
43+
name: scheduler-policy
44+
namespace: openshift-config
45+
selfLink: /api/v1/namespaces/openshift-config/configmaps/mypolicy
46+
uid: 83917dfb-4422-11e9-b2c9-0a5e37b2b12e
47+
resourceVersion: '1049773'
48+
creationTimestamp: '2019-03-11T17:24:23Z'
49+
data:
50+
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"
7951
----
80-
<1> The project for the ConfigMap.
81-
<2> Add the predicates as needed.
82-
<3> Add the priorities as needed.
8352

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:
54+
55+
[source,yaml]
56+
----
57+
\n\t{\"name\" : \"labelPresence\", \"label\" : \"rack\", \"presence\" : \"true\"},
58+
\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t
59+
----
60+
61+
The ConfigMap appears as following with the new priority:
62+
63+
[source,yaml]
64+
----
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 "
66+
----

0 commit comments

Comments
 (0)