Skip to content

Commit

Permalink
feat: preserve maintenance machine configs
Browse files Browse the repository at this point in the history
When a machine has a partial machine config (e.g., `SideroLinkConfig` or `KmsgLogConfig`) while being in maintenance mode, detect and store it on Omni side.

When this machine has a config applied to it (i.e., when it joins to a cluster) or when its config is updated, always preserve these detected configs in addition to the main (`v1alpha1`) config.

This allows machines to join Omni by using partial configs (for example, by using cloud user data) instead of having kernel args for the SideroLink and kernel log sync configuration.

We do not fail in the cases where we are not authorized to access the COSI resource API, as the full access to the resources over SideroLink is only available in Talos v1.6.5 and above.

Modify the Talos upgrade integration tests to apply a partial config during maintenance mode, and later assert that it was preserved through the upgrade/revert flow.

Additionally, bump the default Talos version and the version used in the integration tests to 1.6.6.

Closes #13.

Signed-off-by: Utku Ozdemir <[email protected]>
  • Loading branch information
utkuozdemir committed Mar 13, 2024
1 parent 190218a commit 8173377
Show file tree
Hide file tree
Showing 15 changed files with 1,629 additions and 1,019 deletions.
2,101 changes: 1,090 additions & 1,011 deletions client/api/omni/specs/omni.pb.go

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions client/api/omni/specs/omni.proto
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ message MachineStatusSpec {
bool invalid = 2;
}

message MaintenanceConfig {
// Config is the machine config.
string config = 1;
}

// Talos version.
string talos_version = 1;

Expand Down Expand Up @@ -178,6 +183,8 @@ message MachineStatusSpec {
map<string, string> image_labels = 13;

Schematic schematic = 14;

MaintenanceConfig maintenance_config = 15;
}

// TalosConfigSpec describes a Talos cluster config.
Expand Down
227 changes: 227 additions & 0 deletions client/api/omni/specs/omni_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const SecureBoot = "secureboot"
// DefaultTalosVersion is pre-selected in the UI, default image and used in the integration tests.
//
// tsgen:DefaultTalosVersion
const DefaultTalosVersion = "1.6.4"
const DefaultTalosVersion = "1.6.6"

const (
// TalosRegistry is the default Talos repository URL.
Expand Down
9 changes: 9 additions & 0 deletions cmd/integration-test/pkg/tests/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ import (
"github.com/siderolabs/omni/client/pkg/omni/resources/virtual"
)

// BeforeClusterCreateFunc is a function that is called before a cluster is created.
type BeforeClusterCreateFunc func(ctx context.Context, t *testing.T, cli *client.Client, machineIDs []resource.ID)

// ClusterOptions are the options for cluster creation.
//
//nolint:govet
Expand All @@ -48,6 +51,8 @@ type ClusterOptions struct {
EtcdBackup *specs.EtcdBackupConf

MachineOptions MachineOptions

BeforeClusterCreateFunc BeforeClusterCreateFunc
}

// MachineOptions are the options for machine creation.
Expand All @@ -68,6 +73,10 @@ func CreateCluster(testCtx context.Context, cli *client.Client, options ClusterO
pickUnallocatedMachines(ctx, t, st, options.ControlPlanes+options.Workers, func(machineIDs []resource.ID) {
checkExtensionWithRetries(ctx, t, cli, HelloWorldServiceExtensionName, machineIDs...)

if options.BeforeClusterCreateFunc != nil {
options.BeforeClusterCreateFunc(ctx, t, cli, machineIDs)
}

cluster := omni.NewCluster(resources.DefaultNamespace, options.Name)
cluster.TypedSpec().Value.TalosVersion = options.MachineOptions.TalosVersion
cluster.TypedSpec().Value.KubernetesVersion = options.MachineOptions.KubernetesVersion
Expand Down
Loading

0 comments on commit 8173377

Please sign in to comment.