chore: revert: drop deprecated allowSchedulingOnMasters

This reverts commit 32c67c27c393c989f9d70ccb8506c4735f70d494.

Signed-off-by: Noel Georgi <git@frezbo.dev>
This commit is contained in:
Noel Georgi 2025-01-08 16:08:51 +05:30
parent 0abb3dabf6
commit fa5300d910
No known key found for this signature in database
GPG Key ID: 21A9F444075C9E36
6 changed files with 23 additions and 12 deletions

View File

@ -23,13 +23,6 @@ preface = """
Talos is built with Go 1.23.4.
"""
[notes.machineconfig]
title = "cluster.allowSchedulingOnMasters"
description = """\
The machine config field item `.cluster.allowSchedulingOnMasters` which has been deprecated since Talos 1.2 has now been removed.
Use the `.cluster.allowSchedulingOnControlPlanes` field instead.
"""
[notes.driver-rebind]
title = "Driver Rebind"
description = """\

View File

@ -190,8 +190,13 @@ func (in *Input) init() ([]config.Document, error) {
ClusterInlineManifests: v1alpha1.ClusterInlineManifests{},
}
if in.Options.AllowSchedulingOnControlPlanes && in.Options.VersionContract.KubernetesAllowSchedulingOnControlPlanes() {
if in.Options.AllowSchedulingOnControlPlanes {
if in.Options.VersionContract.KubernetesAllowSchedulingOnControlPlanes() {
cluster.AllowSchedulingOnControlPlanes = pointer.To(in.Options.AllowSchedulingOnControlPlanes)
} else {
// backwards compatibility for Talos versions older than 1.2
cluster.AllowSchedulingOnMasters = pointer.To(in.Options.AllowSchedulingOnControlPlanes) //nolint:staticcheck
}
}
if in.Options.DiscoveryEnabled != nil {

View File

@ -179,9 +179,13 @@ func (c *ClusterConfig) AdminKubeconfig() config.AdminKubeconfig {
// ScheduleOnControlPlanes implements the config.ClusterConfig interface.
func (c *ClusterConfig) ScheduleOnControlPlanes() bool {
if c.AllowSchedulingOnControlPlanes != nil {
return pointer.SafeDeref(c.AllowSchedulingOnControlPlanes)
}
return pointer.SafeDeref(c.AllowSchedulingOnMasters)
}
// ID returns the unique identifier for the cluster.
func (c *ClusterConfig) ID() string {
return c.ClusterID

View File

@ -520,6 +520,10 @@ type ClusterConfig struct {
// examples:
// - value: clusterAdminKubeconfigExample()
AdminKubeconfigConfig *AdminKubeconfigConfig `yaml:"adminKubeconfig,omitempty"`
// docgen:nodoc
//
// Deprecated: Use `AllowSchedulingOnControlPlanes` instead.
AllowSchedulingOnMasters *bool `yaml:"allowSchedulingOnMasters,omitempty"`
// description: |
// Allows running workload on control-plane nodes.
// values:

View File

@ -527,6 +527,7 @@ func (ClusterConfig) Doc() *encoder.Doc {
Description: "Settings for admin kubeconfig generation.\nCertificate lifetime can be configured.",
Comments: [3]string{"" /* encoder.HeadComment */, "Settings for admin kubeconfig generation." /* encoder.LineComment */, "" /* encoder.FootComment */},
},
{},
{
Name: "allowSchedulingOnControlPlanes",
Type: "bool",
@ -571,7 +572,7 @@ func (ClusterConfig) Doc() *encoder.Doc {
})
doc.Fields[22].AddExample("", clusterInlineManifestsExample())
doc.Fields[23].AddExample("", clusterAdminKubeconfigExample())
doc.Fields[24].AddExample("", true)
doc.Fields[25].AddExample("", true)
return doc
}

View File

@ -341,7 +341,11 @@ func (in *ClusterConfig) DeepCopyInto(out *ClusterConfig) {
*out = new(AdminKubeconfigConfig)
**out = **in
}
if in.AllowSchedulingOnMasters != nil {
in, out := &in.AllowSchedulingOnMasters, &out.AllowSchedulingOnMasters
*out = new(bool)
**out = **in
}
if in.AllowSchedulingOnControlPlanes != nil {
in, out := &in.AllowSchedulingOnControlPlanes, &out.AllowSchedulingOnControlPlanes
*out = new(bool)