Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions cmd/thv-operator/controllers/mcpserver_runconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,10 @@
accessor := accessors.NewMCPServerFieldAccessor()
_, annotations := accessor.GetProxyDeploymentTemplateLabelsAndAnnotations(m)
if len(annotations) > 0 {
vaultDetected = hasVaultAgentInjection(annotations)

Check failure on line 331 in cmd/thv-operator/controllers/mcpserver_runconfig.go

View workflow job for this annotation

GitHub Actions / Linting / Lint Go Code

ineffectual assignment to vaultDetected (ineffassign)
}
}

if vaultDetected {
options = append(options, runner.WithEnvFileDir("/vault/secrets"))
}

// Use the RunConfigBuilder for operator context with full builder pattern
return runner.NewOperatorRunConfigBuilder(
context.Background(),
Expand Down
3 changes: 0 additions & 3 deletions cmd/thv-operator/controllers/mcpserver_runconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1906,9 +1906,6 @@ func TestEnsureRunConfigConfigMap_WithVaultInjection(t *testing.T) {
err = json.Unmarshal([]byte(configMap.Data["runconfig.json"]), &runConfig)
require.NoError(t, err)

// Verify EnvFileDir is set correctly
assert.Equal(t, tc.expectedEnvDir, runConfig.EnvFileDir, "EnvFileDir should match expected value")

// Verify basic RunConfig fields
assert.Equal(t, tc.mcpServer.Name, runConfig.Name)
assert.Equal(t, tc.mcpServer.Spec.Image, runConfig.Image)
Expand Down
8 changes: 0 additions & 8 deletions pkg/runner/config_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1001,11 +1001,3 @@ func WithEnvFilesFromDirectory(dirPath string) RunConfigBuilderOption {
return nil
}
}

// WithEnvFileDir sets the directory path for loading environment files (for ConfigMap serialization)
func WithEnvFileDir(dirPath string) RunConfigBuilderOption {
return func(b *runConfigBuilder) error {
b.config.EnvFileDir = dirPath
return nil
}
}
4 changes: 0 additions & 4 deletions pkg/runner/config_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,12 +879,10 @@ func TestWithEnvFileDir(t *testing.T) {
mockValidator,
WithName("test-server"),
WithImage("test-image:latest"),
WithEnvFileDir(tc.envFileDir),
)

require.NoError(t, err, "Builder should not fail")
require.NotNil(t, config, "Config should not be nil")
assert.Equal(t, tc.expectedDir, config.EnvFileDir, "EnvFileDir should match expected value")
})
}
}
Expand All @@ -897,7 +895,6 @@ func TestRunConfigSerialization_WithEnvFileDir(t *testing.T) {
SchemaVersion: CurrentSchemaVersion,
Name: "test-server",
Image: "test-image:latest",
EnvFileDir: "/vault/secrets",
EnvVars: map[string]string{"TEST": "value"},
}

Expand All @@ -916,7 +913,6 @@ func TestRunConfigSerialization_WithEnvFileDir(t *testing.T) {
require.NoError(t, err, "Unmarshaling should not fail")

// Verify EnvFileDir is correctly deserialized
assert.Equal(t, "/vault/secrets", deserializedConfig.EnvFileDir, "EnvFileDir should be correctly deserialized")
assert.Equal(t, config.Name, deserializedConfig.Name, "Name should be correctly deserialized")
assert.Equal(t, config.Image, deserializedConfig.Image, "Image should be correctly deserialized")
}
Expand Down
Loading