talosctl gen config but not all of them.
Configuration patching allows modifying machine configuration to fit it for the cluster or a specific machine.
Configuration Patch Formats
Talos supports two configuration patch formats:- strategic merge patches
- RFC6902 (JSON patches)
Note: Talos 1.5+ supports multi-document machine configuration. JSON patches don’t support multi-document machine configuration, while strategic merge patches do.
Strategic Merge patches
Strategic merge patches look like incomplete machine configuration files:- If the field value is a list, the patch value is appended to the list, with the following exceptions:
- values of the fields
cluster.network.podSubnetsandcluster.network.serviceSubnetsare overwritten on merge network.interfacessection is merged with the value in the machine config if there is a match oninterface:ordeviceSelector:keysnetwork.interfaces.vlanssection is merged with the value in the machine config if there is a match on thevlanId:keycluster.apiServer.auditPolicyvalue is replaced on mergeExtensionServiceConfig.configFilessection is merged matching onmountPath(replacingcontentif matches)
- values of the fields
- for each document in the patch, the document is merged with the respective document in the machine configuration (matching by
kind,apiVersionandnamefor named documents) - if the patch document doesn’t exist in the machine configuration, it is appended to the machine configuration
$patch: delete syntax similar to the
Kubernetes
strategic merge patch.
For example, with configuration:
v1alpha1 configuration!) using this syntax:
SideroLinkConfig and ExtensionServiceConfig with name foo from the configuration.
RFC6902 (JSON Patches)
JSON patches can be written either in JSON or YAML format. A proper JSON patch requires anop field that depends on the machine configuration contents: whether the path already exists or not.
For example, the strategic merge patch from the previous section can be written either as:
op depends on whether the /machine/network/hostname section exists already in the machine config or not.
Examples
Machine Network
Base machine configuration:192.168.10.50 to the eth0 interface and add another interface eth1 with DHCP enabled.
- Strategic merge patch
- JSON patch
Cluster Network
Base machine configuration:- Strategic merge patch
- JSON patch
cluster:
network:
podSubnets:
- 192.168.0.0/16 serviceSubnets:
- 192.0.0.0/12 cni: name: none
Kubelet
Base machine configuration:kubelet node IP to come from the subnet 192.168.10.0/24.
- Strategic merge patch
- JSON patch
machine:
kubelet:
nodeIP:
validSubnets:
- 192.168.10.0/24
Admission Control: Pod Security Policy
Base machine configuration:rook-ceph.
- Strategic merge patch
- JSON patch
Configuration Patching with talosctl CLI
Several talosctl commands accept config patches as command-line flags.
Config patches might be passed either as an inline value or as a reference to a file with @file.patch syntax:
talosctl gen config:
talosctl machineconfig patch
talosctl patch: