Cluster member specific keys in preseed files

I want to automate creation of a cluster using preseed files. According to the documentation it is not very clear to me where I should put member specific configuration options, such as bridge.external_interfaces.

In the example for joining a cluster, there is a section member_config in which these keys can be set. Is there a similar section in the preseed file for forming a cluster? When I initialise a cluster interactively and print the YAML “init” preseed in the end, it shows me the empty member_config section:

Would you like a YAML "init" preseed to be printed? (yes/no) [default=no]: yes
config:
  core.https_address: xxx.xx.xx.xxx:8443
networks: []
storage_pools: []
profiles:
- config: {}
  description: ""
  devices: {}
  name: default
projects: []
cluster:
  server_name: server1
  enabled: true
  member_config: []
  cluster_address: ""
  cluster_certificate: ""
  server_address: ""
  cluster_token: ""
  cluster_certificate_path: ""

However, any settings that I put into the member_config section appear to be ignored:

$ cat /tmp/incus-init-preseed.yml 
config:
  core.https_address: xxx.xx.xx.xxx:8443
networks:
- name: incusbr0
  type: bridge
  config:
    ipv4.address: 10.0.0.1/24
    ipv4.dhcp: "true"
    ipv4.dhcp.ranges: 10.0.0.100-10.0.0.254
    ipv4.nat: "true"
storage_pools:
profiles:
- name: default
  devices:
    eth0:
      name: eth0
      nictype: bridged
      parent: incusbr0
      type: nic
cluster:
  server_name: server1
  enabled: true
  member_config:
  - entity: network
    name: incusbr0
    key: bridge.external_interfaces
    value: incus-vlan
$ sudo incus admin init --preseed < /tmp/incus-init-preseed.yml
$ incus network show incusbr0 --target server1
config:
  ipv4.address: 10.0.0.1/24
  ipv4.dhcp: "true"
  ipv4.dhcp.ranges: 10.0.0.100-10.0.0.254
  ipv4.nat: "true"
description: ""
name: incusbr0
type: bridge
used_by:
- /1.0/profiles/default
managed: true
status: Created
locations:
- server1
project: default

The same settings seem to work fine for nodes joining the cluster.
However, while incus allows me to generate a join token for the initial server, it does not allow me to join this server (again), so I cannot set member specific keys this way:

$ sudo incus admin init --preseed < /tmp/incus-join-preseed.yml 
Error: Failed to join cluster: This server is already clustered

I tried to set bridge.external_interfaces in the networks config section directly:

networks:
- name: incusbr0
  type: bridge
  config:
    ipv4.address: 10.0.0.1/24
    ipv4.dhcp: "true"
    ipv4.dhcp.ranges: 10.0.0.100-10.0.0.254
    ipv4.nat: "true"
    bridge.external_interfaces: incus-vlan

and it looks like it is being picked up as a meber specific key during the first initialization:

$ incus network show incusbr0 --target server1
config:
  bridge.external_interfaces: incus-vlan
  ipv4.address: 10.0.0.1/24
  ipv4.dhcp: "true"
  ipv4.dhcp.ranges: 10.0.0.100-10.0.0.254
  ipv4.nat: "true"

However, when I re-run the same command again, I get an error:

Error: Failed to update local member network "incusbr0" in project "default": Config key "bridge.external_interfaces" is cluster member specific

which suggests that incus tries to set this key as a cluster specific key. That is confusing.
As far as I understand, re-configuring an existing installation should be possible, especially if no changes are being made.

So, what is the correct way of setting member specific keys on the first cluster member using preseed files?

$ incus --version
6.0.3
1 Like