|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * virt/live_migration/virt-about-live-migration.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="virt-preserving-lm-perms_{context}"] |
| 7 | += Preserving pre-4.19 live migration permissions during update |
| 8 | + |
| 9 | +Before you update to {VirtProductName} {VirtVersion}, you can create a temporary cluster role to preserve the previous live migration permissions until you are ready for the more restrictive default permissions to take effect. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* The {product-title} CLI (`oc`) is installed. |
| 14 | +* You have cluster administrator permissions. |
| 15 | +
|
| 16 | +.Procedure |
| 17 | + |
| 18 | +. Before updating to {VirtProductName} {VirtVersion}, create a temporary `ClusterRole` object. For example: |
| 19 | ++ |
| 20 | +[source,yaml] |
| 21 | +---- |
| 22 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 23 | +kind: ClusterRole |
| 24 | +metadata: |
| 25 | + labels: |
| 26 | + rbac.authorization.k8s.io/aggregate-to-admin=true #<1> |
| 27 | + name: kubevirt.io:upgrademigrate |
| 28 | +rules: |
| 29 | +- apiGroups: |
| 30 | + - subresources.kubevirt.io |
| 31 | + resources: |
| 32 | + - virtualmachines/migrate |
| 33 | + verbs: |
| 34 | + - update |
| 35 | +- apiGroups: |
| 36 | + - kubevirt.io |
| 37 | + resources: |
| 38 | + - virtualmachineinstancemigrations |
| 39 | + verbs: |
| 40 | + - get |
| 41 | + - delete |
| 42 | + - create |
| 43 | + - update |
| 44 | + - patch |
| 45 | + - list |
| 46 | + - watch |
| 47 | + - deletecollection |
| 48 | +---- |
| 49 | +<1> This cluster role is aggregated into the `admin` role before you update {VirtProductName}. The update process does not modify it, ensuring the previous behavior is maintained. |
| 50 | + |
| 51 | +. Add the cluster role manifest to the cluster by running the following command: |
| 52 | ++ |
| 53 | +[source,terminal] |
| 54 | +---- |
| 55 | +$ oc apply -f <cluster_role_file_name>.yaml |
| 56 | +---- |
| 57 | + |
| 58 | +. Update {VirtProductName} to version {VirtVersion}. |
| 59 | + |
| 60 | +. Bind the `kubevirt.io:migrate` cluster role to trusted users or groups by running one of the following commands, replacing `<namespace>`, `<first_user>`, `<second_user>`, and `<group_name>` with your own values. |
| 61 | +** To bind the role at the namespace level, run the following command: |
| 62 | ++ |
| 63 | +[source,terminal] |
| 64 | +---- |
| 65 | +$ oc create -n <namespace> rolebinding kvmigrate --clusterrole=kubevirt.io:migrate --user=<first_user> --user=<second_user> --group=<group_name> |
| 66 | +---- |
| 67 | +** To bind the role at the cluster level, run the following command: |
| 68 | ++ |
| 69 | +[source,terminal] |
| 70 | +---- |
| 71 | +$ oc create clusterrolebinding kvmigrate --clusterrole=kubevirt.io:migrate --user=<first_user> --user=<second_user> --group=<group_name> |
| 72 | +---- |
| 73 | + |
| 74 | +. When you have bound the `kubevirt.io:migrate` role to all necessary users, delete the temporary `ClusterRole` object by running the following command: |
| 75 | ++ |
| 76 | +[source,terminal] |
| 77 | +---- |
| 78 | +$ oc delete clusterrole kubevirt.io:upgrademigrate |
| 79 | +---- |
| 80 | ++ |
| 81 | +After you delete the temporary cluster role, only users with the `kubevirt.io:migrate` role can create, delete, and update live migration requests. |
0 commit comments