Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image builder Nutanix builds fail to use base images already in Prism Central #8605

Open
jacobbmay opened this issue Aug 14, 2024 · 0 comments

Comments

@jacobbmay
Copy link

What happened:
Attempting to follow documentation for building Nutanix images with the image-builder CLI tool and already have a RHEL cloud image imported into Prism Central that I want to build eks node images from. The documentation says you can either set the image_url variable to grab a publicly accessible image or the source_image_name variable to select an image you have already imported into Prism.

When only the source_image_name variable is set and the image_url variable is not included, packer crashes with an "invalid memory address or nil pointer dereference" error.

What you expected to happen:
Image builder successfully builds Nutanix images from a base image that has already been imported into Prism without trying to pull the image from a URL if the image_url variable is not provided.

How to reproduce it (as minimally and precisely as possible):

  1. Import a RHEL cloud image into Prism Central to be used as the source image
  2. Follow the docs to build a Nutanix node image and specify the image name of the image already imported to prism for the source_image_name variable
  3. Don't set the variable image_url because the image is already in Prism
  4. Run the image-builder command: image-builder build --os redhat --hypervisor nutanix --release-channel 1-29 --nutanix-config nutanix.json

This should result in packer crashing with the invalid memory address error as soon as the packer build command is started.

Anything else we need to know?:
Was able to confirm this is what is happening by looking at the packer file that is being used for the build: eks-anywhere-build-tooling/projects/kubernetes-sigs/image-builder/image-builder/images/capi/packer/nutanix/packer.json. There are no references to the source_image_name variable anywhere in the file.

Lines 26-32 shows the builder attempting to use the image_url variable for the source image even though one wasn't set:

      "vm_disks": {
        "disk_size_gb": "{{user `disk_size_gb`}}",
        "image_type": "DISK_IMAGE",
        "source_image_delete": "{{user `source_image_delete`}}",
        "source_image_force": "{{user `source_image_force`}}",
        "source_image_uri": "{{user `image_url`}}"
      }

After the build failed I edited the variable file eks-anywhere-build-tooling/projects/kubernetes-sigs/image-builder/packer/nutanix/nutanix.json to set the image_url variable to the same value as the image name and then modified the vm_disks block like the following:

      "vm_disks": {
        "disk_size_gb": "{{user `disk_size_gb`}}",
        "image_type": "DISK_IMAGE",
        "source_image_delete": "{{user `source_image_delete`}}",
        "source_image_force": "{{user `source_image_force`}}",
        "source_image_name": "{{user `image_url`}}"
      }

After changing that I reran the same packer build command that the image-builder failed on, it succeeded, and the eks node image was added to Prism.

Environment:

  • image-builder version v0.5.0
  • RHEL 8.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant