|
7 | 7 |
|
8 | 8 | //Made changes to this file to match https://github.com/openshift/openshift-docs/pull/13626/files#diff-ba6ab177a3e2867eaefe07f48bd6e158
|
9 | 9 |
|
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. |
11 | 11 | Add and remove predicates and priorities to the ConfigMap to create a _scheduler policy_.
|
12 | 12 |
|
| 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 | + |
13 | 30 | .Procedure
|
14 | 31 |
|
15 | 32 | To modify the scheduler policy:
|
16 | 33 |
|
17 |
| -. Edit the scheduler configuration file to configure the desired |
| 34 | +Edit the scheduler configuration file to configure the desired |
18 | 35 | predicates and priorities.
|
19 |
| -+ |
20 |
| -.Sample modified scheduler configuration file |
21 |
| -[source,json] |
| 36 | + |
| 37 | +.Sample modified scheduler configuration map |
| 38 | +[source,yaml] |
22 | 39 | ----
|
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" |
79 | 51 | ----
|
80 |
| -<1> The project for the ConfigMap. |
81 |
| -<2> Add the predicates as needed. |
82 |
| -<3> Add the priorities as needed. |
83 | 52 |
|
| 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