Skip to content

Conversation

@utkuozdemir
Copy link
Member

Implement kernel args support in cluster templates.

Managing kernel args via templates is opt-in: only and only if the kernelArgs YAML key is defined on a Cluster, ControlPlane, Worker or Machine, the matching KernelArgs resource will be created/updated.

Lower levels override higher levels (Cluster -> MachineSet -> Machine).

Unlike other cluster template managed resources, they will never be destroyed, i.e, when they are removed from a template (removed completely, as in, kernelArgs key doesn't exist) or when omnictl cluster template delete is run. They instead will get updated to have the annotation omni.sidero.dev/managed-by-cluster-templates removed from them.

Add the new flag --include-kernel-args to the omnictl cluster template export command to optionally include them in the exported template. Note: when this flag is set, kernelArgs key is always included at per-machine level, not pulled up even if they are the same for all machines in a machine set or a cluster.

Update the frontend, specifically the kernel args update screen to warn the user if kernel args for that machine is managed by templates, similar to what we do for clusters.

Closes #1940.

@utkuozdemir utkuozdemir self-assigned this Dec 17, 2025
@utkuozdemir utkuozdemir requested a review from Slessi as a code owner December 17, 2025 11:08
@talos-bot talos-bot moved this to In Review in Planning Dec 17, 2025
@utkuozdemir utkuozdemir force-pushed the feat/kernel-args-from-cluster-templates branch from 19f7f51 to 8e70c8c Compare December 17, 2025 14:04
@utkuozdemir utkuozdemir requested a review from Copilot December 17, 2025 14:05
@utkuozdemir utkuozdemir force-pushed the feat/kernel-args-from-cluster-templates branch from 8e70c8c to 14eeceb Compare December 17, 2025 14:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements kernel arguments (kernel args) management in cluster templates, allowing users to specify kernel arguments at the Cluster, ControlPlane/Workers (MachineSet), or Machine level. The feature is opt-in and includes support for hierarchical overrides where lower levels (Machine) override higher levels (Cluster).

Key changes:

  • Added kernelArgs field to cluster template models with hierarchical override support (Cluster → MachineSet → Machine)
  • KernelArgs resources are never destroyed when removed from templates or during template deletion; instead, they are "orphaned" by removing the omni.sidero.dev/managed-by-cluster-templates annotation
  • Added --include-kernel-args flag to omnictl cluster template export to optionally export kernel arguments in templates

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/views/omni/Modals/UpdateKernelArgs.vue Refactored to use composables (useResourceGet) and added ManagedByTemplatesWarning component to alert users when kernel args are template-managed
frontend/src/views/cluster/ManagedByTemplatesWarning.vue Generalized component to accept any resource (not just clusters) and display appropriate warnings based on resource type
frontend/src/views/omni/Clusters/Management/ClusterScale.vue Updated prop name from cluster to resource for ManagedByTemplatesWarning component
frontend/src/views/cluster/Config/Patches.vue Updated prop name from cluster to resource for ManagedByTemplatesWarning component
frontend/src/views/cluster/Config/PatchEdit.vue Updated prop name from cluster to resource for ManagedByTemplatesWarning component
client/pkg/template/testdata/cluster-with-kernel-args.yaml Test template demonstrating various kernel args inheritance scenarios (override, inheritance, empty arrays)
client/pkg/template/testdata/cluster-with-kernel-args-resources.yaml Expected resource output for kernel args template test cases
client/pkg/template/template_test.go Added comprehensive lifecycle test for kernel args (create, orphan, delete) ensuring they're never destroyed
client/pkg/template/template.go Core logic for collecting actual kernel args, handling orphaning on sync/delete, and validation of resource conflicts
client/pkg/template/order.go Added KernelArgsType to canonical resource ordering for proper resource creation/deletion sequencing
client/pkg/template/operations/testdata/export/cluster-template-with-kernel-args.yaml Test data showing exported template with kernel args at machine level
client/pkg/template/operations/testdata/export/cluster-resources.yaml Updated test resources to include kernel args resources with managed annotation
client/pkg/template/operations/sync.go Refactored sync logic into reusable function shared by sync and delete operations
client/pkg/template/operations/export_test.go Updated tests to verify export with and without kernel args based on flag
client/pkg/template/operations/export.go Added kernel args collection and export logic with includeKernelArgs flag support
client/pkg/template/operations/delete.go Updated to use shared sync function for consistency
client/pkg/template/internal/models/models.go Added kernel args context fields for template translation (cluster/machineset level args)
client/pkg/template/internal/models/machineset.go Added KernelArgs field, validation, and translation logic with inheritance from cluster level
client/pkg/template/internal/models/machine.go Added KernelArgs field, validation, and translation logic with inheritance from machineset/cluster levels
client/pkg/template/internal/models/list.go Updated translation context building to populate kernel args at cluster and machineset levels; exempted KernelArgs from cluster label validation
client/pkg/template/internal/models/kernelargs.go New wrapper type for kernel args with Get/Set methods and resource builder function
client/pkg/template/internal/models/cluster.go Added KernelArgs field and validation to Cluster model
client/pkg/omnictl/cluster/template/export.go Added --include-kernel-args CLI flag to export command

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@utkuozdemir utkuozdemir force-pushed the feat/kernel-args-from-cluster-templates branch from 14eeceb to 90be41c Compare December 17, 2025 15:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-project-automation github-project-automation bot moved this from In Review to Approved in Planning Dec 19, 2025
@utkuozdemir utkuozdemir force-pushed the feat/kernel-args-from-cluster-templates branch from 90be41c to a732d08 Compare December 19, 2025 13:25
Implement kernel args support in cluster templates.

Managing kernel args via templates is opt-in: only and only if the `kernelArgs` YAML key is defined on a `Cluster`, `ControlPlane`, `Worker` or `Machine`, the matching `KernelArgs` resource will be created/updated.

Lower levels override higher levels (Cluster -> MachineSet -> Machine).

Unlike other cluster template managed resources, they will never be destroyed, i.e, when they are removed from a template (removed completely, as in, `kernelArgs` key doesn't exist) or when `omnictl cluster template delete` is run. They instead will get updated to have the annotation `omni.sidero.dev/managed-by-cluster-templates` removed from them.

Add the new flag `--include-kernel-args` to the `omnictl cluster template export` command to optionally include them in the exported template. Note: when this flag is set, `kernelArgs` key is always included at per-machine level, not pulled up even if they are the same for all machines in a machine set or a cluster.

Update the frontend, specifically the kernel args update screen to warn the user if kernel args for that machine is managed by templates, similar to what we do for clusters.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
@utkuozdemir utkuozdemir force-pushed the feat/kernel-args-from-cluster-templates branch from a732d08 to 17a55a2 Compare December 19, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

[feature] support kernel args customization support in cluster templates

4 participants