Skip to content

Commit 5eef504

Browse files
authored
Merge pull request #56634 from StephenJamesSmith/TELCODOCS-1010
2 parents becf07a + f9a43a9 commit 5eef504

10 files changed

+209
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,8 @@ Topics:
616616
File: uninstalling-osus
617617
- Name: Updating hardware on nodes running on vSphere
618618
File: updating-hardware-on-nodes-running-on-vsphere
619+
- Name: Preflight validation for Kernel Module Management (KMM) Modules
620+
File: kmm-preflight-validation
619621
# - Name: Troubleshooting an update
620622
# File: updating-troubleshooting
621623
---
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-build-validation-stage_{context}"]
7+
= Build validation stage
8+
9+
Build validation is executed only when image validation has failed and there is a `build` section in the `Module` that is relevant for the upgraded kernel. Build validation attempts to run the build job and validate that it finishes successfully.
10+
11+
[NOTE]
12+
====
13+
You must specify the kernel version when running `depmod`, as shown here:
14+
[source,terminal]
15+
----
16+
$ RUN depmod -b /opt ${KERNEL_VERSION}
17+
----
18+
====
19+
20+
If the `PushBuiltImage` flag is defined in the `PreflightValidationOCP` custom resource (CR), it will also try to push the resulting image into its repository. The resulting image name is taken from the definition of the `containerImage` field of the `Module` CR.
21+
22+
[NOTE]
23+
====
24+
If the `sign` section is defined for the upgraded kernel, then the resulting image will not be the `containerImage` field of the `Module` CR, but a temporary image name, because the resulting image should be the product of Sign flow.
25+
====

modules/kmm-example-cr.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-example-cr_{context}"]
7+
= Example PreflightValidationOCP resource
8+
9+
This section shows an example of the `PreflightValidationOCP` resource in the YAML format.
10+
11+
The example verifies all the currently present modules against the upcoming kernel version included in the {product-title} release 4.11.18, which the following release image points to:
12+
13+
[source,terminal]
14+
----
15+
quay.io/openshift-release-dev/ocp-release@sha256:22e149142517dfccb47be828f012659b1ccf71d26620e6f62468c264a7ce7863
16+
----
17+
18+
Because `.spec.pushBuiltImage` is set to `true`, KMM pushes the resulting images of Build/Sign into the defined repositories.
19+
20+
[source,yaml]
21+
----
22+
apiVersion: kmm.sigs.x-k8s.io/v1beta1
23+
kind: PreflightValidationOCP
24+
metadata:
25+
name: preflight
26+
spec:
27+
releaseImage: quay.io/openshift-release-dev/ocp-release@sha256:22e149142517dfccb47be828f012659b1ccf71d26620e6f62468c264a7ce7863
28+
pushBuiltImage: true
29+
----
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-image-validation-stage_{context}"]
7+
= Image validation stage
8+
9+
Image validation is always the first stage of the preflight validation to be executed. If image validation is successful, no other validations are run on that specific module.
10+
11+
Image validation consists of two stages:
12+
13+
. Image existence and accessibility. The code tries to access the image defined for the upgraded kernel in the module and get its manifests.
14+
15+
. Verify the presence of the kernel module defined in the `Module` in the correct path for future `modprobe` execution. The correct path is `<dirname>/lib/modules/<upgraded_kernel>/`.
16+
17+
If this validation is successful, it probably means that the kernel module was compiled with the correct Linux headers.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-preflight-validation-stages-per-module_{context}"]
7+
= Preflight validation stages per Module
8+
9+
Preflight runs the following validations on every KMM Module present in the cluster:
10+
11+
. Image validation stage
12+
. Build validation stage
13+
. Sign validation stage
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-sign-validation-stage_{context}"]
7+
= Sign validation stage
8+
9+
Sign validation is executed only when image validation has failed, there is a `sign` section in the `Module` that is relevant for the upgrade kernel, and build validation finished successfully in the event there was a `build` section in the `Module` relevant for the upgraded kernel. Sign validation will try to run the sign job and validate that it finishes successfully.
10+
11+
If the `PushBuiltImage` flag is defined in the `PreflightValidationOCP` CR, sign validation will also try to push the resulting image to its registry.
12+
13+
The resulting image is always the image defined in the `containerImage` field of the `Module`. The input image is either the output of the Build stage, or an image defined in the `UnsignedImage` field.
14+
15+
[NOTE]
16+
====
17+
If a `build` section exists, the `sign` section input image is the `build` section's output image. Therefore, in order for the input image to be available for the `sign` section, the `PushBuiltImage` flag must be defined in the `PreflightValidationOCP` CR.
18+
====

modules/kmm-validation-kickoff.adoc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-validation-kickoff_{context}"]
7+
= Validation kickoff
8+
9+
Preflight validation is triggered by creating a `PreflightValidationOCP` resource in the cluster. This spec contains two fields:
10+
11+
[source,terminal]
12+
----
13+
type PreflightValidationOCPSpec struct {
14+
// releaseImage describes the OCP release image that all Modules need to be checked against.
15+
// +kubebuilder:validation:Required
16+
ReleaseImage string `json:"releaseImage"` <1>
17+
// Boolean flag that determines whether images build during preflight must also
18+
// be pushed to a defined repository
19+
// +optional
20+
PushBuiltImage bool `json:"pushBuiltImage"` <2>
21+
}
22+
----
23+
24+
<1> `ReleaseImage` - Mandatory field that provides the name of the release image for the {product-title} version the cluster is upgraded to.
25+
26+
<2> `PushBuiltImage` - If `true`, then the images created during the Build and Sign validation are pushed to their repositories (`false` by default).

modules/kmm-validation-lifecycle.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-validation-lifecycle_{context}"]
7+
= Validation lifecycle
8+
9+
Preflight validation attempts to validate every module loaded in the cluster. Preflight will stop running validation on a `Module` resource after the validation is successful. In case module validation has failed, you can change the module definitions and Preflight will try to validate the module again in the next loop.
10+
11+
If you want to run Preflight validation for an additional kernel, then you should create another `PreflightValidationOCP` resource for that kernel. After all the modules have been validated, it is recommended to delete the `PreflightValidationOCP` resource.

modules/kmm-validation-status.adoc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/kmm-preflight-validation.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="kmm-validation-status_{context}"]
7+
= Validation status
8+
9+
Preflight reports the status and progress of each module in the cluster that it attempts to
10+
validate.
11+
12+
[source,terminal]
13+
----
14+
type CRStatus struct {
15+
// Status of Module CR verification: true (verified), false (verification failed),
16+
// error (error during verification process), unknown (verification has not started yet)
17+
// +required
18+
// +kubebuilder:validation:Required
19+
// +kubebuilder:validation:Enum=True;False
20+
VerificationStatus string `json:"verificationStatus"` <1>
21+
// StatusReason contains a string describing the status source.
22+
// +optional
23+
StatusReason string `json:"statusReason,omitempty"` <2>
24+
// Current stage of the verification process:
25+
// image (image existence verification), build(build process verification)
26+
// +required
27+
// +kubebuilder:validation:Required
28+
// +kubebuilder:validation:Enum=Image;Build;Sign;Requeued;Done
29+
VerificationStage string `json:"verificationStage"` <3>
30+
// LastTransitionTime is the last time the CR status transitioned from one status to another.
31+
// This should be when the underlying status changed. If that is not known, then using the time when the API field changed is acceptable.
32+
// +required
33+
// +kubebuilder:validation:Required
34+
// +kubebuilder:validation:Type=string
35+
// +kubebuilder:validation:Format=date-time
36+
LastTransitionTime metav1.Time `json:"lastTransitionTime" protobuf:"bytes,4,opt,name=lastTransitionTime"` <4>
37+
}
38+
----
39+
40+
The following fields apply to each module:
41+
42+
<1> `VerificationStatus` - `true` or `false`, validated or not.
43+
44+
<2> `StatusReason` - Verbal explanation regarding the status.
45+
46+
<3> `VerificationStage` - Describes the validation stage being executed (Image, Build, Sign).
47+
48+
<4> `LastTransitionTime` - The time of the last update to the status.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:_content-type: ASSEMBLY
2+
[id="kmm-preflight-validation"]
3+
= Preflight validation for Kernel Module Management (KMM) Modules
4+
include::_attributes/common-attributes.adoc[]
5+
:context: kmm-preflight-validation
6+
7+
toc::[]
8+
9+
Before performing an upgrade on the cluster with applied KMM modules, the administrator must verify that kernel modules installed using KMM are able to be installed on the nodes after the cluster upgrade and possible kernel upgrade. Preflight attempts to validate every `Module` loaded in the cluster, in parallel. Preflight does not wait for validation of one `Module` to complete before starting validation of another `Module`.
10+
11+
:FeatureName: Kernel Module Management Operator Preflight validation
12+
13+
include::modules/kmm-validation-kickoff.adoc[leveloffset=+1]
14+
include::modules/kmm-validation-lifecycle.adoc[leveloffset=+1]
15+
include::modules/kmm-validation-status.adoc[leveloffset=+1]
16+
include::modules/kmm-preflight-validation-stages-per-module.adoc[leveloffset=+1]
17+
include::modules/kmm-image-validation-stage.adoc[leveloffset=+2]
18+
include::modules/kmm-build-validation-stage.adoc[leveloffset=+2]
19+
include::modules/kmm-sign-validation-stage.adoc[leveloffset=+2]
20+
include::modules/kmm-example-cr.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)