The current definition of additionalUserData in RKE2ControlPlane and RKE2Config has two main issues:
- additionalUserData.config (Ignition) and additionalUserData.data (cloud-init) have different types (string vs map[string]string) and implementation
- both implementations (string and map[string]string) are sub-optimal to represent a schemaless nested object, but of the two, map[string]string is absolutely the most confusing and hard to work with (see cloud-init arbitraryTemplate handling)
The most appropriate and straightforward implementation would be map[string]runtime.RawExtension, like this example. This can support cloud-init and ignition equally, with a better user experience and simpler deserialization and (strict: true) validation (no more template complexity):
Old
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: cloud-init
spec:
agentConfig:
format: cloud-init
additionalUserData:
strict: true
data:
bootcmd: |
- touch /foo.bar
- touch /bar.foo
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: RKE2ControlPlane
metadata:
name: ignition
spec:
agentConfig:
format: ignition
additionalUserData:
strict: true
config: |
storage:
luks:
- name: data
device: /dev/disk/by-partlabel/USR-B
New
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
kind: RKE2ControlPlane
metadata:
name: cloud-init
spec:
agentConfig:
format: cloud-init
additionalUserData:
strict: true
cloudConfig:
bootcmd:
- touch /foo.bar
- touch /bar.foo
---
apiVersion: controlplane.cluster.x-k8s.io/v1beta2
kind: RKE2ControlPlane
metadata:
name: ignition
spec:
agentConfig:
format: ignition
additionalUserData:
strict: true
cloudConfig:
storage:
luks:
- name: data
device: /dev/disk/by-partlabel/USR-B
The new cloudConfig key is just a quick suggestion to have 1 seamless definition, instead of unnecessarily splitting between config and data, since the user can already configure the format field.
Warning: API conversion is going to be the biggest challenge of this issue.
The current definition of additionalUserData in RKE2ControlPlane and RKE2Config has two main issues:
The most appropriate and straightforward implementation would be
map[string]runtime.RawExtension, like this example. This can support cloud-init and ignition equally, with a better user experience and simpler deserialization and (strict: true) validation (no more template complexity):Old
New
The new
cloudConfigkey is just a quick suggestion to have 1 seamless definition, instead of unnecessarily splitting betweenconfiganddata, since the user can already configure theformatfield.Warning: API conversion is going to be the biggest challenge of this issue.