rhpds / user-namespace-operator

OpenShift operator for auto-creating namespaces for users

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

User Namespace Operator

The user-namespace-operator creates project namespaces in an OpenShift on initial user login as well as allow users to request additional project namespaces on demand.

Namespaces are created by the user-namespace-operator by creating OpenShift project requests and then changing the openshift.io/requester annotation and adding an admin role binding for the user. This makes the behavior of the user-namespace-operator complimentary to configuration of the default project request template.

Installation

Deploy with:

oc apply -f custom-resource-definitions/
oc process -f deploy-template.yaml --local | oc apply -f -

Configuration

The User Namespace Operator is configured with the UserNamespaceConfig custom resource kind. At present only one UserNamespaceConfig is supported and must be named "default".

The initial provided configuration is:

apiVersion: usernamespace.gpte.redhat.com/v1
kind: UserNamespaceConfig
metadata:
  name: default
spec:
  templates:
  - name: default

This causes the OpenShift template named "default" in the namespace "user-namespace-operator" to initialize resources in managed namespaces.

Additional templates can be created in the namespace "user-namespace-operator" and then referenced in the default UserNamespaceConfig and those will also be used or the provided default template can be modified to suit your needs.

Build

oc process -f build-template.yaml --local | oc apply -f -
oc start-build user-namespace-operator --from-dir=. -F
oc apply -f helm/crds/
helm template helm/ \
--set=image.tagOverride=- \
--set=image.repository=$(oc get imagestream user-namespace-operator -o jsonpath='{.status.tags[?(@.tag=="latest")].items[0].dockerImageReference}') \
| oc apply -f -

Deploy from build

oc process -f deploy-template.yaml \
-p IMAGE=$(oc get imagestream user-namespace-operator -o jsonpath='{.status.tags[?(@.tag=="latest")].items[0].dockerImageReference}') \
| oc apply -f -

About

OpenShift operator for auto-creating namespaces for users


Languages

Language:Python 92.3%Language:Mustache 5.1%Language:Shell 2.2%Language:Dockerfile 0.4%