Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Scheduler Docs #10742

Merged
merged 1 commit into from Aug 1, 2018
Merged

Update Scheduler Docs #10742

merged 1 commit into from Aug 1, 2018

Conversation

mburke5678
Copy link
Contributor

@mburke5678 mburke5678 commented Jul 10, 2018

From BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1596472
1. _Wrong statements or examples that I can tell:
Predicates [3] are boolean functions, they return true/false. The example is wrong, it does not make sense to have a weigh in a predicate. Both ServiceAffinity and LabelsPresence Configurable Predicates examples are wrong.

Configurable priorities [4] examples are wrong.
They apply only to one label. So label must be in singular "label", not "labels"

Weight can be any positive value. It does not need to range between 0 and 10. Actually, in [5] you can see a default weight of 10000 in a function._

2. Do we want to add:
Service-Anti-Affinity based on custom labels is not recommended to achieve equal distribution of pods across multiple zones... it's highly recommended to use failure-domain.beta.kubernetes.io/region and failure-domain.beta.kubernetes.io/zone node label
https://access.redhat.com/solutions/3432401

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 10, 2018
@mburke5678
Copy link
Contributor Author

mburke5678 commented Jul 10, 2018

@aveshagarwal @ravisantoshgudimetla I worked you on this topic some time back via #7313

Can you PTAL at admin_guide/scheduling/scheduler.adoc to address Jorge's concerns in https://bugzilla.redhat.com/show_bug.cgi?id=1596472

@mburke5678
Copy link
Contributor Author

@aveshagarwal @ravisantoshgudimetla PTAL at my changes and recommend any other changes?

Jorge Luis Tudela Gonzalez de Riancho
The scheduler doc topic [1] contains some bad examples and inaccurate statements.
...someone from Engineering should deeply review this.

https://bugzilla.redhat.com/show_bug.cgi?id=1596472

1 similar comment
@mburke5678
Copy link
Contributor Author

@aveshagarwal @ravisantoshgudimetla PTAL at my changes and recommend any other changes?

Jorge Luis Tudela Gonzalez de Riancho
The scheduler doc topic [1] contains some bad examples and inaccurate statements.
...someone from Engineering should deeply review this.

https://bugzilla.redhat.com/show_bug.cgi?id=1596472

@aveshagarwal
Copy link

@mburke5678 Could you remove weight from the following stanza: https://github.com/openshift/openshift-docs/pull/10742/files#diff-c881c052264120bfc3a506b42de92c15R481

         "name":"RackPreferred",
         "weight" : "1"
         "argument":{
            "labelsPresence":{
               "labels":[
                  "rack"
            "labelsPresence:"{
                "labels:"[
                - "region"
                presence: true

@aveshagarwal
Copy link

@mburke5678 also the above part is incorrectly formatted.

@@ -634,7 +629,7 @@ concentration of pods.
]
----
<1> Specify a name for the priority.
<2> Specify a weight from 1 (bad fit) to 10 (best fit).
<2> Specify a weight. Weight can be any positive value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be negative too.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-zero.

@@ -657,22 +652,20 @@ regardless of its value.
"predicates":[

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be priorities.

"<label>" <3>
presence: true/false <4>
"<label>" <2>
presence: true/false <3>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the above part seems completely incorrect. We are talking about priorities and label preference but the above shows predicate and label presence. The above should be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aveshagarwal I changed these parameters back to how they were in previous version, before the changes to the scheduling topic were made.
Did you see @jtudelag comments in the BZ: _scheduling based on custom labels does not work... Most of the examples then do not apply.... I am not sure what needs to be changed. It looks like the examples at the bottom have been there for quite some time.

Copy link

@jtudelag jtudelag Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mburke5678, I guess what @aveshagarwal means is that first of all, this is a priority function, not a predicate. Then it is "LabelPreference", not "LabelsPresence".

Also, as a function, It always should have a weight. It is still correct in OCP 3.5 examples:
https://docs.openshift.com/container-platform/3.5/admin_guide/scheduler.html#configurable-priority-functions

It was wrongly modifies in 3.6, probably a copy paste (as the file was moved in the doc hierarchy) shit happens ;)
https://docs.openshift.com/container-platform/3.6/admin_guide/scheduling/scheduler.html#configurable-priority-functions

So I guess a backport of all these changes should be done to 3.6 ,3.7 and 3.9.

Main question is if this is still honoured by the scheduler in OCP. Also, the explanation of what the LabelPreference function does should be re-written, as now it is just a copy paste of the LabelPresence predicate. @aveshagarwal should answer these questions, I dont have enought knowledge to do it ;(.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, now I have Configurable Priority: LabelPreference, with weight, and label singlular/
Configurable Predicate: LabelsPresence, no weight and labels plural. Also has presence: true/false.
Need a definition for LabelPreference. They are slightly different
LabelPreference prefers nodes that have a particular label defined or not, regardless of its value.
LabelsPresence checks whether a particular node has a certain label defined or not, regardless of its value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mburke5678, I guess what @aveshagarwal means is that first of all, this is a priority function, not a predicate. Then it is "LabelPreference", not "LabelsPresence".

Also, as a function, It always should have a weight. It is still correct in OCP 3.5 examples:
https://docs.openshift.com/container-platform/3.5/admin_guide/scheduler.html#configurable-priority-functions

+1

Main question is if this is still honoured by the scheduler in OCP.

If I understand your questions correctly so yes LabelPreference and LabelPresence still work.

Also, the explanation of what the LabelPreference function does should be re-written, as now it is just a copy paste of the LabelPresence predicate. @aveshagarwal should answer these questions, I dont have enought knowledge to do it ;(.

+1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, now I have Configurable Priority: LabelPreference, with weight, and label singlular/

Correct. LabelPreference also has presense: true/false

Configurable Predicate: LabelsPresence, no weight and labels plural. Also has presence: true/false.

correct.

Need a definition for LabelPreference. They are slightly different
LabelPreference prefers nodes that have a particular label defined or not, regardless of its value.
LabelsPresence checks whether a particular node has a certain label defined or not, regardless of its value.

From the code for LabelPreference:

// LabelPreference holds the parameters that are used to configure the corresponding priority function
type LabelPreference struct {
        // Used to identify node "groups"
        Label string `json:"label"`
        // This is a boolean flag
        // If true, higher priority is given to nodes that have the label
        // If false, higher priority is given to nodes that do not have the label
        Presence bool `json:"presence"`
}

From the code for LabelPresence :

// LabelsPresence holds the parameters that are used to configure the corresponding predicate in scheduler policy configuration.
type LabelsPresence struct {
        // The list of labels that identify node "groups"
        // All of the labels should be either present (or absent) for the node to be considered a fit for hosting the pod
        Labels []string `json:"labels"`
        // The boolean flag that indicates whether the labels should be present or absent from the node
        Presence bool `json:"presence"`
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aveshagarwal
"If true, higher priority is given to nodes that have the label"

What is "true" in this case? The presence of the specified label on a node?

**_LabelPreference_** give priority based on the specified label. If the label is present on a node, that node is given priority. If no label is specified, priority is given to nodes that do not have a label.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "true" in this case? The presence of the specified label on a node?

Yes.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

presence should be quoted

@openshift-docs-preview-bot

The preview will be availble shortly at:

@mburke5678
Copy link
Contributor Author

@wjiangjay PTAL

@@ -241,6 +241,12 @@ you require.
# master-restart api master-restart controllers
----

[NOTE]
====
There are cases where using configuring scheduler policy to use custom labels does not spread pod as expected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mburke5678 I'm not a native speaker, but "using configuring scheduler policy" does not seem grammarly correct.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to mention that is only about ServiceAntiAffinity specifically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtudelag You are correct. I saw that, too; but hadn't pushed the change yet. Thank you.
@aveshagarwal I reworded the note to mention ServiceAntiAffinity and moved it to that section.
https://github.com/openshift/openshift-docs/pull/10742/files#diff-c881c052264120bfc3a506b42de92c15R648

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mburke5678 lgtm.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mburke5678 lgtm too ;).

"labelsPreference":{
"label":[
"label":[ <3>
"rack"
Copy link

@ghost ghost Aug 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two label here?

]
}
}
}
],
----
<1> Specify a name for the predicate.
<2> Specify a weight from 1 (bad fit) to 10 (best fit).
<3> Specify a label for matching.
<2> Specify a label for matching.
For example:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example: should be started with newline

@ghost
Copy link

ghost commented Aug 1, 2018

Others LGTM

@mburke5678
Copy link
Contributor Author

@avesh
Can you take a quick look at the changes I made from @wjiangjay comments above?
Line 659 presence: true/false <3> Presence should have be quoted
SB
presence: "true/false"

Line 667 Two labels here?
Should be:

"labelsPreference":{
     "labels":[
           "<label>"
  ]

@mburke5678
Copy link
Contributor Author

@openshift/team-documentation PTAL

Copy link
Contributor

@kalexand-rh kalexand-rh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of picks, suggestions, and questions.

]
}
}
}
],
----
<1> Specify a name for the predicate.
<2> Specify a weight from 1 (bad fit) to 10 (best fit).
<3> Specify a label for matching.
<2> Specify a label for matching.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/for matching/to match ?

defined or not, regardless of its value. Matching by label can be useful, for
example, where nodes have their physical location or status defined by labels.
**_LabelsPresence_** checks whether a particular node has a specific label. The labels create node _groups_ that the
`LabelPreference` priority uses. Matching by label can be useful, for example, where nodes have their physical location or status defined by labels.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/`LabelPreference`/`labelPreference` ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is correct (I think). Passed dev and QE reviews.

**_LabelsPresence_** checks whether a particular node has a certain label
defined or not, regardless of its value. Matching by label can be useful, for
example, where nodes have their physical location or status defined by labels.
**_LabelsPresence_** checks whether a particular node has a specific label. The labels create node _groups_ that the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/**_LabelsPresence_**\The `labelsPresence` parameter

<2> Specify a weight from 1 (bad fit) to 10 (best fit).
<3> Specify a label for matching.
<4> Specify whether the labels are required.
<2> Specify a label for matching.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/for matching/to match

"<label>" <3>
presence: true/false <4>
"<label>" <2>
presence: "true/false" <3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd s/"true/false"/"true" and specify the valid parameters in annotation 3.

----
<1> Specify a name for the priority.
<2> Specify a weight. Weight can be any non-zero positive value.
<3> Specify a label for matching.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/for matching/to match

regardless of its value.
[NOTE]
====
There are situations when using `ServiceAntiAffinity` based on custom labels does not spread pod as expected.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/There are situations when/In some situations,

See link:https://access.redhat.com/solutions/3432401[this Red Hat Solution].
====

**_LabelPreference_** gives priority based on the specified label.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/**_LabelPreference_**\The `labelPreference` parameter

----
<1> Specify a name for the priority.
<2> Specify a weight. Weight can be any non-zero positive value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Weight can be/Enter

]
}
}
}
],
----
<1> Specify a name for the priority.
<2> Specify a weight from 1 (bad fit) to 10 (best fit).
<2> Specify a weight. Weight can be any non-zero positive value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Weight can be/Enter

@kalexand-rh kalexand-rh added the peer-review-done Signifies that the peer review team has reviewed this PR label Aug 1, 2018
@aveshagarwal
Copy link

@mburke5678 lgtm.

**_LabelsPresence_** checks whether a particular node has a certain label
defined or not, regardless of its value. Matching by label can be useful, for
example, where nodes have their physical location or status defined by labels.
The `abelsPresence` parameter checks whether a particular node has a specific label. The labels create node _groups_ that the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: abelsPresence (L) is missing

@mburke5678 mburke5678 merged commit f494843 into openshift:master Aug 1, 2018
@mburke5678 mburke5678 deleted the BZ-1596472 branch August 1, 2018 15:45
@mburke5678
Copy link
Contributor Author

/cherrypick enterprise-3.6

@openshift-cherrypick-robot

@mburke5678: new pull request created: #11277

In response to this:

/cherrypick enterprise-3.6

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mburke5678
Copy link
Contributor Author

/cherrypick enterprise-3.7

@openshift-cherrypick-robot

@mburke5678: new pull request created: #11278

In response to this:

/cherrypick enterprise-3.7

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mburke5678
Copy link
Contributor Author

/cherrypick enterprise-3.9

@mburke5678
Copy link
Contributor Author

/cherrypick enterprise-3.10

@openshift-cherrypick-robot

@mburke5678: new pull request created: #11279

In response to this:

/cherrypick enterprise-3.9

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-cherrypick-robot

@mburke5678: new pull request created: #11280

In response to this:

/cherrypick enterprise-3.10

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mburke5678
Copy link
Contributor Author

/cherrypick enterprise-3.11

@openshift-cherrypick-robot

@mburke5678: new pull request created: #11281

In response to this:

/cherrypick enterprise-3.11

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

"<label>" <3>
presence: true/false <4>
"<label>" <2>
presence: "true" <3>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, the structure should be:

"predicates":[
      {
         "name":"<name>", (1)
         "argument":{
            "labelsPresence":{
               "labels":[
                  "<label>" (2)
                ],
                "presence": true (3)
            }
         }
      }
   ],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this change in a follow-up PR: #11335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
branch/enterprise-3.6 branch/enterprise-3.7 branch/enterprise-3.9 branch/enterprise-3.10 branch/enterprise-3.11 peer-review-done Signifies that the peer review team has reviewed this PR size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants