Skip to content

Commit 84dcf99

Browse files
committed
refactor(engine): drop dead Insecure field from Options
The field has been declared on engine.Options since the file was created (c567135, 2024-05) but was never read by Render or any helper. apply.go and template.go were assigning it from their respective --insecure flags; apply_test.go asserted the assignment. Nothing else looked at the value. The runtime guarantee — --insecure (maintenance mode) bypasses FailIfMultiNodes — is provided by WithClientMaintenance not injecting nodes into the gRPC context, not by anything inside engine.Render. The dead field added nothing on top of that. Drop the field, the assignments, and the assertion. golangci-lint is clean. Closes #123 Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
1 parent 00358fd commit 84dcf99

4 files changed

Lines changed: 0 additions & 9 deletions

File tree

pkg/commands/apply.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ func withApplyClient(f func(ctx context.Context, c *client.Client) error) error
214214
func buildApplyRenderOptions(modelineTemplates []string, withSecretsPath string) engine.Options {
215215
resolvedTemplates := resolveTemplatePaths(modelineTemplates, Config.RootDir)
216216
return engine.Options{
217-
Insecure: applyCmdFlags.insecure,
218217
TalosVersion: applyCmdFlags.talosVersion,
219218
WithSecrets: withSecretsPath,
220219
KubernetesVersion: applyCmdFlags.kubernetesVersion,

pkg/commands/apply_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,17 @@ func TestBuildApplyRenderOptions(t *testing.T) {
1515
origTalosVersion := applyCmdFlags.talosVersion
1616
origKubeVersion := applyCmdFlags.kubernetesVersion
1717
origDebug := applyCmdFlags.debug
18-
origInsecure := applyCmdFlags.insecure
1918
origRootDir := Config.RootDir
2019
defer func() {
2120
applyCmdFlags.talosVersion = origTalosVersion
2221
applyCmdFlags.kubernetesVersion = origKubeVersion
2322
applyCmdFlags.debug = origDebug
24-
applyCmdFlags.insecure = origInsecure
2523
Config.RootDir = origRootDir
2624
}()
2725

2826
applyCmdFlags.talosVersion = "v1.12"
2927
applyCmdFlags.kubernetesVersion = "1.31.0"
3028
applyCmdFlags.debug = false
31-
applyCmdFlags.insecure = true
3229
Config.RootDir = "/project"
3330

3431
opts := buildApplyRenderOptions(
@@ -42,9 +39,6 @@ func TestBuildApplyRenderOptions(t *testing.T) {
4239
if opts.Offline {
4340
t.Error("expected Offline=false for online template rendering path")
4441
}
45-
if !opts.Insecure {
46-
t.Error("expected Insecure=true to be passed through from flags")
47-
}
4842
if opts.Root != "/project" {
4943
t.Errorf("expected Root=/project, got %s", opts.Root)
5044
}

pkg/commands/template.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ func generateOutput(ctx context.Context, c *client.Client, args []string) (strin
274274
}
275275

276276
opts := engine.Options{
277-
Insecure: templateCmdFlags.insecure,
278277
ValueFiles: templateCmdFlags.valueFiles,
279278
StringValues: templateCmdFlags.stringValues,
280279
Values: templateCmdFlags.values,

pkg/engine/engine.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import (
4040

4141
// Options encapsulates all parameters necessary for rendering.
4242
type Options struct {
43-
Insecure bool
4443
ValueFiles []string
4544
StringValues []string
4645
Values []string

0 commit comments

Comments
 (0)