Skip to content

Commit

Permalink
feat: add partial config support to talosctl cluster create
Browse files Browse the repository at this point in the history
Allow passing a partial config to the machines using the `--input-dir` flag of `talosctl cluster create`.
With this change, it is not required to have talosconfig inside the input directory, neither for the configuration documents to contain a `v1alpha1` config document. They can solely contain maintenance config, e.g., `KmsgLogConfig`.

This is useful for testing scenarios such as partial machine configs being provided via cloud user data.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
  • Loading branch information
utkuozdemir committed Feb 20, 2024
1 parent 64e9703 commit 815a8e9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion cmd/talosctl/cmd/mgmt/cluster/create.go
Expand Up @@ -706,6 +706,17 @@ func create(ctx context.Context, flags *pflag.FlagSet) error {
return err
}

bundleTalosconfig := configBundle.TalosConfig()
if bundleTalosconfig == nil {
if clusterWait {
return errors.New("no talosconfig in the config bundle: cannot wait for cluster")
}

if applyConfigEnabled {
return errors.New("no talosconfig in the config bundle: cannot apply config")
}
}

if skipInjectingConfig {
types := []machine.Type{machine.TypeControlPlane, machine.TypeWorker}

Expand Down Expand Up @@ -827,8 +838,13 @@ func create(ctx context.Context, flags *pflag.FlagSet) error {
return err
}

// No talosconfig in the bundle - skip the operations below
if bundleTalosconfig == nil {
return nil
}

// Create and save the talosctl configuration file.
if err = saveConfig(configBundle.TalosConfig()); err != nil {
if err = saveConfig(bundleTalosconfig); err != nil {
return err
}

Expand Down

0 comments on commit 815a8e9

Please sign in to comment.