Comment 3 for bug 1606617

Revision history for this message
John A Meinel (jameinel) wrote :

Since we have ContainerManager which can take a ManagerConfig, we could start to pass through image-metadata-url.

The content in apiserver/agent/provisioner/provisioner.go ContainerManagerConfig knows that we're asking for the LXD configuration.
It has access to p.m.Config() which should be the 'model-config' for the model we're running in, so should be able to lookup p.m.Config().
That would let us check:
  config.ImageMetadataURL()
and
  config.ImageStream()

and pass them into the cfg which is a map[string]string

and then we should already be passing that into container/lxd/lxd.go NewContainerManager
where we can pop out those attributes if they are set, which would let us set them on containerManager.

And then in containerManager.CreateContainer() we should be able to include them in the list of of 'EnsureImageExists'.

We probably need to turn them from a URL into a Remote object. We'd probably just assume they are a Simplestreams remote.

We might also need to promote "http://" sources to "https://" since it is required by LXD.

It is also arguable that we very much shouldn't be punning the image-metadata-url for the cloud with the values for the containers.
Given something like Openstack, do we actually think the metadata for Cloud images would be in the same place as LXD images?

It feels like what we really want would be something like "lxd-image-metadata-url" which users can set to the same value as image-metadata-url if it is actually the same. But the question of "where is the metadata about images for VMs for my cloud" feels very much like it could be a different question than "where is the metadata for images for LXD containers for my cloud".

I also wonder what we should be doing for KVM images, as those seem to also hard-code cloud-images.ubuntu.com: (kvm.go):
 if instanceConfig.ImageStream != imagemetadata.ReleasedStream {
  startParams.ImageDownloadURL = imagemetadata.UbuntuCloudImagesURL + "/" + instanceConfig.ImageStream
 }

(if no URL is supplied it falls back to "DefaultSource")