Skip to content

Commit 811b661

Browse files
committed
the description of scheduler policy-configmap's project is conflicting
1 parent e1872e6 commit 811b661

6 files changed

+116
-149
lines changed

modules/nodes-scheduler-default-about.adoc

Lines changed: 16 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -53,90 +53,22 @@ you must explicitly specify the functions in the policy configuration.
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: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
.Procedure
14+
15+
To create the scheduler policy:
16+
17+
. Create the a JSON file with the desired predicates and priorities.
18+
+
19+
.Sample scheduler JSON file
20+
[source,json]
21+
----
22+
{
23+
"kind" : "Policy",
24+
"apiVersion" : "v1",
25+
"predicates" : [ <1>
26+
{"name" : "PodFitsHostPorts"},
27+
{"name" : "PodFitsResources"},
28+
{"name" : "NoDiskConflict"},
29+
{"name" : "NoVolumeZoneConflict"},
30+
{"name" : "MatchNodeSelector"},
31+
{"name" : "HostName"}
32+
],
33+
"priorities" : [ <2>
34+
{"name" : "LeastRequestedPriority", "weight" : 1},
35+
{"name" : "BalancedResourceAllocation", "weight" : 1},
36+
{"name" : "ServiceSpreadingPriority", "weight" : 1},
37+
{"name" : "EqualPriority", "weight" : 1}
38+
]
39+
}
40+
----
41+
<1> Add the predicates as needed.
42+
<2> Add the priorities as needed.
43+
44+
. Create a ConfigMap based on the JSON file:
45+
+
46+
----
47+
$ oc create configmap -n openshift-config --from-file=policy.cfg scheduler-policy
48+
49+
configmap/scheduler-policy created
50+
----
51+
52+
. Edit the *_scheduler.yaml_* file, installed by default, to add the ConfigMap.
53+
+
54+
----
55+
apiVersion: config.openshift.io/v1
56+
kind: Scheduler
57+
metadata:
58+
name: cluster
59+
spec: {}
60+
policy:
61+
name: mypolicy
62+
----
63+
64+
. Create the `scheduler` object:
65+
+
66+
----
67+
$ oc create -f scheduler.yaml
68+
----

modules/nodes-scheduler-default-modifying.adoc

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -7,77 +7,41 @@
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

1313
.Procedure
1414

1515
To modify the scheduler policy:
1616

17-
. Edit the scheduler configuration file to configure the desired
17+
Edit the scheduler configuration file to configure the desired
1818
predicates and priorities.
1919
+
20-
.Sample modified scheduler configuration file
20+
.Sample modified scheduler configuration map
2121
[source,json]
2222
----
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-
]
23+
kind: ConfigMap
24+
apiVersion: v1
25+
metadata:
26+
name: mypolicy
27+
namespace: openshift-config
28+
selfLink: /api/v1/namespaces/openshift-config/configmaps/mypolicy
29+
uid: 83917dfb-4422-11e9-b2c9-0a5e37b2b12e
30+
resourceVersion: '1049773'
31+
creationTimestamp: '2019-03-11T17:24:23Z'
32+
data:
33+
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"
34+
----
35+
+
36+
For example, the following adds the `labelPreference` priority giving a weight of 2 to the `rack` label on a node:
37+
+
38+
----
39+
\n\t{\"name\" : \"labelPreference\", \"label\" : \"rack\", \"presence\" : \"true\", \"weight\" : 2},\n\t
40+
-----
41+
42+
The ConfigMap appears as following with the new priority:
43+
+
44+
----
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 "
7946
----
80-
<1> The project for the ConfigMap.
81-
<2> Add the predicates as needed.
82-
<3> Add the priorities as needed.
8347

modules/nodes-scheduler-default-sample.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
The configuration below specifies the default scheduler configuration, if it
99
were to be specified via the scheduler policy file.
1010

11+
[source,yaml]
1112
----
1213
kind: "Policy"
1314
version: "v1"

modules/nodes-scheduler-node-projects-about.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ After the pod is created, the node selectors are merged into the pod so that the
1111

1212
The Pod Node Selector admission controller also allows you to create a list of labels that are permitted in a specific project. This list acts as a whitelist that lets developers know what labels are acceptable to use in a project and gives administrators greater control over labeling in a cluster.
1313

14-
The Pod Node Selector uses the annotation key scheduler.alpha.kubernetes.io/node-selector to assign node selectors to namespaces.
14+
The Pod Node Selector uses the annotation key `scheduler.alpha.kubernetes.io/node-selector` to assign node selectors to namespaces.
1515

1616
[source,yaml]
1717
----

nodes/scheduling/nodes-scheduler-default.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ particular node.
2323

2424
include::modules/nodes-scheduler-default-about.adoc[leveloffset=+1]
2525

26+
include::modules/nodes-scheduler-default-creating.adoc[leveloffset=+1]
27+
2628
include::modules/nodes-scheduler-default-modifying.adoc[leveloffset=+1]
2729

28-
include::modules/nodes-scheduler-default-predicates.adoc[leveloffset=+1]
30+
include::modules/nodes-scheduler-default-predicates.adoc[leveloffset=+2]
2931

30-
include::modules/nodes-scheduler-default-priorities.adoc[leveloffset=+1]
32+
include::modules/nodes-scheduler-default-priorities.adoc[leveloffset=+2]
3133

3234
include::modules/nodes-scheduler-default-sample.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)