1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/coreos-layering-configuring-on-rebuild.adoc

79 lines
2.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * machine_configuration/coreos-layering.adoc
:_mod-docs-content-type: PROCEDURE
[id="coreos-layering-configuring-on-rebuild_{context}"]
= Rebuilding an on-cluster custom layered image
In situations where you want to rebuild an on-cluster custom layered image, you can either modify your `MachineOSConfig` object or add an annotation to the `MachineOSConfig` object. Both of these actions trigger an automatic rebuild of the object. For example, you could perform a rebuild if the you change the Containerfile or need to update the `osimageurl` location in a machine config.
After you add the annotation, the Machine Config Operator (MCO) deletes the current `MachineOSBuild` object and creates a new one in its place. When the build process is complete, the MCO automatically removes the annotation.
.Prerequisites
* You have opted-in to {image-mode-os-on-lower} by creating a `MachineOSConfig` object.
.Procedure
* Edit the `MachineOSConfig` object to add the `machineconfiguration.openshift.io/rebuild` annotation by using the following command:
+
[source,terminal]
----
$ oc edit MachineOSConfig <object_name>
----
+
.Example `MachineOSConfig` object
+
[source,yaml]
----
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSConfig
metadata:
annotations:
machineconfiguration.openshift.io/current-machine-os-build: layering-c26d4a003432df70ee66c83981144cfa
machineconfiguration.openshift.io/rebuild: "" <1>
# ...
name: layered-image
# ...
----
<1> Add this annotation to trigger a rebuild of the custom layered image.
.Verification
* Check that the `MachineOSBuild` object is building by using the following command:
+
[source,terminal]
----
$ oc get machineosbuild
----
+
.Example output
[source,terminal]
----
NAME PREPARED BUILDING SUCCEEDED INTERRUPTED FAILED AGE
layered-image-d6b929a29c6dbfa8e4007c8069a2fd08 False True False False False 2m41s <1>
----
<1> The value `True` in the `BUILDING` column indicates that the `MachineOSBuild` object is building.
* Edit the `MachineOSConfig` object to verify that the MCO removed the `machineconfiguration.openshift.io/rebuild` annotation by using the following command:
+
[source,terminal]
----
$ oc edit MachineOSConfig <object_name>
----
+
.Example `MachineOSConfig` object
+
[source,yaml]
----
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineOSConfig
metadata:
annotations:
machineconfiguration.openshift.io/current-machine-os-build: layering-c26d4a003432df70ee66c83981144cfa
# ...
name: layered-image
# ...
----