Skip to content

Commit

Permalink
chore: deprecate .persist and .extensions
Browse files Browse the repository at this point in the history
This commit deprecates those things:
- Removes the support of `.persist` flag. From now, it should always be enabled or not defined in the config.
- Removes the documentation for `.bootloader`. It never worked anyway.
- Adds a warning for `.machine.install.extensions`, suggests to use boot-assets.

Closes #7972
Closes #7507

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
  • Loading branch information
DmitriyMV committed Nov 22, 2023
1 parent 95e33f6 commit 70d53ee
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 131 deletions.
Binary file modified api/api.descriptors
Binary file not shown.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ require (
github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b // indirect
github.com/sethgrid/pester v1.2.0 // indirect
github.com/siderolabs/go-api-signature v0.3.1 // indirect
github.com/siderolabs/protoenc v0.2.0 // indirect
github.com/siderolabs/protoenc v0.2.1 // indirect
github.com/siderolabs/tcpproxy v0.1.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/afero v1.9.3 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/briandowns/spinner v1.19.0 h1:s8aq38H+Qju89yhp89b4iIiMzMm8YN3p6vGpwyh/a8E=
github.com/briandowns/spinner v1.19.0/go.mod h1:mQak9GHqbspjC/5iUx3qMlIho8xBS/ppAL/hX5SmPJU=
github.com/brianvoe/gofakeit/v6 v6.17.0 h1:obbQTJeHfktJtiZzq0Q1bEpsNUs+yHrYlPVWt7BtmJ4=
github.com/brianvoe/gofakeit/v6 v6.17.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/brianvoe/gofakeit/v6 v6.24.0 h1:74yq7RRz/noddscZHRS2T84oHZisW9muwbb8sRnU52A=
github.com/brianvoe/gofakeit/v6 v6.24.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
Expand Down Expand Up @@ -689,8 +689,8 @@ github.com/siderolabs/kms-client v0.1.0 h1:rCDWzcDDsNlp6zdyLngOuuhchVILn+vwUQy3t
github.com/siderolabs/kms-client v0.1.0/go.mod h1:4UQkRhuEh3kaK7VhJxez4YyJLv6lPEff7g3Pa6Y9okg=
github.com/siderolabs/net v0.4.0 h1:1bOgVay/ijPkJz4qct98nHsiB/ysLQU0KLoBC4qLm7I=
github.com/siderolabs/net v0.4.0/go.mod h1:/ibG+Hm9HU27agp5r9Q3eZicEfjquzNzQNux5uEk0kM=
github.com/siderolabs/protoenc v0.2.0 h1:QFxWIAo//12+/bm27GNYoK/TpQGTYsRrrZCu9jSghvU=
github.com/siderolabs/protoenc v0.2.0/go.mod h1:mu4gc6pJxhdJYpuloacKE4jsJojj87qDXwn8LUvs2bY=
github.com/siderolabs/protoenc v0.2.1 h1:BqxEmeWQeMpNP3R6WrPqDatX8sM/r4t97OP8mFmg6GA=
github.com/siderolabs/protoenc v0.2.1/go.mod h1:StTHxjet1g11GpNAWiATgc8K0HMKiFSEVVFOa/H0otc=
github.com/siderolabs/siderolink v0.3.2 h1:ULFHQAgxtVCU7Sd+GLP7bDSQBXrwTtppaI4TKl/YqZc=
github.com/siderolabs/siderolink v0.3.2/go.mod h1:juxlSF9cBzeBHsOjS7hVS3s0NDpC034i/OZunVReqmo=
github.com/siderolabs/tcpproxy v0.1.0 h1:IbkS9vRhjMOscc1US3M5P1RnsGKFgB6U5IzUk+4WkKA=
Expand Down
7 changes: 0 additions & 7 deletions internal/app/machined/pkg/controllers/config/acquire.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,6 @@ func (ctrl *AcquireController) loadFromDisk(logger *zap.Logger) (config.Provider
return nil, fmt.Errorf("failed to load config from STATE: %w", err)
}

// TODO: this is legacy flow with persistence, it should be deprecated & removed
if !cfg.Persist() {
logger.Info("config persistence is disabled, ignoring stored machine config")

return nil, nil
}

// if the STATE partition is present & contains machine config, Talos is already installed
warnings, err := cfg.Validate(validationModeDiskConfig{})
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/cluster/kubernetes/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ func patchNodeConfig(ctx context.Context, cluster UpgradeProvider, node string,
return fmt.Errorf("config is not v1alpha1 config")
}

if !cfg.Persist() {
return fmt.Errorf("config persistence is disabled, patching is not supported")
}

if err = patchFunc(cfg); err != nil {
return fmt.Errorf("error patching config: %w", err)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/machinery/config/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package config
// Config defines the interface to access contents of the machine configuration.
type Config interface {
Debug() bool
Persist() bool
Machine() MachineConfig
Cluster() ClusterConfig
SideroLink() SideroLinkConfig
Expand Down
9 changes: 0 additions & 9 deletions pkg/machinery/config/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,6 @@ func (container *Container) Debug() bool {
return container.v1alpha1Config.Debug()
}

// Persist implements config.Config interface.
func (container *Container) Persist() bool {
if container.v1alpha1Config == nil {
return true
}

return container.v1alpha1Config.Persist()
}

// Machine implements config.Config interface.
func (container *Container) Machine() config.MachineConfig {
if container.v1alpha1Config == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,8 @@
"persist": {
"type": "boolean",
"title": "persist",
"description": "description: |\n Indicates whether to pull the machine config upon every boot.\n\nNote: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no\n",
"markdownDescription": "description: |\n Indicates whether to pull the machine config upon every boot.\n\n **Note**: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no",
"x-intellij-html-description": "\u003cp\u003edescription: |\n Indicates whether to pull the machine config upon every boot.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote\u003c/strong\u003e: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no\u003c/p\u003e\n"
"markdownDescription": "",
"x-intellij-html-description": ""
},
"machine": {
"$ref": "#/$defs/MachineConfig",
Expand Down Expand Up @@ -1500,13 +1499,6 @@
"markdownDescription": "Allows for supplying additional system extension images to install on top of base Talos image.",
"x-intellij-html-description": "\u003cp\u003eAllows for supplying additional system extension images to install on top of base Talos image.\u003c/p\u003e\n"
},
"bootloader": {
"type": "boolean",
"title": "bootloader",
"description": "Indicates if a bootloader should be installed.\n",
"markdownDescription": "Indicates if a bootloader should be installed.",
"x-intellij-html-description": "\u003cp\u003eIndicates if a bootloader should be installed.\u003c/p\u003e\n"
},
"wipe": {
"type": "boolean",
"title": "wipe",
Expand Down
9 changes: 0 additions & 9 deletions pkg/machinery/config/types/v1alpha1/v1alpha1_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ func (c *Config) Debug() bool {
return pointer.SafeDeref(c.ConfigDebug)
}

// Persist implements the config.Provider interface.
func (c *Config) Persist() bool {
if c == nil {
return true
}

return pointer.SafeDeref(c.ConfigPersist)
}

// Machine implements the config.Provider interface.
func (c *Config) Machine() config.MachineConfig {
if c == nil || c.MachineConfig == nil {
Expand Down
20 changes: 4 additions & 16 deletions pkg/machinery/config/types/v1alpha1/v1alpha1_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@ type Config struct {
// - false
// - no
ConfigDebug *bool `yaml:"debug,omitempty"`
// description: |
// Indicates whether to pull the machine config upon every boot.
//
// **Note**: this option is deprecated and it will be removed in Talos 1.6.
// values:
// - true
// - yes
// - false
// - no
//docgen:nodoc
ConfigPersist *bool `yaml:"persist,omitempty"`
// description: |
// Provides machine specific configuration options.
Expand Down Expand Up @@ -775,13 +767,9 @@ type InstallConfig struct {
// examples:
// - value: installExtensionsExample()
InstallExtensions []InstallExtensionConfig `yaml:"extensions,omitempty"`
// description: |
// Indicates if a bootloader should be installed.
// values:
// - true
// - yes
// - false
// - no
// docgen:nodoc
//
// Deprecated: It never worked.
InstallBootloader *bool `yaml:"bootloader,omitempty"`
// description: |
// Indicates if the installation disk should be wiped at installation time.
Expand Down
18 changes: 3 additions & 15 deletions pkg/machinery/config/types/v1alpha1/v1alpha1_types_doc.go

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

43 changes: 9 additions & 34 deletions pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ func (c *Config) Validate(mode validation.RuntimeMode, options ...validation.Opt

extensions[ext.Image()] = struct{}{}
}

if len(extensions) > 0 {
warnings = append(warnings, ".machine.install.extensions is deprecated, please see https://www.talos.dev/latest/talos-guides/install/boot-assets/")
}
}

if err := labels.Validate(c.MachineConfig.MachineNodeLabels); err != nil {
Expand All @@ -298,6 +302,10 @@ func (c *Config) Validate(mode validation.RuntimeMode, options ...validation.Opt
}
}

if c.ConfigPersist != nil && !*c.ConfigPersist {
result = multierror.Append(result, fmt.Errorf(".persist should be enabled"))
}

if opts.Strict {
for _, w := range warnings {
result = multierror.Append(result, fmt.Errorf("warning: %s", w))
Expand All @@ -309,40 +317,7 @@ func (c *Config) Validate(mode validation.RuntimeMode, options ...validation.Opt
return warnings, result.ErrorOrNil()
}

// onceValue is a straight copy from Go 1.21, change to sync.OnceValue once upgraded to Go 1.21.
func onceValue[T any](f func() T) func() T {
var (
once sync.Once
valid bool
p any
result T
)

g := func() {
defer func() {
p = recover()

if !valid {
panic(p)
}
}()

result = f()
valid = true
}

return func() T {
once.Do(g)

if !valid {
panic(p)
}

return result
}
}

var rxDNSNameRegexp = onceValue(func() *regexp.Regexp {
var rxDNSNameRegexp = sync.OnceValue(func() *regexp.Regexp {
return regexp.MustCompile(`^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$`)
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,10 @@ func TestValidate(t *testing.T) {
},
},
requiresInstall: true,
expectedError: "1 error occurred:\n\t* duplicate system extension \"ghcr.io/siderolabs/gvisor:v0.1.0\"\n\n",
expectedWarnings: []string{
".machine.install.extensions is deprecated, please see https://www.talos.dev/latest/talos-guides/install/boot-assets/",
},
expectedError: "1 error occurred:\n\t* duplicate system extension \"ghcr.io/siderolabs/gvisor:v0.1.0\"\n\n",
},
{
name: "ExternalCloudProviderEnabled",
Expand Down
4 changes: 2 additions & 2 deletions pkg/machinery/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/siderolabs/go-blockdevice v0.4.6
github.com/siderolabs/go-pointer v1.0.0
github.com/siderolabs/net v0.4.0
github.com/siderolabs/protoenc v0.2.0
github.com/siderolabs/protoenc v0.2.1
github.com/stretchr/testify v1.8.4
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405
google.golang.org/grpc v1.59.0
Expand All @@ -41,7 +41,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gertd/go-pluralize v0.2.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/josharian/native v1.1.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions pkg/machinery/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/brianvoe/gofakeit/v6 v6.17.0 h1:obbQTJeHfktJtiZzq0Q1bEpsNUs+yHrYlPVWt7BtmJ4=
github.com/brianvoe/gofakeit/v6 v6.17.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/brianvoe/gofakeit/v6 v6.24.0 h1:74yq7RRz/noddscZHRS2T84oHZisW9muwbb8sRnU52A=
github.com/brianvoe/gofakeit/v6 v6.24.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
Expand Down Expand Up @@ -55,8 +55,8 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 h1:RtRsiaGvWxcwd8y3BiRZxsylPT8hLWZ5SPcfI+3IDNk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0/go.mod h1:TzP6duP4Py2pHLVPPQp42aoYI92+PCrVotyR5e8Vqlk=
Expand Down Expand Up @@ -122,8 +122,8 @@ github.com/siderolabs/go-retry v0.3.3 h1:zKV+S1vumtO72E6sYsLlmIdV/G/GcYSBLiEx/c9
github.com/siderolabs/go-retry v0.3.3/go.mod h1:Ff/VGc7v7un4uQg3DybgrmOWHEmJ8BzZds/XNn/BqMI=
github.com/siderolabs/net v0.4.0 h1:1bOgVay/ijPkJz4qct98nHsiB/ysLQU0KLoBC4qLm7I=
github.com/siderolabs/net v0.4.0/go.mod h1:/ibG+Hm9HU27agp5r9Q3eZicEfjquzNzQNux5uEk0kM=
github.com/siderolabs/protoenc v0.2.0 h1:QFxWIAo//12+/bm27GNYoK/TpQGTYsRrrZCu9jSghvU=
github.com/siderolabs/protoenc v0.2.0/go.mod h1:mu4gc6pJxhdJYpuloacKE4jsJojj87qDXwn8LUvs2bY=
github.com/siderolabs/protoenc v0.2.1 h1:BqxEmeWQeMpNP3R6WrPqDatX8sM/r4t97OP8mFmg6GA=
github.com/siderolabs/protoenc v0.2.1/go.mod h1:StTHxjet1g11GpNAWiATgc8K0HMKiFSEVVFOa/H0otc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
3 changes: 1 addition & 2 deletions website/content/v1.6/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cluster: # ...
|-------|------|-------------|----------|
|`version` |string |Indicates the schema used to decode the contents. |`v1alpha1`<br /> |
|`debug` |bool |<details><summary>Enable verbose logging to the console.</summary>All system containers logs will flow into serial console.<br /><br />**Note:** To avoid breaking Talos bootstrap flow enable this option only if serial console can handle high message throughput.</details> |`true`<br />`yes`<br />`false`<br />`no`<br /> |
|`persist` |bool |<details><summary>description: |</summary> Indicates whether to pull the machine config upon every boot.<br /><br /> **Note**: this option is deprecated and it will be removed in Talos 1.6.<br /> values:<br /> - true<br /> - yes<br /> - false<br /> - no<br /></details> | |
|`persist` |bool | | |
|`machine` |<a href="#machineconfig">MachineConfig</a> |Provides machine specific configuration options. | |
|`cluster` |<a href="#clusterconfig">ClusterConfig</a> |Provides cluster specific configuration options. | |

Expand Down Expand Up @@ -1221,7 +1221,6 @@ image: ghcr.io/siderolabs/installer:latest
extensions:
- image: ghcr.io/siderolabs/gvisor:20220117.0-v1.0.0 # System extension image.
{{< /highlight >}}</details> | |
|`bootloader` |bool |Indicates if a bootloader should be installed. |`true`<br />`yes`<br />`false`<br />`no`<br /> |
|`wipe` |bool |<details><summary>Indicates if the installation disk should be wiped at installation time.</summary>Defaults to `true`.</details> |`true`<br />`yes`<br />`false`<br />`no`<br /> |
|`legacyBIOSSupport` |bool |<details><summary>Indicates if MBR partition should be marked as bootable (active).</summary>Should be enabled only for the systems with legacy BIOS that doesn't support GPT partitioning scheme.</details> | |

Expand Down
12 changes: 2 additions & 10 deletions website/content/v1.6/schemas/v1alpha1_config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,8 @@
"persist": {
"type": "boolean",
"title": "persist",
"description": "description: |\n Indicates whether to pull the machine config upon every boot.\n\nNote: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no\n",
"markdownDescription": "description: |\n Indicates whether to pull the machine config upon every boot.\n\n **Note**: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no",
"x-intellij-html-description": "\u003cp\u003edescription: |\n Indicates whether to pull the machine config upon every boot.\u003c/p\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote\u003c/strong\u003e: this option is deprecated and it will be removed in Talos 1.6.\n values:\n - true\n - yes\n - false\n - no\u003c/p\u003e\n"
"markdownDescription": "",
"x-intellij-html-description": ""
},
"machine": {
"$ref": "#/$defs/MachineConfig",
Expand Down Expand Up @@ -1500,13 +1499,6 @@
"markdownDescription": "Allows for supplying additional system extension images to install on top of base Talos image.",
"x-intellij-html-description": "\u003cp\u003eAllows for supplying additional system extension images to install on top of base Talos image.\u003c/p\u003e\n"
},
"bootloader": {
"type": "boolean",
"title": "bootloader",
"description": "Indicates if a bootloader should be installed.\n",
"markdownDescription": "Indicates if a bootloader should be installed.",
"x-intellij-html-description": "\u003cp\u003eIndicates if a bootloader should be installed.\u003c/p\u003e\n"
},
"wipe": {
"type": "boolean",
"title": "wipe",
Expand Down

0 comments on commit 70d53ee

Please sign in to comment.