Skip to content

Default RBAC for Elafros resources #664

Closed

Description

@mattmoor

The default RBAC settings for Elafros resources are a mystery to me (K8s defaults).

Most folks manipulating these today are contributors, and therefore typically also cluster admins.

We should provide a reasonable default set of RBAC bindings, but what exactly that is also requires some amount of documentation.

At a minimum, it is expected that the default RBAC would restrict who may create Revision resources, to encourage folks to do so through the Service and Configuration resources instead.

Activity

  1. added
    kind/feature
    kind/doc
    area/API
    on Apr 16, 2018
  2. asciimike commented on Apr 18, 2018

    @asciimike

    My proposal is as follows: Editor, Viewer, ServiceEditor, Configurer, Releaser, and (eventually) Builder. I'm open to better names on all of these :)

    Example:

    # Create an Elafros editor role
    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: elafros-editor
      namespace: default
    rules:
    - apiGroups: ["elafros.dev/v1alpha1"]
      resources: ["service", "route", "revision", "configuration"]
      verbs: ["get", "watch", "list", "create", "update", "delete"]
    -------
    # Create an Elafros viewer role
    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: elafros-viewer
      namespace: default
    rules:
    - apiGroups: ["elafros.dev/v1alpha1"]
      resources: ["service", "route", "revision", "configuration"]
      verbs: ["get", "watch", "list"]

    The curated roles for Configurer and Releaser are straightforward in that they look the same but are only applied to the specific resources (Configuration, Route).

    The ServiceEditor role is likely implemented similarly, though it's more powerful in that a Service can create and manipulate the underlying resources. Unfortunately, the story of going from "automatic mode" in a Service to "manual mode" (direct control of underlying resources) will require a developer providing new RoleBindings on each component resource (they will also need to have permissions to do so), as there's no inheritance of RBAC policies.

    Another open question: do we want a role for Revision viewer separate from the ability to either configure the Service or release a new Revision?

  3. evankanderson commented on Apr 23, 2018

    @evankanderson
    Member

    I'm leery of adding a lot of complexity on initial install. Can we limit the roles to 1-2 user-assigned roles, plus whatever "system" roles we need to make the components like our controller, prometheus, ELK, etc?

    I expect that most operators who aren't just kicking the tires will probably want to create their own custom roles to grant access to Elafros + whatever other resources in the cluster are appropriate for their development workflow. (For example, "builder" might actually be more popular than any of the compute-related ones.)

    My $0.02 is to have a "Developer" role like the following:

    kind: Role
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: elafros-developer
      namespace: default
    rules:
    - apiGroups: ["elafros.dev/v1alpha1"]
      resources: ["service", "build"] + eventing types
      verbs: ["get", "watch", "list", "create", "update", "delete"]
    # Can look under the hood, but don't access directly.
    - apiGroups: ["elafros.dev/v1alpha1"]
      resources: ["*"]
      verbs: ["get", "watch", "list"]
    - apiGroups: ["core.v1"]
      resources: ["pod", "replicaset", "deployment"]
      verbs: ["get", "watch", "list"]
    # Add similar for ELK, Istio, or Prometheus?
  4. mattmoor commented on Jul 8, 2018

    @mattmoor
    ContributorAuthor

    Closing in favor of #1131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/APIkind/dockind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions