OpenStack cloud-init in OpenWrt

Hello everyone.

I'm trying to make a openwrt image file whit cloud-init inside, which i can upload it on my OpenStack and run a instance with that image.

The idea behind this is for using this image as a cloud router with web UI, so the instances which are in the same project as the instance with openwrt image, can connect to this router(openwrt instance) and also to add other functions that default OpenStack network management does not support.

So i want to ask is such a thing possible/existing right now and if it is possible from where i can read some information how to make such a thing.

Bump please

bump help please

I'm at the phone right now so I can not go into that much detail...

I'm not aware of a already out of the box working solution but there are at least tutorials online where people using hetzner cloud to run OpenWrt. If I'm not totally mistaken then hetzner is using Openstack for their cloud too.

Anyway I wanted to run OpenWrt on Openstack too but did not yet found the time to test or try it yet. But my initial idea would be to create a subnet and port with fixed addresses and configure /etc/config upfront and try to make an Openstack volume which contains the OpenWrt images and then see how it comes up. But again, that's just my rough first idea which I have not tested yet. If cloudinit is not already present in OpenWrt already I would for now just skip it and just get OpenWrt running with a static config first.
But I doubt that cloudinit has support for UCI....

@ZzozZ you have not replied but I will leave my 2cents just in case someone else stumbles upon this thread in the future.

First, did you have done any research?
I'm asking because on an half-an-hour online search I even found documentation that people, even openstack devs itself, used openwrt for these "openstack routers" (see "openstack VNF") or at least have done some kind of proof of concepts and the openstack documentation covers this with examples!

Second, there is software which promise excellently what you are looking for: https://github.com/dtroyer/openwrt-packages ("rc.cloud - Minumal shell script implementation of smoser's cloud-init"), sure I did not have tested it, but some copy-paste-style blog posts mentioned this repo in their "tutorials".

Third: May I ask "Why even cloud-init?", because from my (limited) Openstack experience, you have some restrictions on the network setups anyway. Like v4 with private address space only, or one dedicated public ip on an openstack port but an private address on the vm interface and the openstack router then does some NAT; with v6 you can have dhcpv6, or slaac, but not booth(?!) etc etc Then my impression is that Openstack offers so many features and possibilities that a provider does not support all of these features.
So my point is: You need to know the network setup anyway upfront and reflect this in the cloud-init config and have config templates for it and the like.... OR you just configure your openwrt image via the image builder and upload it into the openstack (hint: ./bin/targets/x86/64/openwrt-21.02.1-x86-64-generic-ext4-combined.img just boots without any modification).

Sure, its only a really simple test, but I've setup a openstack network with an subnet which uses a subnet pool to give me a dedicated GUA /64 and set --ipv6-ra-mode slaac --ipv6-address-mode slaac on it, then created a VM on this network....

My image has mostly only this modification:

# /etc/config/network
config interface                'loopback'
        option  device          'lo'
        option  proto           'static'
        option  ipaddr          '127.0.0.1/8'

config device
        option  name            'eth0'

# I had have disabled the firewall upfront
config interface                'wan'
        option  device          'eth0'
        option  proto           'none'
        option  force_link      '1'
        option  ipv6            'auto'
        option  ip6assign       '64'
        option  dns             '2001:4860:4860::8888 2001:4860:4860::8844'
        # The provider offers for some reason no resolver/nameserver on IPv6 :man_shrugging: 

and

# /etc/sysctl.d/12-net.ipv6.conf.eth0.accept_ra.conf
net.ipv6.conf.eth0.accept_ra=2

I'm not sure if I need option ipv6 'auto' but accept_ra=2 is needed, otherwise Linux wont set SLAAC or just no default route via SLAAC, because forwarding is enabled...
An other option would have been to use DHCPv6, but yes.

Forth:

and also to add other functions that default OpenStack network management does not support.

Any specific ideas? Because from what I've heard and seen, is that if people have specific needs on their "virtual router appliance" they will use either a dedicated Network OS or a plain Debian.

So i want to ask is such a thing possible/existing right now and if it is possible from where i can read some information how to make such a thing.

Sure. Just configure your openwrt and upload it as an openstack image and create a VM from it. And like I have written in my first point, if you have control over the openstack cluster you can even use openwrt as an openstack router. If the openstack documentation about it is outdated then I think the openstack mailinglist or bugtracker is a better place to ask, but if you just need an openwrt in a vm to do some networking then just go ahead. I was surprised that there is literally no work needed to make it work.