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

Fix admission-controllers section #4751

Merged
merged 1 commit into from
Sep 6, 2017

Conversation

tengqm
Copy link
Contributor

@tengqm tengqm commented Aug 11, 2017

This patch refactors the admin/admission-controllers section:

  • Reorder the built-in controllers based on their names

  • Added controllers that were not documented:

    * GenericAdmissionWebhook
    * Initializers
    * LimitPodHardAntiAffinity
    * NamespaceAutoProvision
    * NamespaceExists
    * OwnerReferencesPermissionEnforcement
    * PersistenVolumeLabel
    * PodPreset
    * PodTolerationRestrictio
    

Allow edits from maintainers checkbox


This change is Reviewable

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 11, 2017
@k8sio-netlify-preview-bot
Copy link
Collaborator

k8sio-netlify-preview-bot commented Aug 11, 2017

Deploy preview ready!

Built with commit d4b9363

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

@tengqm
Copy link
Contributor Author

tengqm commented Aug 11, 2017

To reviewers: this git diff is showing the patch in a funny way ... however, as summarized in the commit message, this patch did NOT change contents about documented controllers besides reordering them.
It also adds documentation about three controllers that were missing.

Copy link
Contributor

@chenopis chenopis left a comment

Choose a reason for hiding this comment

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

A few minor corrections requested.


This plug-in sets the default forgiveness toleration for pods, which have no forgiveness tolerations, to tolerate
the taints `notready:NoExecute` and `unreachable:NoExecute` for 5 minutes.
This plug-in automatically attach region or zone labels to PersistentVolumes
Copy link
Contributor

Choose a reason for hiding this comment

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

"attach" => "attaches"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

### PodPreset

This plug-in injects a pod with the fields specified in a matching PodPreset.
See also [Inject Information into Pods Using a PodPreset](/docs/tasks/inject-data-application/podpreset.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

The URL should be /docs/tasks/inject-data-application/podpreset/.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Future versions may add additional restrictions to ensure kubelets have the minimal set of permissions required to operate correctly.
This plug-in first verifies any conflict between a pod's tolerations and its
namespace's tolerations, and rejects the pod request if there is a conflict.
It then merge the namespace's tolerations into the pod's tolerations.
Copy link
Contributor

Choose a reason for hiding this comment

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

"merge" => "merges"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

namespace's tolerations, and rejects the pod request if there is a conflict.
It then merge the namespace's tolerations into the pod's tolerations.
The resulting tolerations are checked against the namespace's whitelist of
tolerations. If the checking succeeds, the pod request is admitted otherwise
Copy link
Contributor

Choose a reason for hiding this comment

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

"checking" => "check"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

This plug-in does not do anything when no default storage class is configured. When more than one storage
class is marked as default, it rejects any creation of `PersistentVolumeClaim` with an error and administrator
must revisit `StorageClass` objects and mark only one as default.
This plugin ignores any `PersistentVolumeClaim` updates, it acts only on creation.
Copy link
Contributor

Choose a reason for hiding this comment

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

"," => ";"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


It is strongly encouraged that this plug-in is configured last in the sequence of admission control plug-ins. This is
so that quota is not prematurely incremented only for the request to be rejected later in admission control.
### InitialResources (experimental)
Copy link
Member

Choose a reason for hiding this comment

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

Duplicate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will fix.

See [persistent volume](/docs/user-guide/persistent-volumes) documentation about persistent volume claims and
storage classes and how to mark a storage class as default.
This plug-in protects the access to the `blockOwnerDeletion` property of an object
so that only users with "delete" permission to the object can change it.
Copy link
Member

@caesarxuchao caesarxuchao Aug 21, 2017

Choose a reason for hiding this comment

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

This plug-in protects the access to metadata.ownerReferences of an object so that only users with "delete" permission to the object can change it.
This plug-in also protects the access to metadata.ownerReferences[x].blockOwnerDeletion of an object, so that only users with "delete" permission to the owner, i.e., the object referred by the ownerReference[x], can change 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.

thanks, will revise

@caesarxuchao
Copy link
Member

Also these sections lgtm:

  • GenericAdmissionWebhook
  • Initializers
  • NamespaceAutoProvision
  • NamespaceExists

@tengqm tengqm force-pushed the admission-controller-fix branch 2 times, most recently from 4e14448 to 97f72f7 Compare August 22, 2017 01:43
@chenopis chenopis removed the request for review from janetkuo August 22, 2017 22:47
@chenopis
Copy link
Contributor

@caesarxuchao Has everything been addressed?

@tengqm
Copy link
Contributor Author

tengqm commented Sep 5, 2017

@caesarxuchao PTAL, thanks.

@chenopis
Copy link
Contributor

chenopis commented Sep 5, 2017

@caesarxuchao Ping.

This plug-in protects the access to the `metadata.ownerReferences` of an object
so that only users with "delete" permission to the object can change it.
This plug-in also protects the access to `metadata.ownerReferences[x].blockOwnerDeletion`
of an object, so that only users with "delete" permission to the *owner* (i.e,
Copy link
Member

Choose a reason for hiding this comment

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

This one needs update after kubernetes/kubernetes#49133 gets merged.

so that only users with "update" permission to the `finalizers` subresource of the referenced *owner* can change it.


This plug-in observes creation of `PersistentVolumeClaim` objects that do not request any specific storage class
and automatically adds a default storage class to them.
This way, users that do not request any special storage class do no need to care about them at all and they
Copy link
Member

Choose a reason for hiding this comment

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

s/no/not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops~ done.


### SecurityContextDeny
This plug-in is related to the [Dynamic Admission Control](/docs/admin/extensible-admission-controllers)
introduced in v1.7.
Copy link
Member

Choose a reason for hiding this comment

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

I think you can explain further:

It determines initializers of a resource based on existing InitializerConfigurations , sets the pending initializers on the resource metadata and blocks the Create request until all pending initializers complete.

this is my understanding, @caesarxuchao to confirm

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. Description revised.

@tengqm tengqm force-pushed the admission-controller-fix branch from 97f72f7 to 0f50a9e Compare September 6, 2017 03:09
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 6, 2017
Copy link
Member

@caesarxuchao caesarxuchao 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 comments for the other plugins. I only learnt them recently so I could be wrong. Otherwise LGTM.

### DefaultTolerationSeconds

This plug-in sets the default forgiveness toleration for pods, which have no forgiveness tolerations, to tolerate
the taints `notready:NoExecute` and `unreachable:NoExecute` for 5 minutes.
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a little more accurate: "This plug-in sets the default forgiveness toleration for pods to tolerate the taints notready:NoExecute and unreachable:NoExecute for 5 minutes, if the pods don't already have toleration for taints notready:NoExecute or unreachable:NoExecute."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay.

@@ -78,6 +98,11 @@ If your cluster supports containers that run with escalated privileges, and you
restrict the ability of end-users to exec commands in those containers, we strongly encourage
enabling this plug-in.

### GenericAdmissionWebhook (alpha)

This plug-in is related to the [Dynamic Admission Control](/docs/admin/extensible-admission-controllers)
Copy link
Member

Choose a reason for hiding this comment

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

This plug-in calls the webhooks configured via ExternalAdmissionHookConfiguration, and only admits the operation if all the webhooks admit it. Currently the plugin always fails open, i.e., ignore the failed call to a webhook.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

introduced in v1.7.
The plug-in determines the initializers of a resource based on the existing
`InitializerConfiguration`s. It sets the pending initializers by modifying the
metadata of the resource to be created and and then blocks the resource create
Copy link
Member

Choose a reason for hiding this comment

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

and and then blocks the resource create request until all pending initializers have completed is not very accurate. The apiserver blocks the CREATE call for 30s and then returns a 504. I think it's fine if we end the description at by modifying the metadata of the resource. Readers can refer to the linked doc for details.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay.


This plug-in will deny any pod that attempts to set certain escalating [SecurityContext](/docs/user-guide/security-context) fields. This should be enabled if a cluster doesn't utilize [pod security policies](/docs/user-guide/pod-security-policy) to restrict the set of values a security context can take.
This plug-in observes pod creation requests. If a container omits compute resource requests and limits,
then the plug-in auto-populates a compute resource request based on historical usage of containers running the same image.
Copy link
Member

Choose a reason for hiding this comment

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

I think it's worth mentioning the estimated resource requests are set in annotations, rather than the actual container.resources fields.

Copy link
Contributor Author

@tengqm tengqm Sep 6, 2017

Choose a reason for hiding this comment

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

the description already uses "annotates" as the verb, but I'm okay with more clarifications.

This patch refactors the admin/admission-controllers section:

- Reorder the built-in controllers based on their names
- Added controllers that were not documented:

* GenericAdmissionWebhook
* Initializers
* LimitPodHardAntiAffinity
* NamespaceAutoProvision
* NamespaceExists
* OwnerReferencesPermissionEnforcement
* PersistenVolumeLabel
* PodPreset
* PodTolerationRestriction
@tengqm tengqm force-pushed the admission-controller-fix branch from 0f50a9e to d4b9363 Compare September 6, 2017 05:29
@chenopis chenopis merged commit ee64185 into kubernetes:master Sep 6, 2017
@tengqm tengqm deleted the admission-controller-fix branch September 28, 2017 04:44
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.

6 participants