New feature in Juju 2.8: Add custom machine images with the juju metadata command

As of Juju 2.8.0, Juju administrators are now able to specify virtual machine images that Juju should consider when provisioning new compute capacity on Amazon AWS and OpenStack. The juju metadata add-image command informs Juju that an image should be considered when the series is selected.

Usage

The basic syntax involves tagging a specific series name with an “image identifier” or <image-id>.

juju metadata add-image --series <series> <image-id>

The format for image identifiers is provider-specific. Juju passes this information to the cloud directly and performs minimal validation when the image is added. Here are some provider-specific guides for identifying which <image-id> to select:

The metadata add-image sub-command includes a number of provider-specific options that may be useful for specialised use cases:

  • --virt-type: the virtualisation type for the VM, e.g. hvm, paravirtual on AWS
  • --storage-type: the root disk storage type, e.g. ebs for Elastic Block Storage on AWS
  • --storage-size: the size of the VM’s root disk

Background

The juju metadata command provides the ability for Juju administrators to introspect the VM images that clouds support. The image metadata is also how controllers know how to provision new machines.

juju metadata includes several sub-commands:

  • add-image: (new) adds image metadata to model
  • delete-image: deletes image metadata from environment
  • generate-agents: generate simplestreams agent metadata
  • generate-image: generate simplestreams image metadata
  • list-images: lists cloud image metadata that’s currently available
  • sign: cryptographically sign simplestreams metadata
  • validate-agents: validate agent metadata and ensure agent binary tarball(s) exist for Juju version(s)
  • validate-images - validate image metadata and ensure image(s) exist for a model

2 Likes

Exciting new release!

Is this feature add-image coming for vsphere down the road?

Yeah, we’re going to look to see if that can happen this cycle, hopefully “soon”.

2 Likes

Looking forward to try it out!

Use of add-image for vsphere was added to juju 2.9.2.

1 Like

Is there any examples on how to work with it in practice?

This needs to be updated in our docs, for now: Comment #5 : Bug #1880015 : Bugs : juju

As well as how to use juju metadata generate-image to specify the template when bootstrapping.

It looks like it is not valid anymore.

$ juju version 2.9.27-centos-amd64

$ juju metadata list-images

ERROR juju: “metadata” is not a juju command. See “juju --help”.


Update: I actually updated to the latest 2.9.32 version and it worked out.

1 Like
$ juju --debug metadata list-images
12:58:30 INFO  juju.cmd supercommand.go:56 running juju [2.9.32 917a8f1033561ce28a73ff81d71da75aec6e0785 gc go1.18.3]
12:58:30 DEBUG juju.cmd supercommand.go:57   args: []string{"/snap/juju/19681/bin/juju", "--debug", "metadata", "list-images"}
ERROR matching cloud image metadata not found (not found)
12:58:30 INFO  cmd supercommand.go:544 command finished

Am I doing something wrong? I have the controller and the client on 2.9.32