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

improve detail of podtolerationrestriction behavior #7135

Conversation

colemickens
Copy link
Contributor

@colemickens colemickens commented Jan 30, 2018

similar to #7134

This PR:

  1. Clarifies the behavior of the PodTolerationRestriction admission controller.
  2. Promote the documented annotations to stable, as per the v1.10 release.

This targets release-1.10.

This PR is dependent on this Kubernetes PR: kubernetes/kubernetes#58818


This change is Reviewable

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 30, 2018
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 30, 2018
@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Jan 30, 2018

Deploy preview for kubernetes-io-master-staging ready!

Built with commit 2dcf4b2

https://deploy-preview-7135--kubernetes-io-master-staging.netlify.com

1. First, the default tolerations for a given namespace are determined:

i. If the namespace contains an annotation with the key `scheduler.alpha.kubernetes.io/default-tolerations`
and a non-empty, the value of the annotation will be considered as the default tolerations for the namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

"and a non-empty"?

and a non-empty, the value of the annotation will be considered as the default tolerations for the namespace.

ii. If the namespace lacks an annotation with the key `scheduler.alpha.kubernetes.io/default-tolerations`, then
the cluster defaults will be used as the default tolerations for the namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

Reads will ask "what are the cluster defaults? how to set these defaults?"

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 31, 2018
`scheduler.alpha.kubernetes.io/tolerationsWhitelist`
annotation keys.
This admission controller defaults and limits what tolerations may be used on Pods in a given namespace.
The plugin will build a list of defaults, and a whitelist of allows tolerations based on annotations on the namespace.
Copy link
Contributor

Choose a reason for hiding this comment

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

allows -> allowed

When the namespace does not specify a whitelist, the namespace-specifc whitelist from the plugin configuration are used.

**Note:** If the annotations are specified, but empty, they are considered to override the cluster-level defaults.
{: .note}
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

value: value1
- key: key2
value: value2
```
Copy link
Contributor

Choose a reason for hiding this comment

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

line 541-551 should be unindented


PodTolerationRestriction uses a configuration file to define:

1. A cluster-wide default node selector (this is used if the `` annotation is not present on the target Namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this line won't format correctly.
What did you mean by "`` annotation" ?


1. A cluster-wide default node selector (this is used if the `` annotation is not present on the target Namespace)

2. Namespace-specific default whitelists (these are used if the `` annotation is not present on the target Namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

here too

2. Namespace-specific default whitelists (these are used if the `` annotation is not present on the target Namespace)

Note that the configuration file format will move to a versioned file in a future release.
This file may be json or yaml and has the following format:
Copy link
Contributor

Choose a reason for hiding this comment

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

use "JSON or YAML" when appropriate


#### Internal Logic

1. Determine the `Pod`'s effective tolerations:
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to add "`" around Pod here?
Also no need to add it around Namespace blow.

@heckj
Copy link
Contributor

heckj commented Feb 7, 2018

/assign @tengqm

@heckj
Copy link
Contributor

heckj commented Feb 24, 2018

@colemickens if this targets the 1.10 release, could you retarget this PR against the release-1.10 branch please?

@Bradamant3
Copy link
Contributor

@colemickens see comment ^^ from Joe Heck about retargeting against the release-1.10 branch. We need it by 3/9 (tomorrow). Thanks!

@colemickens
Copy link
Contributor Author

The changes didn't merge. I'll rebase and retarget for 1.11.

@Bradamant3 Bradamant3 removed this from the 1.10 milestone Mar 8, 2018
@Bradamant3
Copy link
Contributor

/hold

waiting on 1.11 branch for docs, which we don't want to create yet. Too much churn with merging master.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 8, 2018
@Bradamant3 Bradamant3 added this to the 1.11 milestone Mar 8, 2018
@zacharysarah
Copy link
Contributor

@colemickens 👋 1.11 release branch is open; changing base to 1.11.

@zacharysarah zacharysarah changed the base branch from master to release-1.11 April 11, 2018 18:37
@zacharysarah zacharysarah force-pushed the release-1.11 branch 2 times, most recently from 2231db1 to 7a66f56 Compare April 17, 2018 19:28
@zacharysarah
Copy link
Contributor

@MistyHacks This PR will be affected by any changes to release-1.11 and obviously by the Hugo migration.

@mdlinville mdlinville force-pushed the podtolerationrestriction-docs branch from 2dcf4b2 to 6255030 Compare May 16, 2018 18:42
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: bradamant3

Assign the PR to them by writing /assign @bradamant3 in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8sio-netlify-preview-bot
Copy link
Collaborator

Deploy preview for kubernetes-io-vnext-staging ready!

Built with commit 6255030

https://deploy-preview-7135--kubernetes-io-vnext-staging.netlify.com

@mdlinville
Copy link
Contributor

The underlying structure of the docs repository has changed due to the recent
Hugo migration. Specifically, all the files previously under docs/ are now in
content/en/docs/. I have rebased your PR without changing any of your work, so
that your changes are modifying the affected files in the new location, so this
PR is now reviewable again.

If you were using Github's web UI rather than a local Git client, you can stop
reading and continue working in this PR.

If you use the Git command-line client, you will need to make sure your local
branch is up to date with your fork. If you have local commits that have not
been pushed to your fork, it may be complicated to get them back.
Do git log
and note their commit hashes for later.

Assuming your your fork's remote is called origin, hard-reset your local
branch to be the same as your fork's branch:

git fetch origin; git reset --hard origin/podtolerationrestriction-docs

If you didn't have local commits, you're now ready to keep working on this PR
locally. You can stop reading now.

If you did have local commits, cherry-pick them from oldest to newest. For
each commit that needs to be cherry-picked:

git cherry-pick <HASH>

You will need to resolve conflicts in these cherry-picked commits, which
involves moving your modified files into the correct new location. All the
content in docs/ moved to content/en/docs/, so you can move your local files
accordingly:

  • Do git add for each of the moved files
  • Do git mergetool and accept the
    deleted rather than modified file
  • Continue the cherry-pick by doing git cherry-pick --continue

When you've cherry-picked all local commits back onto the local branch, push the
branch (with new commits) to your fork. You should not need to force the push.

@mdlinville
Copy link
Contributor

/no-hold

@tengqm @xiangpengzhao please re-review.

@mdlinville
Copy link
Contributor

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 16, 2018
Copy link
Contributor

@mdlinville mdlinville left a comment

Choose a reason for hiding this comment

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

I left some comments. All links need to be updated to the new structure where everything is under /content/en/docs/ instead of /docs/. Admonitions need to be updated to use Hugo shortcodes. I found some typos and formatting problems too. Others should be nominated for technical review of the content.

```shell
kube-apiserver --disable-admission-plugins=PodNodeSelector,AlwaysDeny ...
```
{: .note}
Copy link
Contributor

Choose a reason for hiding this comment

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


Rejects all requests. AlwaysDeny is DEPRECATED as no real meaning.
Rejects all requests. Used for testing.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove all double spacing from the file.

@@ -140,9 +134,11 @@ enabling this admission controller.

### EventRateLimit (alpha)

This admission controller mitigates the problem where the API server gets flooded by
This admission controller is introduced in v1.9 to mitigate the problem where the API server gets flooded by
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to specify the version? That version will be n-2 when 1.11 ships.

@@ -184,16 +180,19 @@ for more details.

### ExtendedResourceToleration

This plug-in facilitates creation of dedicated nodes with extended resources.
This plug-in is introduced in v1.9 to facilitate creation of dedicated nodes with extended resources.
Copy link
Contributor

Choose a reason for hiding this comment

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

Same concern as above wrt mentioning a version.

@@ -316,23 +314,24 @@ In any case, the annotations are provided by the user and are not validated by K

### Initializers (alpha)

This admission controller is introduced in v1.7.
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, is the version relevant? 1.7 will be the oldest supported version when 1.11 ships, if I understand it correctly.

If the pod's namespace does not have any associated default or whitelist of
tolerations, then the cluster-level default or whitelist of tolerations are used
instead if specified.
2. Namespace-specific default whitelists (these are used if the `` annotation is not present on the target Namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

As above.

`scheduler.alpha.kubernetes.io/defaultTolerations` and
`scheduler.alpha.kubernetes.io/tolerationsWhitelist`
annotation keys.
Note that the configuration file format will move to a versioned file in a future release.
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Note that//

`scheduler.alpha.kubernetes.io/tolerationsWhitelist`
annotation keys.
Note that the configuration file format will move to a versioned file in a future release.
This file may be json or yaml and has the following format:
Copy link
Contributor

Choose a reason for hiding this comment

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

If JSON or YAML are both allowed, why not have a JSON example too?

plugins:
- name: PodTolerationRestriction
path: podtolerationrestriction.yaml
...
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to include a complete and usable YAML example instead of the ellipses?

@@ -582,7 +622,7 @@ fails. This admission controller only runs in the validation phase; the webhooks
mutate the object, as opposed to the webhooks called by the `MutatingAdmissionWebhook` admission controller.

If a webhook called by this has side effects (for example, decrementing quota) it
*must* have a reconciliation system, as it is not guaranteed that subsequent
*must* have a reconcilation system, as it is not guaranteed that subsequent
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert introduced typo here.

@mdlinville
Copy link
Contributor

I was wrong about the need to change /docs/ to /content/en/docs/ so you can ignore the request to do that. The things about Hugo shortcodes still need to be addressed.

@colemickens
Copy link
Contributor Author

@MistyHacks This doc change is dependent on PRs that are stalled out and are not actively being worked on. Additionally, much of the feedback provided applies to sections of the Admin Controllers document that this PR was not meant to address. I think it would probably be a good idea to open a new tracking issue for the various other Hugo/etc changes that are needed to this document. (If the PRs ever proceed, I will certainly incorporate the feedback you left for the PTR/PNS controllers.)

@@ -9,7 +9,8 @@ reviewers:
title: Using Admission Controllers
---

{{< toc >}}
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be put back.

@@ -1,5 +1,5 @@
---
reviewers:
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be reverted.

@mdlinville
Copy link
Contributor

mdlinville commented May 18, 2018

@colemickens The Hugo problems in this PR are already fixed in the release-1.11 branch and this PR somehow is undoing them. In those places, the changes need to be removed from this PR. The PR happened before the Hugo migration and I rebased it to try to preserve the real work in the PR from needing to be redone. If it's easier for the author to redo the work in a new PR based on release-1.11 rather than remove the lines this PR changes that should not now be changed (such as line 2 in content/en/docs/admin/admission-controllers.md) then that is fine too.

@mdlinville
Copy link
Contributor

Also I see that the upstream PR this PR depends upon has been closed without merging. Does that mean this one should be closed too?

@colemickens
Copy link
Contributor Author

Yes, I am going to close it. The things that looked like me undoing the Hugo updates should've gone away on their own, had I rebased my own changes, but given the current state, I'm not going to bother and will just close.

@sftim
Copy link
Contributor

sftim commented Jan 25, 2020

Somewhat related: PR #18849

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants