Namespace-scoped-policy (1)

tl;dr: Red Hat OpenShift Database Access (RHODA) improves on the self-service of managed databases by allowing developers to import Database-as-a-Service (DBaaS) Provider Accounts directly into their application namespace without any administrative intervention and share with fellow developers.

This blog explains the new multi-tenancy feature in RHODA, a cloud service that makes it easier to discover, provision, connect and control access to managed databases from Red Hat OpenShift. The tenancy feature is built around native OpenShift rule-based access control and namespaces with a single DBaaS policy per namespace.

After installing the OpenShift Database Access add-on, the RHODA operator creates a new DBaaS policy object in the operator’s installation namespace, typically this namespace is redhat-dbaas-operator or openshift-dbaas-operator.

Policies are set at the namespace level through the use of a DBaaSPolicy object, which then becomes the default policy for any DBaaSInventory created in that namespace. This default policy can be overridden on a per-inventory basis.

  • spec.disableProvisions
    • Disables provisioning in the provider account inventory, defaults to false.
  • spec.connectionNamespaces
    • A list of other namespaces that are allowed a connection to a policy’s inventories. Instead of listing namespaces, you can use an asterisks (‘*’), which allows a connection from all namespaces available in the OpenShift cluster.

The RHODA operator only allows one policy per namespace, and watches for inventory object changes as defined in the policy. The RHODA operator then configures the appropriate access requirements.

Here is the DBaaSPolicy object created in the Operator namespace during installation.

# by default, all authenticated cluster users can connect/provision against
# inventory objects in the operator's install namespace. They can do so from
# any namespace in which they have perms to create DBaaSConnections/Instances.
apiVersion: dbaas.redhat.com/v1alpha1
kind: DBaaSPolicy
metadata:
name: cluster
namespace: <operator install namespace>
spec:
connectionNamespaces:
- '*'

The default policy in the installation namespace allows all authenticated users to have View access to any DBaaSInventory database instances.

RHODA allows non-admin users, such as developers, to import provider accounts for 3rd party managed database services into their application namespaces provided they have created a DBaaS policy in that namespace. By default, the DBaaS policy restricts access to the database inventories to only the given namespace. A policy’s default values can be overridden on a per-inventory basis. Below is an example of the DBaaSPolicy object, with the optional spec fields. In this policy example, User1 shares the provider account inventories in their namespace, user1-project, with another namespace, user2-project belonging to User2.

Example

apiVersion: dbaas.redhat.com/v1alpha1
kind: DBaaSPolicy
metadata:
name: user1-policy
namespace: user1-project
spec:
connectionNamespaces:
- user1-project2
disableProvisions: false

As the namespace user2-project belongs to User2, User1 also needs to give View access to User2 for the namespace user1-project.

Command:

    oc adm policy add-role-to-user view User2 -n user1-project

The oc adm step to grant view access is not necessary if a user wants to share the database inventory to other namespaces they own.

The video below demonstrates the database policy concepts covered in this blog. 

 

To learn more about OpenShift Database Access you can read the blog or visit red.ht/dbaccess to try it out.


저자 소개

UI_Icon-Red_Hat-Close-A-Black-RGB

채널별 검색

automation icon

오토메이션

기술, 팀, 인프라를 위한 IT 자동화 최신 동향

AI icon

인공지능

고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Virtualization icon

가상화

온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래