Skip to content

Add CloudInitNetworkConfigFormat to ProxmoxCluster spec#593

Open
voteblake wants to merge 1 commit intoionos-cloud:mainfrom
voteblake:add-cloudinit-network-config-format
Open

Add CloudInitNetworkConfigFormat to ProxmoxCluster spec#593
voteblake wants to merge 1 commit intoionos-cloud:mainfrom
voteblake:add-cloudinit-network-config-format

Conversation

@voteblake
Copy link
Copy Markdown

@voteblake voteblake commented Dec 29, 2025

Issue #, if available: Fixes #94, #51

Description of changes:

Add a new field to ProxmoxCluster spec that controls the format of cloud-init network-config generation. Supports two formats:

  • netplan (default): Generates config with top-level "network:" key, suitable for netplan-based distributions like Ubuntu and Debian.
  • nocloud: Generates config without the "network:" wrapper, required for cloud-init nocloud datasource consumers like Talos Linux.

Explicit fails on two CAPMOX supported features that cannot be articulated in a pure nocloud cloud-init network-config, that otherwise rely on netplan passthrough. There would be a maintenance burden to this, as mentioned in #94.

I appreciate your time and effort maintaining this repo and considering this change. I'm happy to make any requested changes to the extent of my knowledge and ability.

Testing performed:

In tree tests (fmt, lint, vet, test), using an iso with the new generated network-config with a Talos Linux VM.

Add a new field to ProxmoxCluster spec that controls the format of
cloud-init network-config generation. Supports two formats:

- netplan (default): Generates config with top-level "network:" key,
  suitable for netplan-based distributions like Ubuntu and Debian.
- nocloud: Generates config without the "network:" wrapper, required
  for cloud-init nocloud datasource consumers like Talos Linux.
@github-actions
Copy link
Copy Markdown

Tests

Please note that running unit and e2e tests requires manual approval from a team member.

e2e tests

We use labels to control which e2e tests contexts are run:

Label Behaviour
none Run Generic tests only
e2e/none skip all e2e tests (documentation etc) - overrides all e2e/* labels Do not run any e2e tests
e2e/flatcar run Flatcar e2e tests Add Flatcar tests

ℹ️ Ask a team member to add the requested labels if you don't have enough permissions.

@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Jan 7, 2026

Thanks for the contribution.
Just to let you know - we're not merging any API changes until we have released v1alpha2. I will help you port this to v1alpha2 when it's ready. We can do a proper review then.

@sonarqubecloud
Copy link
Copy Markdown

@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Feb 11, 2026

This is definitely interesting and valuable. As v1alpha1 is frozen and we're focusing on v1alpha2, I'll put this on hold until v1alpha2 is released and we'll revisit it then.

@wikkyk
Copy link
Copy Markdown
Collaborator

wikkyk commented Apr 10, 2026

@voteblake Now that v0.8.0 has been released, are you able to revisit your PR? It needs porting to v1alpha2 but that shouldn't be a huge change.

Copy link
Copy Markdown
Collaborator

@wikkyk wikkyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good PR. It needs just a few tweaks.

"github.com/luthermonson/go-proxmox"
"github.com/stretchr/testify/require"

infrav1alpha1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha1"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
infrav1alpha1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha1"
infrav1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha2"

And update references to infrav1alpha1 elsewhere.

Comment thread pkg/cloudinit/errors.go
Comment on lines +55 to +57
// ErrNoCloudUnsupportedFeature is returned when nocloud format is used with
// features only supported by netplan (VRFs, routing-policy).
ErrNoCloudUnsupportedFeature = errors.New("nocloud format does not support VRFs or routing-policy; use netplan format or remove these features")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pedantic nitpick but can you make capitalisation consistent? Either nocloud or NoCloud.

I know that not everything is consistent but I want the consistency to improve :-)

Comment thread pkg/cloudinit/network.go
"gopkg.in/yaml.v3"
"k8s.io/utils/ptr"

infrav1alpha1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha1"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
infrav1alpha1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha1"
infrav1 "github.com/ionos-cloud/cluster-api-provider-proxmox/api/v1alpha2"

Comment on lines +1051 to +1054
IPAddress: "10.10.10.12/24",
Gateway: "10.10.10.1",
Metric: ptr.To(uint32(100)),
DNSServers: []string{"8.8.8.8", "8.8.4.4"},
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use documentation ranges as per #693 (I'll update contribution guidelines).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use more test scenarios:

  • 1 NIC that is not eth0
  • multiple NICs with unordered names
  • IPv6
  • no gateway/metric/DNS

Plus exercise error handling more, e.g. missing mandatory fields, invalid values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support different cloud-init network-config

2 participants