Mapping of Keycloak roles to IAM*RoleBinding objects¶
Old-style role mappings are reflected in the MOSK management
API with the new roles and the legacy: true and
legacyRole: “<oldRoleName>” fields set. If you remove the legacy flag,
user-controller automatically performs the following update in Keycloak:
Grants the new-style role
Removes the old-style role mapping
Note
You can assign the old-style roles using Keycloak only. These roles will be synced into the MOSK management API as the corresponding
IAM*RoleBindingobjects with theexternal: true,legacy: true, andlegacyRole: “<oldRoleName>”fields set.If you assign new-style roles using Keycloak, they will be synced into the MOSK management API with the
external: truefield set.
Mapping of new-style Keycloak roles to IAM*RoleBinding objects¶
The following table describes how the IAM*RoleBinding objects in the
MOSK management API map to roles in Keycloak.
MOSK new role names |
global-admin |
bm-pool-operator |
operator |
user |
cluster-admin |
stacklight-admin |
|---|---|---|---|---|---|---|
m:kaas@global-admin |
||||||
m:kaas@management-admin |
||||||
m:kaas:{ns}@bm-pool-operator |
||||||
m:kaas:{ns}@operator |
||||||
m:kaas:{ns}@user |
||||||
m:k8s:{ns}:{cluster}@cluster-admin |
||||||
m:sl:{ns}:{cluster}@stacklight-admin |
Mapping of old-style Keycloak roles to IAM*RoleBinding objects¶
The following table describes how the old-style role names map with the current
IAM*RoleBinding objects in the MOSK management API map:
MOSK new role names |
global-admin |
bm-pool-operator |
operator |
user |
cluster-admin |
stacklight-admin |
|---|---|---|---|---|---|---|
m:kaas@writer |
||||||
m:kaas@reader |
||||||
m:kaas@operator |
||||||
m:kaas:{ns}@writer |
||||||
m:kaas:{ns}@reader |
||||||
m:k8s:{ns}:{cluster}@cluster-admin |
||||||
m:sl:{ns}:{cluster}@admin |
Examples of mapping between Keycloak roles and IAM*RoleBinding objects¶
The following tables contain several examples of role assignment either through Keycloak or the MOSK IAM objects with the corresponding role mappings for each use case.
Use case |
Namespace operator role binding |
IAM*RoleBinding example |
apiVersion: iam.mirantis.com/v1alpha1
kind: IAMRoleBinding
metadata:
namespace: ns1
name: user1-operator
role:
name: operator
user:
name: user1-f150d839
|
Mapped role in Keycloak |
The role |
Use case |
Cluster-admin role assigned globally |
IAM*RoleBinding example |
apiVersion: iam.mirantis.com/v1alpha1
kind: IAMGlobalRoleBinding
metadata:
name: user1-global-cluster-admin
role:
name: cluster-admin
user:
name: user1-f150d839
|
Mapped role in Keycloak |
For example, if you have two namespaces (
If you create a new |
The following table provides the new-style and old-style examples on how a role assigned to a user through Keycloak will be translated into IAM objects.
Role type |
New-style role |
Role example in Keycloak |
The role The |
Mapped IAM*RoleBinding example |
apiVersion: iam.mirantis.com/v1alpha1
kind: IAMRoleBinding
metadata:
namespace: ns1
name: user1-f150d839-operator
external: true
role:
name: operator
user:
name: user1-f150d839
|
Role type |
Old-style role |
Role example in Keycloak |
The role Creation of this role through Keycloak triggers creation of two
To migrate the old-style For example, if you have two namespaces (
If you create a new If you do not remove the |
Mapped IAM*RoleBinding example |
apiVersion: iam.mirantis.com/v1alpha1
kind: IAMGlobalRoleBinding
metadata:
name: user1-f150d839-global-admin
external: true
legacy: true
legacyRole: m:kaas@writer
role:
name: global-admin
user:
name: user1-f150d839
apiVersion: iam.mirantis.com/v1alpha1
kind: IAMGlobalRoleBinding
metadata:
name: user1-f150d839-operator
external: true
legacy: true
legacyRole: m:kaas@writer
role:
name: operator
user:
name: user1-f150d839
|