mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
75 lines
2.1 KiB
Plaintext
75 lines
2.1 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * machine_management/deleting-machine.adoc
|
|
|
|
:_mod-docs-content-type: REFERENCE
|
|
[id="machine-lifecycle-hook-deletion-format_{context}"]
|
|
= Deletion lifecycle hook configuration
|
|
|
|
The following YAML snippets demonstrate the format and placement of deletion lifecycle hook configurations within a machine set:
|
|
|
|
.YAML snippet demonstrating a `preDrain` lifecycle hook
|
|
[source,yaml]
|
|
----
|
|
apiVersion: machine.openshift.io/v1beta1
|
|
kind: Machine
|
|
metadata:
|
|
...
|
|
spec:
|
|
lifecycleHooks:
|
|
preDrain:
|
|
- name: <hook_name> <1>
|
|
owner: <hook_owner> <2>
|
|
...
|
|
----
|
|
<1> The name of the `preDrain` lifecycle hook.
|
|
<2> The hook-implementing controller that manages the `preDrain` lifecycle hook.
|
|
|
|
.YAML snippet demonstrating a `preTerminate` lifecycle hook
|
|
[source,yaml]
|
|
----
|
|
apiVersion: machine.openshift.io/v1beta1
|
|
kind: Machine
|
|
metadata:
|
|
...
|
|
spec:
|
|
lifecycleHooks:
|
|
preTerminate:
|
|
- name: <hook_name> <1>
|
|
owner: <hook_owner> <2>
|
|
...
|
|
----
|
|
<1> The name of the `preTerminate` lifecycle hook.
|
|
<2> The hook-implementing controller that manages the `preTerminate` lifecycle hook.
|
|
|
|
|
|
[id="machine-lifecycle-hook-deletion-example_{context}"]
|
|
== Example lifecycle hook configuration
|
|
|
|
The following example demonstrates the implementation of multiple fictional lifecycle hooks that interrupt the machine deletion process:
|
|
|
|
.Example configuration for lifecycle hooks
|
|
[source,yaml]
|
|
----
|
|
apiVersion: machine.openshift.io/v1beta1
|
|
kind: Machine
|
|
metadata:
|
|
...
|
|
spec:
|
|
lifecycleHooks:
|
|
preDrain: <1>
|
|
- name: MigrateImportantApp
|
|
owner: my-app-migration-controller
|
|
preTerminate: <2>
|
|
- name: BackupFileSystem
|
|
owner: my-backup-controller
|
|
- name: CloudProviderSpecialCase
|
|
owner: my-custom-storage-detach-controller <3>
|
|
- name: WaitForStorageDetach
|
|
owner: my-custom-storage-detach-controller
|
|
...
|
|
----
|
|
<1> A `preDrain` lifecycle hook stanza that contains a single lifecycle hook.
|
|
<2> A `preTerminate` lifecycle hook stanza that contains three lifecycle hooks.
|
|
<3> A hook-implementing controller that manages two `preTerminate` lifecycle hooks: `CloudProviderSpecialCase` and `WaitForStorageDetach`.
|