Hierarchical Namespaces (HNS)
HNS
is built to allow for easier multi-tenancy in OpenShift clusters, containing a set of CRDs and controllers that allow users to create namespaces without needing cluster-level permission to create namespaces, with each namespace having a quota associated to it.
Using HNS
Prerequisites
In order to use HNS
, you need to have:
- An operating OpenShift cluster of version 4.x.
cert-manager
installed on the cluster.
- At least 3 nodes with an
infra
taint and without a master
taint (HNS
runs by default on infra
nodes)
Build
To build the HNS
controller, login into an image registry, and run:
$ make docker-build docker-push IMG=<image_registry>/<image_name>:<image_tag>
Deploy
To build the HNS
controller, login into an operational OpenShift cluster and run:
$ make deploy IMG=<image_registry>/<image_name>:<image_tag>
Test
To test the HNS
controller, login into an operational OpenShift cluster and run:
$ make test-e2e
CRDs
-
Subnamespace
: Represents a namespace in a hierarchy. Each Subnamespace
has a namespace
bound to it which has the same name as the Subnamespace
. A Subnamepsace
may also have a quota bound to it. The quota can be either a ResourceQuota
object or a ClusterResourceQuota
object (this depends on the depth in the hierarchy of the Subnamespace
) of the same name as the Subnamespace
.
-
UpdateQuota
: A CRD that allows to move resources between Subnamespaces
.
-
MigrationHierarchy
: A CRD that allows migrating a Subnamespace
to a different hierarchy.