Compare languages | Модуль user-authz: FAQ

Как создать пользователя?

How do I create a user?

Создание пользователя.

Creating a user.

Как ограничить права пользователю конкретными namespace?

How do I limit user rights to specific namespaces?

Использовать параметры namespaceSelector или limitNamespaces (устарел) в custom resource ClusterAuthorizationRule.

Use the namespaceSelector or limitNamespaces (deprecated) parameters in the ClusterAuthorizationRule CR.

Что, если два ClusterAuthorizationRules подходят для одного пользователя?

What if there are two ClusterAuthorizationRules matching to a single user?

Представьте, что пользователь jane.doe@example.com состоит в группе administrators. Созданы два ClusterAuthorizationRules:

Imagine that the user jane.doe@example.com is in the administrators group. There are two cluster authorization rules:

yaml apiVersion: deckhouse.io/v1 kind: ClusterAuthorizationRule metadata: name: jane spec: subjects:

  • kind: User name: jane.doe@example.com accessLevel: User namespaceSelector: labelSelector: matchLabels: env: review — apiVersion: deckhouse.io/v1 kind: ClusterAuthorizationRule metadata: name: admin spec: subjects:
  • kind: Group name: administrators accessLevel: ClusterAdmin namespaceSelector: labelSelector: matchExpressions:
  • key: env operator: In values:
  • prod
  • stage

yaml apiVersion: deckhouse.io/v1 kind: ClusterAuthorizationRule metadata: name: jane spec: subjects:

  • kind: User name: jane.doe@example.com accessLevel: User namespaceSelector: labelSelector: matchLabels: env: review — apiVersion: deckhouse.io/v1 kind: ClusterAuthorizationRule metadata: name: admin spec: subjects:
  • kind: Group name: administrators accessLevel: ClusterAdmin namespaceSelector: labelSelector: matchExpressions:
  • key: env operator: In values:
  • prod
  • stage
  1. jane.doe@example.com имеет право запрашивать и просматривать объекты среди всех namespace’ов, помеченных env=review.
  2. Administrators могут запрашивать, редактировать, получать и удалять объекты на уровне кластера и из namespace’ов, помеченных env=prod и env=stage.
  1. jane.doe@example.com has the right to get and list any objects in the namespaces labeled env=review
  2. Administrators can get, edit, list, and delete objects on the cluster level and in the namespaces labeled env=prod and env=stage.

Так как для Jane Doe подходят два правила, необходимо провести вычисления:

  • Она будет иметь самый сильный accessLevel среди всех подходящих правил — ClusterAdmin.
  • Опции namespaceSelector будут объединены так, что Jane Doe будет иметь доступ в namespace’ы, помеченные меткой env со значением review, stage или prod.

Because Jane Doe matches two rules, some calculations will be made:

  • She will have the most powerful accessLevel across all matching rules — ClusterAdmin.
  • The namespaceSelector options will be combined, so that Jane will have access to all the namespaces labeled with env label of the following values: review, stage, or prod.

Note! Если есть правило без опции namespaceSelector и без опции limitNamespaces (устаревшая), это значит, что доступ разрешен во все namespace’ы, кроме системных, что повлияет на результат вычисления доступных namespace’ов для пользователя.

Note! If there is a rule without the namespaceSelector option and limitNamespaces deprecated option, it means that all namespaces are allowed excluding system namespaces, which will affect the resulting limit namespaces calculation.