To prevent access to a particular build strategy globally, log in as a user with
cluster-admin
privileges, remove the corresponding role from the system:authenticated group, and apply the annotation openshift.io/reconcile-protect: "true"
to protect them from changes between the API restarts. The following example shows disabling the docker build strategy.
-
Apply the openshift.io/reconcile-protect
annotation
$ oc edit clusterrolebinding system:build-strategy-docker-binding
apiVersion: v1
groupNames:
- system:authenticated
kind: ClusterRoleBinding
metadata:
annotations:
openshift.io/reconcile-protect: "true" (1)
creationTimestamp: 2018-08-10T01:24:14Z
name: system:build-strategy-docker-binding
resourceVersion: "225"
selfLink: /oapi/v1/clusterrolebindings/system%3Abuild-strategy-docker-binding
uid: 17b1f3d4-9c3c-11e8-be62-0800277d20bf
roleRef:
name: system:build-strategy-docker
subjects:
- kind: SystemGroup
name: system:authenticated
userNames:
- system:serviceaccount:management-infra:management-admin
1 |
Change the openshift.io/reconcile-protect annotation’s value to "true" . By default, it is set to "false" . |
-
Remove the role:
$ oc adm policy remove-cluster-role-from-group system:build-strategy-docker system:authenticated
In versions prior to 3.2, the build strategy subresources were included in the admin
and edit
roles.
Ensure the build strategy subresources are also removed from these roles:
$ oc edit clusterrole admin
$ oc edit clusterrole edit
For each role, remove the line that corresponds to the resource of the strategy to disable.
Disable the Docker Build Strategy for admin
kind: ClusterRole
metadata:
name: admin
...
rules:
- resources:
- builds/custom
- builds/docker (1)
- builds/source
...
...
1 |
Delete this line to disable Docker builds globally for users with the admin role. |