Compare languages | The user-authz module: FAQ

How do I create a user?

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

Creating a user.

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

How do I limit user rights to specific namespaces?

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

To limit a user’s rights to specific namespaces, use RoleBinding with the use role that has the appropriate level of access. Example….

Чтобы ограничить права пользователя конкретными пространствами имён, используйте в RoleBinding use-роль с соответствующим уровнем доступа. Пример….

How do I limit user rights to specific namespaces (obsolete role-based model)?

Как ограничить права пользователю конкретными пространствами имён (устаревшая ролевая модель)

The example uses the obsolete role-based model.

Используется устаревшая ролевая модель.

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

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

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

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

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

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

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 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.
  1. jane.doe@example.com имеет право запрашивать и просматривать объекты среди всех пространств имён, помеченных env=review.
  2. Administrators могут запрашивать, редактировать, получать и удалять объекты на уровне кластера и из пространств имён, помеченных env=prod и env=stage.

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.

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

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

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.

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