diff --git a/bootstrap/templates/kubernetes/talos/talconfig.yaml.j2 b/bootstrap/templates/kubernetes/talos/talconfig.yaml.j2 index 53d568d0..01a44dfe 100644 --- a/bootstrap/templates/kubernetes/talos/talconfig.yaml.j2 +++ b/bootstrap/templates/kubernetes/talos/talconfig.yaml.j2 @@ -75,6 +75,10 @@ nodes: ip: "{{ cluster.endpoint_vip }}" {% endif %} {% endif %} + {% if distribution.talos.user_patches %} + patches: + - "@./patches/node_{{ item.name }}.yaml" + {% endif %} {% endfor %} patches: @@ -183,6 +187,10 @@ patches: - slot: 0 tpm: {} {% endif %} + {% if distribution.talos.user_patches %} + # User specified global patches + - "@./patches/global.yaml" + {% endif %} controlPlane: patches: @@ -224,3 +232,15 @@ controlPlane: allowedKubernetesNamespaces: - system-upgrade + {% if distribution.talos.user_patches %} + # User specified controlPlane patches + - "@./patches/controlPlane.yaml" + {% endif %} + +{% if ( (distribution.talos.user_patches) and + (nodes.inventory | selectattr('controller', 'equalto', False) | list | length) ) %} +worker: + patches: + # User specified worker patches + - "@./patches/worker.yaml" +{% endif %} diff --git a/config.sample.yaml b/config.sample.yaml index 15c2019d..bf5cafd8 100644 --- a/config.sample.yaml +++ b/config.sample.yaml @@ -40,6 +40,15 @@ distribution: # # (Optional) Enable TPM-based disk encryption. Requires TPM 2.0 # # See: https://www.talos.dev/v1.6/talos-guides/install/bare-metal-platforms/secureboot/#disk-encryption-with-tpm # encrypt_disk_with_tpm: true + # user_patches: true + # # (Optional) Add includes for user provided patches to generated talconfig.yaml. + # # See: https://github.com/budimanjojo/talhelper/blob/179ba9ed42f70069c7842109bea24f769f7af6eb/example/extraKernelArgs-patch.yaml + # # Patches are applied in this order. (global overrides cp/worker which overrides node-specific). + # # Create these files to allow talos:bootstrap-genconfig to complete (empty files are ok). + # # kubernetes/talos/patches/node_.yaml # Patches for individual nodes + # # kubernetes/talos/patches/controlPlane.yaml # Patches for controlplane nodes + # # kubernetes/talos/patches/worker.yaml # Patches for worker nodes + # # kubernetes/talos/patches/global.yaml # Patches for ALL nodes # # (Required) Timezone is your IANA formatted timezone (e.g. America/New_York)