Project Based Authorization

Pre-requisites

Setup

  • Set the policies in the seldon-deploy-policy ConfigMap as shown here:

cat << EOF | kubectl apply -n seldon-system -f -
apiVersion: v1
kind: ConfigMap
metadata:
  name: seldon-deploy-policies
data:
  data: '{
  "role_grants": {
    "data-scientist": [
      {
        "resource": "project/iris",
        "action": "read"
      }
    ]
  },
  "user_grants": {
    "*": [
      {
        "resource": "namespace/seldon",
        "action": "read"
      },
      {
        "resource": "project/default",
        "action": "read"
      },
    ],
    "alice": [
      {
        "resource":"namespace/seldon",
        "action":"write"
      },
      {
        "resource": "project/default",
        "action": "write"
      }
      {
        "resource": "project/income",
        "action": "write"
      },
      {
        "resource": "project/income",
        "action": "read"
      },
      {
        "resource": "project/movie",
        "action": "read"
      },
      {
        "resource": "project/movie",
        "action": "write"
      }
    ]
  }
}'
EOF

Note how all users (*) will have access to the seldon namespace and default project. Seldon Deploy should automatically pick up the changes in the ConfigMap after a few seconds, but if you want to reload it immediately you can restart the Seldon Deploy pod.

Confirm Policies Are Working

  1. Log in as alice.

    alice login

  2. Go to the Model Catalog page and create the following models:

URI

Project

Artifact type

1

gs://seldon-models/scv2/samples/rolling/iris/v1

default

SciKit Learn

2

gs://seldon-models/scv2/examples/mlserver_1.3.0/income/classifier

income

SciKit Learn

3

gs://seldon-models/scv2/examples/moviesentiment/classifierr

movie

SciKit Learn

4

gs://seldon-models/v1.15.0/sklearn/moviesentiment

default

SciKit Learn

create models

  1. Create a pipeline for the first 3 models using the Deploy functionality from the Model Catalog. Make sure to change from the default deployment type to Seldon ML Pipeline. Confirm all both deployments are shown in the Overview tab.

    The pipeline names could be:

    • iris-default

    • income-income

    • movie-movie

(create pipelines

  1. Log out from the alice profile and log in as bob.

    As you can see bob can only see the pipeline in the default project.

    bob pipelines

  2. Confirm bob only sees models in the default project and not in income and movie

    bob models

  3. Confirm that bob can not edit model metadata

model metadata fail

  1. Confirm that bob can not delete a model

model delete fail