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 webhook admission proposal with "convert to webhook-requested version" #802

Merged
merged 2 commits into from
Apr 25, 2019

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented Feb 1, 2019

follow up to #736 (comment) with proposed design for "conversion to requested-version" capability (#736 (comment))

/sig api-machinery
/assign @lavalamp @deads2k @mbohlool

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Feb 1, 2019
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/pm size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 1, 2019
@liggitt liggitt mentioned this pull request Feb 1, 2019
@deads2k
Copy link
Contributor

deads2k commented Feb 1, 2019

separate and just merge teh line breaks?

@liggitt
Copy link
Member Author

liggitt commented Feb 1, 2019

separate and just merge teh line breaks?

done - #803

@liggitt liggitt force-pushed the admission branch 3 times, most recently from a09216f to 6cad97a Compare February 4, 2019 16:06
@liggitt liggitt changed the title add webhook admission auto-conversion update webhook admission proposal with "convert to webhook-requested version" Feb 4, 2019
@liggitt
Copy link
Member Author

liggitt commented Feb 4, 2019

limited this to the proposed "convert to webhook-requested version" behavior, for discussion during 1.14.

Moved requested updates for items planned for 1.14 to #806 and marks those as implementable.

@caesarxuchao
Copy link
Member

/sub

@mbohlool
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 13, 2019
@caesarxuchao
Copy link
Member

RE. the discussion in the SIG meeting regarding whether to use ResourceID to decide if the apiserver should attempt a conversion. Jordan answered that instead, we should leave it to the apiserver to build an internal map based on if the apiserver knows how to convert two resources. The reason Jordan gave was that even if the ResourceID showed two resource are referring to the same set of objects, as long as the apiserver didn't know how to convert, there was little the apiserver could do.

I think that's actually what we want to capture. The apiserver should fire an alert in this case, because it means that attackers can walk around the webhook to modify the protected resource by visiting the unconvertible resource, defeating the purpose of this KEP.

Also, note that even if two resource endpoints are convertible, as long as they refer to different objects in etcd, a webhook probably doesn't want to intercept requests to both endpoints. If that's the case, then to build the internal map, the knowledge of if two kinds are convertible isn't enough, the apiserver needs to do the same analysis it does when populating the ResourceID, i.e., analyse the etcd path of the resource.

@liggitt
Copy link
Member Author

liggitt commented Mar 13, 2019

because it means that attackers can walk around the webhook to modify the protected resource by visiting the unconvertible resource

The webhook should only receive resources that are stored in the same location as the resources they registered for. If they are stored in the same location, they must be convertible.

the knowledge of if two kinds are convertible isn't enough, the apiserver needs to do the same analysis it does when populating the ResourceID, i.e., analyse the etcd path of the resource.

I agree with that. The question is how we build the map of colocated group/resource/versions.

@caesarxuchao
Copy link
Member

I think the apiserver will build such a mapping once. The webhook controller will use the mapping directly. The same mapping will be used to populate the ResourceID.

@liggitt
Copy link
Member Author

liggitt commented Apr 8, 2019

I've started looking into building the mapping, but I don't think we need to hold the design bits on that part of the implementation

ping @lavalamp @deads2k

// Webhook describes an admission webhook and the resources and operations it applies to.
type Webhook struct {
...
// ConversionPolicy describes whether the webhook wants to be called when a request is made
Copy link
Member

Choose a reason for hiding this comment

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

As described here, isn't it an "InterceptionPolicy"?

Copy link
Member Author

Choose a reason for hiding this comment

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

changed to MatchPolicy: Exact | Equivalent

keps/sig-api-machinery/00xx-admission-webhooks-to-ga.md Outdated Show resolved Hide resolved
keps/sig-api-machinery/00xx-admission-webhooks-to-ga.md Outdated Show resolved Hide resolved
// Allowed values are Ignore or Convert.
// "Ignore" means the request should be ignored.
// "Convert" means the request should be converted to a kind corresponding to a resource matched by "rules", and sent to the webhook.
// Defaults to Convert.
Copy link
Member

Choose a reason for hiding this comment

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

Is there a solid use case for ever setting it to ignore? It seems super backwards compatible, do we even need this option? (I didn't reread the whole kep, maybe the reasoning exists and I missed it.)

Copy link
Member Author

Choose a reason for hiding this comment

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

we use per-version defaulting and admission logic in rest handlers today, this gives equivalent power to out-of-tree admission

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 22, 2019
@liggitt
Copy link
Member Author

liggitt commented Apr 22, 2019

addressed comments

@lavalamp
Copy link
Member

/lgtm
/approve

matchPolicy: equivalent is much more understandable, thanks.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lavalamp, liggitt, mbohlool

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 25, 2019
@k8s-ci-robot k8s-ci-robot merged commit a089146 into kubernetes:master Apr 25, 2019
@liggitt liggitt deleted the admission branch April 26, 2019 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. 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.

7 participants