Skip to content

Commit 096d087

Browse files
authored
Merge pull request openshift#9858 from kalexand-rh/t-3.10-auth-reconcile
fixing auth reconcile command for 3.10
2 parents 8dbf25d + c8b4475 commit 096d087

File tree

3 files changed

+30
-67
lines changed

3 files changed

+30
-67
lines changed

admin_guide/manage_rbac.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ xref:../architecture/additional_concepts/authorization.adoc#architecture-additio
2020
and bindings].
2121

2222
ifdef::openshift-dedicated[]
23-
Dedicated administrators can view but not manage cluster roles. They can manage cluster role bindings
23+
Dedicated administrators can view but not manage cluster roles. They can manage cluster role bindings
2424
and manage local roles and bindings.
2525
endif::[]
2626

architecture/additional_concepts/authorization.adoc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,15 @@ ifdef::openshift-enterprise,openshift-origin[]
430430

431431
After any xref:../../upgrading/index.adoc#install-config-upgrading-index[{product-title} cluster
432432
upgrade], the default roles are updated and automatically reconciled when the
433-
server is started. Additionally, see
434-
xref:../../upgrading/manual_upgrades.adoc#updating-policy-definitions[Updating
435-
Policy Definitions] for instructions on getting other recommendations
436-
using:
437-
438-
----
439-
$ oc adm policy reconcile-cluster-roles
440-
----
433+
server is started. During reconciliation, any permissions that are missing from
434+
the default roles are added. If you added more permissions to the role, they are
435+
not removed.
436+
437+
If you customized the default roles and configured them to prevent automatic
438+
role reconciliation, you must
439+
xref:../../upgrading/manual_upgrades.adoc#updating-policy-definitions[manually
440+
update
441+
policy definitions] when you upgrade {product-title}.
441442

442443
[[applying-custom-roles-and-permissions]]
443444

upgrading/manual_upgrades.adoc

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -507,80 +507,42 @@ updated.
507507
[[updating-policy-definitions]]
508508
== Updating Policy Definitions
509509

510-
After a cluster upgrade, the default roles
510+
During a cluster upgrade, and on every restart of any master, the
511511
xref:../architecture/additional_concepts/authorization.adoc#roles[default
512-
cluster roles] are automatically updated. To check if all defaults are set as
513-
recommended for your environment, run:
512+
cluster roles] are automatically reconciled to restore any missing permissions.
514513

514+
. If you customized default cluster roles and want to ensure a role reconciliation
515+
does not modify them, protect each role from reconciliation:
516+
+
515517
----
516-
# oc adm policy reconcile-cluster-roles
518+
$ oc annotate clusterrole.rbac <role_name> --overwrite rbac.authorization.kubernetes.io/autoupdate=false
517519
----
518-
520+
+
519521
[WARNING]
520522
====
521-
If you have customized default cluster roles and want to ensure a role reconciliation
522-
does not modify those customized roles, annotate them with `openshift.io/reconcile-protect`
523-
set to `true` when using the old Openshift policy format. When using the new RBAC
524-
roles, use `rbac.authorization.kubernetes.io/autoupdate` set to `false` instead.
525-
In doing so, you are responsible for manually updating those roles with any new
526-
or required permissions during upgrades.
523+
You must manually update the roles that contain this setting to include any new
524+
or required permissions after upgrading.
527525
====
528526

529-
This command outputs a list of roles that are out of date and their new proposed
530-
values. For example:
531-
532-
----
533-
# oc adm policy reconcile-cluster-roles
534-
apiVersion: v1
535-
items:
536-
- apiVersion: v1
537-
kind: ClusterRole
538-
metadata:
539-
creationTimestamp: null
540-
name: admin
541-
rules:
542-
- attributeRestrictions: null
543-
resources:
544-
- builds/custom
545-
...
527+
. Generate a default bootstrap policy template file:
528+
+
546529
----
547-
530+
$ oc adm create-bootstrap-policy-file --filename=policy.json
531+
----
532+
+
548533
[NOTE]
549534
====
550-
Your output will vary based on the OpenShift version and any local
551-
customizations you have made. Review the proposed policy carefully.
535+
The contents of the file vary based on the {product-title} version, but the file
536+
contains only the default policies.
552537
====
553538

554-
You can either modify this output to re-apply any local policy changes you have
555-
made, or you can automatically apply the new policy using the following process:
556-
557-
. Reconcile the cluster roles:
558-
+
559-
----
560-
# oc adm policy reconcile-cluster-roles \
561-
--additive-only=true \
562-
--confirm
563-
----
539+
. Update the *_policy.json_* file to include any cluster role customizations.
564540

565-
. Reconcile the cluster role bindings:
566-
+
567-
----
568-
# oc adm policy reconcile-cluster-role-bindings \
569-
--exclude-groups=system:authenticated \
570-
--exclude-groups=system:authenticated:oauth \
571-
--exclude-groups=system:unauthenticated \
572-
--exclude-users=system:anonymous \
573-
--additive-only=true \
574-
--confirm
575-
----
576-
+
577-
Also run:
541+
. Use the policy file to automatically reconcile roles and role bindings that
542+
are not reconcile protected:
578543
+
579544
----
580-
# oc adm policy reconcile-cluster-role-bindings \
581-
system:build-strategy-jenkinspipeline \
582-
--confirm \
583-
-o name
545+
$ oc auth reconcile -f policy.json
584546
----
585547

586548
. Reconcile security context constraints:

0 commit comments

Comments
 (0)