Use custom images with a custom provision server

By default, the OpenStackBaremetalSet CR automatically creates an OpenStackProvisionServer CR for each node set that serves the bundled operating system image for node provisioning. You can create a custom OpenStackProvisionServer CR that serves a different operating system image.

Before you begin

  • A QCOW2 container image that includes all the packages required for data plane deployment, such as the following:
    • The QCOW2 disk image and checksum files.
    • An endpoint script, such as copy_out.sh, that copies the QCOW2 container image to the directory specified in the DEST_DIR environment variable.

About this task

Important

Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.

Procedure

  1. Generate a checksum file for the container image appropriate for your environment:
    • Generate a SHA256 checksum file:
      $ sha256sum <image_file_name>.qcow2 > <image_file_name>.qcow2.sha256sum
    • Generate a MD5 checksum file:
      $ md5sum <image_file_name>.qcow2 > <image_file_name>.qcow2.md5sum
    • Generate a SHA512 checksum file:
      $ sha512sum <image_file_name>.qcow2 > <image_file_name>.qcow2.sha512sum
  2. Clone the edpm-image-builder repository:
    $ git clone https://github.com/openstack-k8s-operators/edpm-image-builder.git
  3. Navigate to the edpm-image-builder directory:
    $ cd edpm-image-builder
  4. Create the container image file in the edpm-image-builder directory:
    $ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.6
    $ COPY <image_file_name>.qcow2 /
    $ COPY <image_file_name>.qcow2.sha256sum /
    $ COPY copy_out.sh /copy_out.sh
    $ RUN chmod +x /copy_out.sh
    $ ENTRYPOINT ["/copy_out.sh"]

    where:

    <image_file_name>

    Specifies the name of your QCOW2 container image.

    Note
    • The files are copied to your root directory because the default SRC_DIR for copy_out.sh is /. You can set ENV SRC_DIR=<path> in your container file if you want to use a different source directory.
    • You can use compressed (.qcow2.gz) or uncompressed (.qcow2) images with the copy_out.sh script.
  5. Build and push the container image:
    $ buildah bud -f Containerfile -t <your_registry>/my-custom-os-image:latest
    $ buildah push <your_registry>/my-custom-os-image:latest

    where:

    <your_registry>
    Specifies the URL to your container registry.
  6. Create an OpenStackProvisionServer CR that defines your custom provisioning server:
    apiVersion: baremetal.openstack.org/v1beta1
    kind: OpenStackProvisionServer
    metadata:
      name: openstackprovisionserver
    spec:
      interface: <connection_interface>
      port: <connection_port>
      osImage: <image_file_name>.qcow2
      osContainerImageUrl: <your_registry>/my-custom-os-image:latest
      apacheImageUrl: registry.redhat.io/ubi9/httpd-24:latest
      agentImageUrl: quay.io/openstack-k8s-operators/openstack-baremetal-operator-agent:latest

    where:

    <connection_interface>
    Specifies the interface to use to connect to the custom provisioning server.
    <connection_port>
    Specifies the port to use to connect to the custom provisioning server.
    <image_file_name>
    Specifies the name of your QCOW2 container image.
    <your_registry>
    Specifies the URL to your container registry.
  7. Save your custom OpenStackProvisionServer CR file.
  8. Apply the OpenStackProvisionServer CR configuration:
    $ oc apply -f <provision_server_cr_file>

    where:

    <provision_server_cr_file>
    Specifies the file name of the new OpenStackProvisionServer CR file that you created.
  9. Add your custom OpenStackProvisionServer CR to the applicable OpenStackDataPlaneNodeSet CRs. The following is an example of an OpenStackDataPlaneNodeSet CR that uses a custom OpenStackProvisionServer CR:
    apiVersion: dataplane.openstack.org/v1beta1
    kind: OpenStackDataPlaneNodeSet
    metadata:
      name: example-nodeset
    spec:
      baremetalSetTemplate:
        provisionServerName: <provision_server_name>
        osImage: <image_file_name>.qcow2
        deploymentSSHSecret: <custom_ssh_secret>
        ctlplaneInterface: <ctrl_plane_interface>
      nodes:
        edpm-compute-0:
          hostName: edpm-compute-0

    where:

    <provision_server_name>
    Specifies the name of your custom OpenStackProvisionServer CR.
    <image_file_name>
    Specifies the name of your QCOW2 container image.
    <custom_ssh_secret>
    Specifies the SSH secret to use for deployment.
    <ctrl_plane_interface>
    Specifies the control plane interface to use for provisioning.
  10. Apply the updated OpenStackDataPlaneNodeSet CR configuration:
    $ oc apply -f openstack_data_plane.yaml
  11. Verify that the data plane resource has been updated by confirming that the status is SetupReady:
    $ oc wait openstackdataplanenodeset openstack-data-plane --for condition=SetupReady --timeout=10m

    When the status is SetupReady the command returns a condition met message, otherwise it returns a timeout error.

    For information about the data plane conditions and states, see Data plane conditions and states.