-
Notifications
You must be signed in to change notification settings - Fork 78
feat: support kernel args management in cluster templates #2020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: support kernel args management in cluster templates #2020
Conversation
19f7f51 to
8e70c8c
Compare
8e70c8c to
14eeceb
Compare
There was a problem hiding this 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
kernelArgsfield 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-templatesannotation - Added
--include-kernel-argsflag toomnictl cluster template exportto 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.
14eeceb to
90be41c
Compare
There was a problem hiding this 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.
90be41c to
a732d08
Compare
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>
a732d08 to
17a55a2
Compare
Implement kernel args support in cluster templates.
Managing kernel args via templates is opt-in: only and only if the
kernelArgsYAML key is defined on aCluster,ControlPlane,WorkerorMachine, the matchingKernelArgsresource 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,
kernelArgskey doesn't exist) or whenomnictl cluster template deleteis run. They instead will get updated to have the annotationomni.sidero.dev/managed-by-cluster-templatesremoved from them.Add the new flag
--include-kernel-argsto theomnictl cluster template exportcommand to optionally include them in the exported template. Note: when this flag is set,kernelArgskey 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.