Code review comment for ~chad.smith/cloud-init:feature/azure-to-network-v2

Revision history for this message
Chad Smith (chad.smith) wrote :

Validated on disco given eth0 (with addtional secondary IP) and eth1 (dhcp secondary NIC)
# QUESTION: am I missing a metric 200 on 10.0.0.8?

ubuntu@SRU-worked-azure:~$ python3 -c 'from cloudinit.sources.DataSourceAzure import get_metadata_from_imds; print(get_metadata_from_imds("eth0", 1))'
{'compute': {'location': 'eastus2', 'name': 'test-sru-disco', 'offer': 'UbuntuServer', 'osType': 'Linux', 'placementGroupId': '', 'platformFaultDomain': '0', 'platformUpdateDomain': '0', 'publisher': 'Canonical', 'resourceGroupName': 'srugroup1', 'sku': '19.04-DAILY', 'subscriptionId': '12aad61c-6de4-4e53-a6c6-5aff52a83777', 'tags': '', 'version': '19.04.201908010', 'vmId': 'b838afe4-23fd-4f34-b66c-622767857444', 'vmScaleSetName': '', 'vmSize': 'Standard_DS1_v2', 'zone': ''}, 'network': {'interface': [{'ipv4': {'ipAddress': [{'privateIpAddress': '10.0.0.5', 'publicIpAddress': '40.84.36.124'}, {'privateIpAddress': '10.0.0.23', 'publicIpAddress': ''}], 'subnet': [{'address': '10.0.0.0', 'prefix': '24'}]}, 'ipv6': {'ipAddress': []}, 'macAddress': '000D3A7B7C34'}, {'ipv4': {'ipAddress': [{'privateIpAddress': '10.0.0.8', 'publicIpAddress': ''}], 'subnet': [{'address': '10.0.0.0', 'prefix': '24'}]}, 'ipv6': {'ipAddress': []}, 'macAddress': '000D3A7B9E10'}]}}
ubuntu@SRU-worked-azure:~$ cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eth0:
            addresses:
            - 10.0.0.23/24
            dhcp4: true
            dhcp4-overrides:
                route-metric: 100
            match:
                macaddress: 00:0d:3a:7b:7c:34
            set-name: eth0
        eth1:
            dhcp4: true
            dhcp4-overrides:
                route-metric: 200
            match:
                macaddress: 00:0d:3a:7b:9e:10
            set-name: eth1
    version: 2
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0d:3a:7b:7c:34 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.23/24 brd 10.0.0.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 10.0.0.5/24 brd 10.0.0.255 scope global secondary eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::20d:3aff:fe7b:7c34/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0d:3a:7b:9e:10 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.8/24 brd 10.0.0.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::20d:3aff:fe7b:9e10/64 scope link
       valid_lft forever preferred_lft forever

ubuntu@SRU-worked-azure:~$ ip route show
default via 10.0.0.1 dev eth0 proto dhcp src 10.0.0.5 metric 100
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.23
10.0.0.0/24 dev eth1 proto kernel scope link src 10.0.0.8
168.63.129.16 via 10.0.0.1 dev eth0 proto dhcp src 10.0.0.5 metric 100
169.254.169.254 via 10.0.0.1 dev eth0 proto dhcp src 10.0.0.5 metric 100
ubuntu@SRU-worked-azure:~$ cat /run/systemd/network/10-netplan-eth
10-netplan-eth0.link 10-netplan-eth1.link
10-netplan-eth0.network 10-netplan-eth1.network
ubuntu@SRU-worked-azure:~$ cat /run/systemd/network/10-netplan-eth1.network
[Match]
MACAddress=00:0d:3a:7b:9e:10
Name=eth1

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=200
UseMTU=true
ubuntu@SRU-worked-azure:~$ cat /run/systemd/network/10-netplan-eth0.network
[Match]
MACAddress=00:0d:3a:7b:7c:34
Name=eth0

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
Address=10.0.0.23/24

[DHCP]
RouteMetric=100
UseMTU=true

« Back to merge proposal