drakkar-lig / walt-python-packages

Home of walt-node, walt-server, walt-client and walt-common python packages.
https://walt-project.liglab.fr
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

Clever selection of initial images #73

Closed eduble closed 1 year ago

eduble commented 2 years ago

When a new user uses walt image show for the first time, the default image of each node type present on the platform is cloned. If several raspberry pi models exist on the platform, an image is cloned for each of these models. But these are all clones of the same image, since the default raspberry pi image can handle all models (plus qemu-arm-32 & qemu-arm-64). Getting just one image called rpi-default would be better. This could be achieved by using an optional docker label "walt.image.preferred-name=rpi-default:latest". The server algorithm to check which initial images should be cloned could be:

models=<list-of-models-on-the-platform>
while not models.empty():
    model = models[0]
    inspect docker labels of waltplatform/<model>-default:latest
    if a label walt.image.preferred-name exists:
         clone waltplatform/<model>-default:latest and name it as <user>/<preferred-name>
    else:
         clone waltplatform/<model>-default:latest and name it as <user>/<model>-default:latest
    remove from models all models declared in label "walt.node.models"

The preferred name should also be used when creating a virtual node (when cloning the default image in the user workspace to let him own the new node).