Skip to content

Commit

Permalink
Revert "EOD Sunday"
Browse files Browse the repository at this point in the history
This reverts commit b7938b9.
  • Loading branch information
RichardHoch committed Dec 16, 2024
1 parent b7938b9 commit b60a1ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 103 deletions.
66 changes: 8 additions & 58 deletions documentation/modules/about-hook-crs-for-migration-plans-api.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,27 @@
[id="about-api-hooks-in-migration-plans_{context}"]
= API-based hooks for {project-short} migration plans

You can use migration hooks to perform automated operations on a VM either before or after you migrate it. Hooks that perform operations on VMs before migration are called _pre-migration_ hooks. Hooks that perform operations on VMs after migration are called _post-migration_ hooks. A pre-migration hook is performed om a VM that is located on the provider and prepare the VM for migration. A post-migration hook is performed on a VM after it has been migrated to {virt}.
You can add hooks to a migration plan from the command line by using the {project-full} API.

You can add hooks to a migration plan using either the {project-first} CLI or the {project-short} UI.

// You can add hooks to a migration plan from the command line by using the {project-full} API.

[id="default-hook-image_{context}"]
[discrete]
== Default hook image
The default hook image for an {project-short} hook is `registry.redhat.io/rhmtc/openshift-migration-hook-runner-rhel8:v1.8.2-2`. The image is based on the Ansible Runner image with the addition of `python-openshift` to provide Ansible Kubernetes resources and a recent `oc` binary.

[id="hook-execution_{context}"]
[discrete]
== Hook execution
An Ansible playbook that is provided as part of a migration hook is mounted into the hook container as a `ConfigMap`. The hook container is run as a job on the desired cluster, using the default `ServiceAccount` in the `konveyor-forklift` namespace.

[discrete]
== PreHooks and PostHooks
You specify hooks per VM and you can run each as a _PreHook_ or a _PostHook_. In this context, a PreHook is a hook that is run before a migration and a PostHook is a hook that is run after a migration.

When you add a hook, you must specify the namespace where the hook CR is located, the name of the hook, and specify whether the hook is a pre-migration hook or a post-migration hook.
When you add a hook, you must specify the namespace where the hook CR is located, the name of the hook, and specify whether the hook is a PreHook or PostHook.

[IMPORTANT]
====
In order for a hook to run on a VM, the VM must be started and available via SSH.
In order for a PreHook to run on a VM, the VM must be started and available via SSH.
====


////
.Example PreHook:

[source,yaml]
Expand All @@ -49,51 +45,5 @@ spec:
name: playbook
step: PreHook
----
////

The illustration that follows shows the general process of using a migration hook. Specific procedures are described in TBD1 and TBD2.

[Figure]


Process:


. Input your Ansible hook and credentials.

** Input an Ansible pre-migration hook image or an Ansible post-migration hook image to the {project-short} controller using the CLI. This step is always done using the CLI, whether the rest of the migration is done using the CLI or the UI.

// Check text vs this content
can either specify the playbook in the Hook CRD or in the image itself. If the user specifies it in the image we use the playbook.yml and we set it to run it with the ansible-runner. Otherwise we keep it up to the users image what playbook is run but that needs to be specified in the image itself


** If you need additional data to run the playbook inside the pod, create a Secret that contains credentials for the VM. The Secret is not mounted to the pod, but is called by the playbook.

. The {project-short} controller creates the `configmap`, which contains:

** `workload.yml`, which contains information about the VMs.
** `playbook.yml`, the raw string playbook you want to execute.
** `plan.yml`, which is the `Plan CR`.
+
The `configmap` contains the name of the VM and instructs the playbook what to do.

. The {project-short} controller does the following:

** Creates a job that starts the user specified image.
** Mounts the `configmap` to the container.

+
The Ansible hook imports the Secret that the user previously
. The job runs a prehook or a posthook as follows:

** For a prehook, the job logs into the VMs on the source provider using SSH and runs the prehook.
** For a posthook, the job logs into the VMs on {virt} using SSH and runs the posthook.

// Next, 1 or 2 procedure modules based on the blog.







45 changes: 0 additions & 45 deletions documentation/modules/adding-migration-hook.adoc

This file was deleted.

0 comments on commit b60a1ea

Please sign in to comment.