ionos-cloud / cluster-api-provider-proxmox

Cluster API Provider for Proxmox VE (CAPMOX)
Apache License 2.0
181 stars 24 forks source link

incorrect cloudinit template (network gateway) with ipv6only setup #39

Closed lucasl0st closed 9 months ago

lucasl0st commented 9 months ago

The ipv6 address and gateway only get set correctly when it would get to this default case:

https://github.com/ionos-cloud/cluster-api-provider-proxmox/blob/a1666e478f0b4f990da0a0ef59a7f6d63397b2cd/internal/service/vmservice/bootstrap.go#L197C4-L197C4

It never gets to that default case because len(config.MacAddress) == 0: is true

Which results in a cloudinit template that looks like this (0.0.0.0 gateway instead of ::/0):

instance-id: e7fc6bd1-dd59-4d01-aa49-c1e9dade2672
local-hostname: proxmox-quickstart-control-plane-wvlt7
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      match:
        macaddress: BC:24:11:B9:4A:C3
      dhcp4: 'no'
      addresses:
        - 2a03:4000:20:18b:aaaa::a/64
      routes:
        - to: 0.0.0.0/0
          via: 2a03:4000:20:18b:be24:11ff:fe20:b2ed
      nameservers:
        addresses:
          - 2a03:4000:20:18b:be24:11ff:fe20:b2ed

Full configuration I used here: https://gist.github.com/lucasl0st/4fe31d5f9b936520f177c42efeb157e7

The v4/v6 should probably be handled in this function instead: https://github.com/ionos-cloud/cluster-api-provider-proxmox/blob/a1666e478f0b4f990da0a0ef59a7f6d63397b2cd/internal/service/vmservice/bootstrap.go#L144

pborn-ionos commented 9 months ago

Hi Lucas,

could you please update your CAPMOX Deployment to use image ttl.sh/cluster-api-provider-proxmox:issue-39@sha256:a961f24295473c41a1bdddaabf29d3e3a2fc80b1ae236de2f20f6e20e864808f (will automatically be purged in 24 hours) and give it a another try? You can also compile it by yourself by using the code in branch fix/39 :)

lucasl0st commented 9 months ago

Hi Philipp! I tried the branch, it works correctly now, thanks 🙂