Blame docs/operations/ci/disabling_self_provisioner_role.md

47c289
# Disabling self-provisioners role
47c289
By default, when a user authenticates with Openshift via Oauth, it is part of the `self-provisioners` group. This group provides the ability to create new projects. On CentOS CI we do not want users to be able to create their own projects, as we have a system in place where we create a project and control the administrators of that project.
47c289
47c289
To disable the self-provisioner role do the following as outlined in the documentation[1].
47c289
47c289
```
47c289
oc describe clusterrolebinding.rbac self-provisioners
47c289
47c289
Name:		self-provisioners
47c289
Labels:		<none>
47c289
Annotations:	rbac.authorization.kubernetes.io/autoupdate=true
47c289
Role:
47c289
  Kind:	ClusterRole
47c289
  Name:	self-provisioner
47c289
Subjects:
47c289
  Kind	Name				Namespace
47c289
  ----	----				---------
47c289
  Group	system:authenticated:oauth
47c289
```
47c289
47c289
Remove the subjects that the self-provisioners role applies to.
47c289
47c289
```
47c289
oc patch clusterrolebinding.rbac self-provisioners -p '{"subjects": null}'
47c289
```
47c289
47c289
Verify the change occurred successfully
47c289
47c289
```
47c289
oc describe clusterrolebinding.rbac self-provisioners
47c289
Name:         self-provisioners
47c289
Labels:       <none>
47c289
Annotations:  rbac.authorization.kubernetes.io/autoupdate: true
47c289
Role:
47c289
  Kind:  ClusterRole
47c289
  Name:  self-provisioner
47c289
Subjects:
47c289
  Kind  Name  Namespace
47c289
  ----  ----  ---------
47c289
```
47c289
47c289
When the cluster is updated to a new version, unless we mark the role appropriately, the permissions will be restored after the update is complete.
47c289
47c289
Verify that the value is currently set to be restored after an update:
47c289
47c289
```
47c289
oc get clusterrolebinding.rbac self-provisioners -o yaml
47c289
```
47c289
47c289
```
47c289
apiVersion: authorization.openshift.io/v1
47c289
kind: ClusterRoleBinding
47c289
metadata:
47c289
  annotations:
47c289
    rbac.authorization.kubernetes.io/autoupdate: "true"
47c289
  ...
47c289
```
47c289
47c289
We wish to set this `rbac.authorization.kubernetes.io/autoupdate` to `false`. To patch this do the following.
47c289
47c289
```
47c289
oc patch clusterrolebinding.rbac self-provisioners -p '{ "metadata": { "annotations": { "rbac.authorization.kubernetes.io/autoupdate": "false" } } }'
47c289
```
47c289
47c289
47c289
47c289
### Resources
47c289
47c289
- [1] https://docs.openshift.com/container-platform/4.4/applications/projects/configuring-project-creation.html#disabling-project-self-provisioning_configuring-project-creation