Skip to content

Commit e4ef494

Browse files
committed
fix: drop the persist config flag from gen config
The `persist` value was locked to be true for a long time now, and Talos doesn't support any other mode (machine config is persisted). Drop the `gen config` flag and related generate options, as modern Talos doesn't accept `persist: false`. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent c3176ad commit e4ef494

5 files changed

Lines changed: 3 additions & 18 deletions

File tree

cmd/talosctl/cmd/mgmt/gen/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ var genConfigCmdFlags struct {
7070
configPatchControlPlane []string
7171
configPatchWorker []string
7272
registryMirrors []string
73-
persistConfig bool
7473
withExamples bool
7574
withDocs bool
7675
withClusterDiscovery bool
@@ -233,7 +232,6 @@ func writeConfig(args []string) error {
233232
generate.WithInstallImage(genConfigCmdFlags.installImage),
234233
generate.WithAdditionalSubjectAltNames(genConfigCmdFlags.additionalSANs),
235234
generate.WithDNSDomain(genConfigCmdFlags.dnsDomain),
236-
generate.WithPersist(genConfigCmdFlags.persistConfig),
237235
generate.WithClusterDiscovery(genConfigCmdFlags.withClusterDiscovery),
238236
)
239237

@@ -442,7 +440,6 @@ func init() {
442440
genConfigCmd.Flags().StringArrayVar(&genConfigCmdFlags.configPatchControlPlane, "config-patch-control-plane", nil, "patch generated machineconfigs (applied to 'init' and 'controlplane' types)")
443441
genConfigCmd.Flags().StringArrayVar(&genConfigCmdFlags.configPatchWorker, "config-patch-worker", nil, "patch generated machineconfigs (applied to 'worker' type)")
444442
genConfigCmd.Flags().StringSliceVar(&genConfigCmdFlags.registryMirrors, "registry-mirror", []string{}, "list of registry mirrors to use in format: <registry host>=<mirror URL>")
445-
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.persistConfig, "persist", "p", true, "the desired persist value for configs")
446443
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.withExamples, "with-examples", "", true, "renders all machine configs with the commented examples")
447444
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.withDocs, "with-docs", "", true, "renders all machine configs adding the documentation for each field")
448445
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.withClusterDiscovery, "with-cluster-discovery", "", true, "enable cluster discovery feature")

pkg/machinery/config/generate/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (in *Input) init() ([]config.Document, error) {
2323
v1alpha1Config := &v1alpha1.Config{
2424
ConfigVersion: "v1alpha1",
2525
ConfigDebug: pointer.To(in.Options.Debug),
26-
ConfigPersist: pointer.To(in.Options.Persist),
26+
ConfigPersist: pointer.To(true),
2727
}
2828

2929
networkConfig := &v1alpha1.NetworkConfig{}

pkg/machinery/config/generate/options.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,6 @@ func WithDebug(enable bool) Option {
151151
}
152152
}
153153

154-
// WithPersist enables persistence of machine config across reboots.
155-
func WithPersist(enable bool) Option {
156-
return func(o *Options) error {
157-
o.Persist = enable
158-
159-
return nil
160-
}
161-
}
162-
163154
// WithClusterCNIConfig specifies custom cluster CNI config.
164155
func WithClusterCNIConfig(config *v1alpha1.CNIConfig) Option {
165156
return func(o *Options) error {
@@ -255,8 +246,7 @@ type Options struct {
255246
SecretsBundle *secrets.Bundle
256247

257248
// Base settings.
258-
Debug bool
259-
Persist bool
249+
Debug bool
260250

261251
// Machine settings: install.
262252
InstallDisk string
@@ -298,7 +288,6 @@ type Options struct {
298288
func DefaultOptions() Options {
299289
return Options{
300290
DNSDomain: "cluster.local",
301-
Persist: true,
302291
Roles: role.MakeSet(role.Admin),
303292
}
304293
}

pkg/machinery/config/generate/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (in *Input) worker() ([]config.Document, error) {
2424
v1alpha1Config := &v1alpha1.Config{
2525
ConfigVersion: "v1alpha1",
2626
ConfigDebug: pointer.To(in.Options.Debug),
27-
ConfigPersist: pointer.To(in.Options.Persist),
27+
ConfigPersist: pointer.To(true),
2828
}
2929

3030
networkConfig := &v1alpha1.NetworkConfig{}

website/content/v1.13/reference/cli.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,6 @@ talosctl gen config <cluster name> <cluster endpoint> [flags]
17281728
--kubernetes-version string desired kubernetes version to run (default "1.35.0")
17291729
-o, --output string destination to output generated files. when multiple output types are specified, it must be a directory. for a single output type, it must either be a file path, or "-" for stdout
17301730
-t, --output-types strings types of outputs to be generated. valid types are: ["controlplane" "worker" "talosconfig"] (default [controlplane,worker,talosconfig])
1731-
-p, --persist the desired persist value for configs (default true)
17321731
--registry-mirror strings list of registry mirrors to use in format: <registry host>=<mirror URL>
17331732
--talos-version string the desired Talos version to generate config for (backwards compatibility, e.g. v0.8)
17341733
--version string the desired machine config version to generate (default "v1alpha1")

0 commit comments

Comments
 (0)