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

Allow route spec.host to be controlled by permission #13905

Conversation

smarterclayton
Copy link
Contributor

A new virtual resource routes/custom-host controls whether spec.host can be set a user

  • create is required to set a spec.host on creation
  • update is required to change spec.host at any subsequent change

Project admins and editors by default get create. Only cluster admin has update by default.

API compatibility is preserved for the error message returned by immutable fields.

@smarterclayton
Copy link
Contributor Author

@smarterclayton
Copy link
Contributor Author

[test] also fixed for ingress at the same time

@smarterclayton smarterclayton force-pushed the make_route_set_require_permission branch from 9c24314 to f6b0681 Compare April 27, 2017 22:04
@sttts
Copy link
Contributor

sttts commented Apr 28, 2017

@smarterclayton seeing the same flake upstream as well:
https://github.com/kubernetes/kubernetes/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20%22Scaling%20down%20before%20scale%20up%20is%20finished%20should%22

We have only whitelisted issues with Basic StatefulSet functionality \[StatefulSetBasic\] should provide basic identity. Do you mean that cherry-pick?

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

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

LGTM

@knobunc knobunc requested a review from rajatchopra April 28, 2017 12:42
@liggitt liggitt reopened this Apr 28, 2017
@liggitt
Copy link
Contributor

liggitt commented Apr 28, 2017

Silly github

@@ -22,19 +22,26 @@ import (
// HostGeneratedAnnotationKey is the key for an annotation set to "true" if the route's host was generated
const HostGeneratedAnnotationKey = "openshift.io/host.generated"

// Registry is an interface for performing subject access reviews
Copy link
Contributor

Choose a reason for hiding this comment

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

s/Registry/SubjectAccessReview

@smarterclayton
Copy link
Contributor Author

Open question - do @Miciah do you want to gate setting custom external certs on this permission? In practice I don't need a custom cert if I can't customize the route, UNLESS there is no default cert, in which case someone needs to generate one cert per endpoint. How common is that?

@rajatchopra
Copy link
Contributor

Open question - do @Miciah do you want to gate setting custom external certs on this permission? In practice I don't need a custom cert if I can't customize the route, UNLESS there is no default cert, in which case someone needs to generate one cert per endpoint. How common is that?

In my (unsubstantiated) view, very uncommon.

@Miciah
Copy link
Contributor

Miciah commented May 1, 2017

For Online, we want to allow either both custom host and certificate or neither.

@twiest, are you aware of a use-case in Dedicated for prohibiting a user to create a route with a custom host while allowing that user to create a route with a custom certificate?

@twiest
Copy link

twiest commented May 1, 2017

@Miciah I don't, but I'm probably not the right person to ask.

I think @spurtell or @sspeiche are probably better people to ask. They work much closer with the dedicated customers than I do.

In order to simplify control over custom routes (routes with a
non-default spec.host), make using a custom host field require the
"create" verb on "routes/custom-host". By default, admin and edit within
a project will get this permission. Users are also prohibited from
setting or altering certificates without this permission.

Integrators who want to prohibit this can drop the permission from the
role and only allow cluster administrators to fill that field.
@smarterclayton smarterclayton force-pushed the make_route_set_require_permission branch from f6b0681 to bef5a17 Compare May 6, 2017 21:26
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bef5a17

@smarterclayton
Copy link
Contributor Author

Gated setting destinationCACertificate, caCertificate, key, and certificate by the permission as well. Justification:

  1. Custom hosts is pretty powerful (take others names, camp)
  2. Custom certs are less powerful (hurt yourself, but deny everything if there is a bug)

Custom certs aren't useful unless you have custom hosts, or your admin won't configure the router to use a default wildcard. If they don't use a wildcard, it's usually because they want you to generate your own cert. If they do that, they can still ignore the default hostname on the router side.

Backwards compatible for existing routes, and for clusters that run reconcile on upgrade for new routes.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/1213/) (Base Commit: 34cda05)

@smarterclayton
Copy link
Contributor Author

Any other review comments from anyone?

@abhgupta
Copy link
Member

The latest comments from you on this PR satisfy the Online use cases perfectly - no additional comments from me.

@smarterclayton
Copy link
Contributor Author

[merge] based on review comments.

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to bef5a17

@openshift-bot
Copy link
Contributor

openshift-bot commented May 15, 2017

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/648/) (Base Commit: 7e3e3c7) (Image: devenv-rhel7_6228)

@openshift-bot openshift-bot merged commit b38274c into openshift:master May 15, 2017
res, err := s.sarClient.CreateSubjectAccessReview(
ctx,
&authorizationapi.SubjectAccessReview{
User: user.GetName(),
Copy link
Contributor

Choose a reason for hiding this comment

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

@deads2k just noticed this wasn't populating group and scope info... there's a helper for populating a subject access review with the correct user info from the context

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cribbed this from somewhere else as well. Helper I need?

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

Choose a reason for hiding this comment

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

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 it needs fixing in imagestreamimport.go

Copy link
Contributor

Choose a reason for hiding this comment

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

fixed in #14304

User: user.GetName(),
Action: authorizationapi.Action{
Verb: "create",
Group: api.GroupName,
Copy link
Contributor

Choose a reason for hiding this comment

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

@liggitt will this work for legacy api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants