Skip to content
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

feat: compute schematic id only from the extensions #74

Merged
merged 1 commit into from
Mar 22, 2024

Conversation

utkuozdemir
Copy link
Member

When determining the schematic ID of a machine, instead of relying the ID on the schematic ID meta-extension, compute the ID by gathering the extensions on the machine. This way, the extension ID will not contain the META values, labels or the kernel args.

This ID is actually the ID we need, as when we compare the desired schematic with the actual one during a Talos upgrade, we are only interested in the changes in the list of extensions.

This does not cause the kernel args, labels, etc. to disappear, as they are used at installation time and preserved afterward (e.g., during upgrades).

Additionally:

  • Remove the list of extensions from the Schematic resource, as it relied upon the schematics always being created through Omni. This is not always the case - i.e., when a partial join config is used. Therefore, instead of relying on it, we store the list of extensions by directly reading them from the machine and storing them on the MachineStatus resource.
  • Skip setting the schematic META section at all if there are no labels set on Download Installation Media screen.

Closes #55.

@utkuozdemir utkuozdemir requested a review from Unix4ever March 15, 2024 14:05
@utkuozdemir utkuozdemir force-pushed the extensions-only-machine-schematic branch 2 times, most recently from 9fb2b01 to ffc9a44 Compare March 15, 2024 17:18
@@ -30,7 +29,7 @@ import (
type TalosExtensionsController = qtransform.QController[*omni.TalosVersion, *omni.TalosExtensions]

// NewTalosExtensionsController instantiates the TalosExtensions controller.
func NewTalosExtensionsController() *TalosExtensionsController {
func NewTalosExtensionsController(imageFactoryClient *imagefactory.Client) *TalosExtensionsController {
Copy link
Member Author

Choose a reason for hiding this comment

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

Switch to using the new wrapper, so the only point where we create a new image factory GRPC client is actually in magefactory.Client

@@ -311,7 +311,7 @@ const createSchematic = async () => {
meta_values: {},
};

if (labels.value) {
if (labels.value && Object.keys(labels.value).length > 0) {
Copy link
Member Author

Choose a reason for hiding this comment

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

If no labels were set, we were setting here a YAML with empty content for the labels key. Now we do not set any META information if there are no labels.

@utkuozdemir utkuozdemir force-pushed the extensions-only-machine-schematic branch from ffc9a44 to 4600223 Compare March 16, 2024 19:25
@utkuozdemir utkuozdemir added the integration/e2e-upgrades Triggers all e2e upgrades tests for Omni label Mar 16, 2024
@utkuozdemir utkuozdemir force-pushed the extensions-only-machine-schematic branch from 4600223 to 46771f9 Compare March 18, 2024 22:57
@Unix4ever Unix4ever force-pushed the extensions-only-machine-schematic branch 5 times, most recently from 353b0fe to b979005 Compare March 21, 2024 15:43
When determining the schematic ID of a machine, instead of relying the ID on the schematic ID meta-extension, compute the ID by gathering the extensions on the machine. This way, the extension ID will not contain the META values, labels or the kernel args.

This ID is actually the ID we need, as when we compare the desired schematic with the actual one during a Talos upgrade, we are only interested in the changes in the list of extensions.

This does not cause the kernel args, labels, etc. to disappear, as they are used at installation time and preserved afterward (e.g., during upgrades).

Additionally:
- Remove the list of extensions from the `Schematic` resource, as it relied upon the schematics always being created through Omni. This is not always the case - i.e., when a partial join config is used. Therefore, instead of relying on it, we store the list of extensions by directly reading them from the machine and storing them on the `MachineStatus` resource.
- Skip setting the schematic META section at all if there are no labels set on Download Installation Media screen.

Closes #55.

Signed-off-by: Utku Ozdemir <[email protected]>
@Unix4ever Unix4ever force-pushed the extensions-only-machine-schematic branch from b979005 to 176f9d9 Compare March 22, 2024 11:59
@Unix4ever
Copy link
Member

/m

@talos-bot talos-bot merged commit 176f9d9 into main Mar 22, 2024
18 checks passed
@talos-bot talos-bot deleted the extensions-only-machine-schematic branch March 22, 2024 12:55
@utkuozdemir
Copy link
Member Author

🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration/e2e-upgrades Triggers all e2e upgrades tests for Omni
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Calculate additional schematic ID in the machine status using extensions list only
4 participants