Skip to content

Commit d2cf021

Browse files
committed
chore: remove deprecated "join" term
Closes #3910. Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@talos-systems.com>
1 parent 0e18e28 commit d2cf021

File tree

9 files changed

+11
-60
lines changed

9 files changed

+11
-60
lines changed

cmd/talosctl/cmd/mgmt/cluster/create.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ var (
108108
configPatch string
109109
configPatchControlPlane string
110110
configPatchWorker string
111-
configPatchJoin string
112111
badRTC bool
113112
)
114113

@@ -125,14 +124,6 @@ var createCmd = &cobra.Command{
125124

126125
//nolint:gocyclo,cyclop
127126
func create(ctx context.Context) (err error) {
128-
if configPatchJoin != "" {
129-
if configPatchWorker != "" {
130-
return fmt.Errorf("both --config-patch-join and --config-patch-worker are passed")
131-
}
132-
133-
configPatchWorker = configPatchJoin
134-
}
135-
136127
if masters < 1 {
137128
return fmt.Errorf("number of masters can't be less than 1")
138129
}
@@ -845,9 +836,5 @@ func init() {
845836
createCmd.Flags().StringVar(&configPatchWorker, "config-patch-worker", "", "patch generated machineconfigs (applied to 'worker' type)")
846837
createCmd.Flags().BoolVar(&badRTC, "bad-rtc", false, "launch VM with bad RTC state (QEMU only)")
847838

848-
// remove in 0.13: https://github.com/talos-systems/talos/issues/3910
849-
createCmd.Flags().StringVar(&configPatchJoin, "config-patch-join", "", "")
850-
cli.Should(createCmd.Flags().MarkDeprecated("config-patch-join", "use --config-patch-worker instead"))
851-
852839
Cmd.AddCommand(createCmd)
853840
}

cmd/talosctl/cmd/mgmt/config.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919

2020
"github.com/talos-systems/talos/cmd/talosctl/cmd/mgmt/gen"
2121
"github.com/talos-systems/talos/cmd/talosctl/pkg/mgmt/helpers"
22-
"github.com/talos-systems/talos/pkg/cli"
2322
"github.com/talos-systems/talos/pkg/images"
2423
"github.com/talos-systems/talos/pkg/machinery/config"
2524
"github.com/talos-systems/talos/pkg/machinery/config/encoder"
@@ -42,7 +41,6 @@ var genConfigCmdFlags struct {
4241
configPatch string
4342
configPatchControlPlane string
4443
configPatchWorker string
45-
configPatchJoin string
4644
registryMirrors []string
4745
persistConfig bool
4846
withExamples bool
@@ -59,14 +57,6 @@ this is the port that the API server binds to on every control plane node. For a
5957
setup, usually involving a load balancer, use the IP and port of the load balancer.`,
6058
Args: cobra.ExactArgs(2),
6159
RunE: func(cmd *cobra.Command, args []string) error {
62-
if genConfigCmdFlags.configPatchJoin != "" {
63-
if genConfigCmdFlags.configPatchWorker != "" {
64-
return fmt.Errorf("both --config-patch-join and --config-patch-worker are passed")
65-
}
66-
67-
genConfigCmdFlags.configPatchWorker = genConfigCmdFlags.configPatchJoin
68-
}
69-
7060
// Validate url input to ensure it has https:// scheme before we attempt to gen
7161
u, err := url.Parse(args[1])
7262
if err != nil {
@@ -284,9 +274,5 @@ func init() {
284274
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.withExamples, "with-examples", "", true, "renders all machine configs with the commented examples")
285275
genConfigCmd.Flags().BoolVarP(&genConfigCmdFlags.withDocs, "with-docs", "", true, "renders all machine configs adding the documentation for each field")
286276

287-
// remove in 0.13: https://github.com/talos-systems/talos/issues/3910
288-
genConfigCmd.Flags().StringVar(&genConfigCmdFlags.configPatchJoin, "config-patch-join", "", "")
289-
cli.Should(genConfigCmd.Flags().MarkDeprecated("config-patch-join", "use --config-patch-worker instead"))
290-
291277
gen.Cmd.AddCommand(genConfigCmd)
292278
}

pkg/machinery/config/bundle.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,5 @@ type ProviderBundle interface {
1414
Init() Provider
1515
ControlPlane() Provider
1616
Worker() Provider
17-
// Deprecated: use Worker instead; this method will be removed in 0.13
18-
// (https://github.com/talos-systems/talos/issues/3910).
19-
Join() Provider
2017
TalosConfig() *clientconfig.Config
2118
}

pkg/machinery/config/types/v1alpha1/bundle/bundle.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,15 @@ func NewConfigBundle(opts ...Option) (*v1alpha1.ConfigBundle, error) {
5050
return bundle, err
5151
}
5252

53-
switch configType { //nolint:exhaustive
53+
switch configType {
5454
case machine.TypeInit:
5555
bundle.InitCfg = unmarshalledConfig
5656
case machine.TypeControlPlane:
5757
bundle.ControlPlaneCfg = unmarshalledConfig
5858
case machine.TypeWorker:
5959
bundle.WorkerCfg = unmarshalledConfig
60+
case machine.TypeUnknown:
61+
fallthrough
6062
default:
6163
panic("unreachable")
6264
}
@@ -116,13 +118,15 @@ func NewConfigBundle(opts ...Option) (*v1alpha1.ConfigBundle, error) {
116118
return bundle, err
117119
}
118120

119-
switch configType { //nolint:exhaustive
121+
switch configType {
120122
case machine.TypeInit:
121123
bundle.InitCfg = generatedConfig
122124
case machine.TypeControlPlane:
123125
bundle.ControlPlaneCfg = generatedConfig
124126
case machine.TypeWorker:
125127
bundle.WorkerCfg = generatedConfig
128+
case machine.TypeUnknown:
129+
fallthrough
126130
default:
127131
panic("unreachable")
128132
}

pkg/machinery/config/types/v1alpha1/bundle/options.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,3 @@ func WithJSONPatchWorker(patch jsonpatch.Patch) Option {
9292
return nil
9393
}
9494
}
95-
96-
// WithJSONPatchJoin is WithJSONPatchWorker.
97-
//
98-
// Deprecated: use WithJSONPatchWorker instead; this function will be removed in 0.13
99-
// (https://github.com/talos-systems/talos/issues/3910).
100-
func WithJSONPatchJoin(patch jsonpatch.Patch) Option {
101-
return func(o *Options) error {
102-
o.JSONPatchWorker = append(o.JSONPatchWorker, patch...)
103-
104-
return nil
105-
}
106-
}

pkg/machinery/config/types/v1alpha1/machine/machine.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ const (
2828
// TypeWorker designates the node as a worker node.
2929
// This means it will be an available compute node for scheduling workloads.
3030
TypeWorker // worker
31-
32-
// TypeJoin is the same as TypeWorker.
33-
//
34-
// Deprecated: use TypeWorker instead; this constant will be removed in 0.13
35-
// (https://github.com/talos-systems/talos/issues/3910).
36-
TypeJoin = TypeWorker
3731
)
3832

3933
// ParseType parses string constant as Type.

pkg/machinery/config/types/v1alpha1/machine/machine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestParseType(t *testing.T) {
2424
assert.EqualValues(t, machineapi.MachineConfig_TYPE_INIT, machine.TypeInit)
2525
assert.EqualValues(t, machineapi.MachineConfig_TYPE_CONTROL_PLANE, machine.TypeControlPlane)
2626
assert.EqualValues(t, machineapi.MachineConfig_TYPE_WORKER, machine.TypeWorker)
27-
assert.EqualValues(t, machineapi.MachineConfig_TYPE_JOIN, machine.TypeJoin) //nolint:staticcheck
27+
assert.EqualValues(t, machineapi.MachineConfig_TYPE_JOIN, machine.TypeWorker) //nolint:staticcheck
2828
})
2929

3030
validTests := []struct {

pkg/machinery/config/types/v1alpha1/v1alpha1_configurator_bundle.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ func (c *ConfigBundle) Worker() config.Provider {
4545
return c.WorkerCfg
4646
}
4747

48-
// Join implements the ProviderBundle interface.
49-
//
50-
// Deprecated: use Worker instead; this method will be removed in 0.13
51-
// (https://github.com/talos-systems/talos/issues/3910).
52-
func (c *ConfigBundle) Join() config.Provider {
53-
return c.WorkerCfg
54-
}
55-
5648
// TalosConfig implements the ProviderBundle interface.
5749
func (c *ConfigBundle) TalosConfig() *clientconfig.Config {
5850
return c.TalosCfg

pkg/machinery/config/types/v1alpha1/v1alpha1_validation.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (c *Config) Validate(mode config.RuntimeMode, options ...config.ValidationO
105105
warnings = append(warnings, fmt.Sprintf("use %q instead of %q for machine type", t.String(), c.MachineConfig.MachineType))
106106
}
107107

108-
switch c.Machine().Type() { //nolint:exhaustive
108+
switch c.Machine().Type() {
109109
case machine.TypeInit, machine.TypeControlPlane:
110110
warn, err := ValidateCNI(c.Cluster().Network().CNI())
111111
warnings = append(warnings, warn...)
@@ -118,6 +118,9 @@ func (c *Config) Validate(mode config.RuntimeMode, options ...config.ValidationO
118118
}
119119
}
120120

121+
case machine.TypeUnknown:
122+
fallthrough
123+
121124
default:
122125
result = multierror.Append(result, fmt.Errorf("unknown machine type %q", c.MachineConfig.MachineType))
123126
}

0 commit comments

Comments
 (0)