diff --git a/docs/server/docs.go b/docs/server/docs.go index 8064f0c60f..64f860b533 100644 --- a/docs/server/docs.go +++ b/docs/server/docs.go @@ -1120,10 +1120,6 @@ const docTemplate = `{ "backend_replicas": { "description": "BackendReplicas is the desired StatefulSet replica count for the proxy runner backend.\nWhen nil, replicas are unmanaged (preserving HPA or manual kubectl control).\nWhen set (including 0), the value is an explicit replica count.", "type": "integer" - }, - "session_cache_size": { - "description": "SessionCacheSize is the maximum number of sessions held in the local LRU cache.\nWhen nil, consuming code applies a sensible default (e.g. 1000).", - "type": "integer" } }, "type": "object" diff --git a/docs/server/swagger.json b/docs/server/swagger.json index 5d088cafa1..7a81946cfc 100644 --- a/docs/server/swagger.json +++ b/docs/server/swagger.json @@ -1113,10 +1113,6 @@ "backend_replicas": { "description": "BackendReplicas is the desired StatefulSet replica count for the proxy runner backend.\nWhen nil, replicas are unmanaged (preserving HPA or manual kubectl control).\nWhen set (including 0), the value is an explicit replica count.", "type": "integer" - }, - "session_cache_size": { - "description": "SessionCacheSize is the maximum number of sessions held in the local LRU cache.\nWhen nil, consuming code applies a sensible default (e.g. 1000).", - "type": "integer" } }, "type": "object" diff --git a/docs/server/swagger.yaml b/docs/server/swagger.yaml index 06e62c5642..b70c19a174 100644 --- a/docs/server/swagger.yaml +++ b/docs/server/swagger.yaml @@ -1063,11 +1063,6 @@ components: When nil, replicas are unmanaged (preserving HPA or manual kubectl control). When set (including 0), the value is an explicit replica count. type: integer - session_cache_size: - description: |- - SessionCacheSize is the maximum number of sessions held in the local LRU cache. - When nil, consuming code applies a sensible default (e.g. 1000). - type: integer type: object github_com_stacklok_toolhive_pkg_runner.ToolOverride: properties: diff --git a/pkg/runner/config.go b/pkg/runner/config.go index 8eb1c397a8..f0f14a30e0 100644 --- a/pkg/runner/config.go +++ b/pkg/runner/config.go @@ -226,10 +226,6 @@ type ScalingConfig struct { // When nil, replicas are unmanaged (preserving HPA or manual kubectl control). // When set (including 0), the value is an explicit replica count. BackendReplicas *int32 `json:"backend_replicas,omitempty" yaml:"backend_replicas,omitempty"` - - // SessionCacheSize is the maximum number of sessions held in the local LRU cache. - // When nil, consuming code applies a sensible default (e.g. 1000). - SessionCacheSize *int32 `json:"session_cache_size,omitempty" yaml:"session_cache_size,omitempty"` } // WriteJSON serializes the RunConfig to JSON and writes it to the provided writer diff --git a/pkg/runner/config_test.go b/pkg/runner/config_test.go index f52b4058cf..e88293a0d0 100644 --- a/pkg/runner/config_test.go +++ b/pkg/runner/config_test.go @@ -2242,19 +2242,18 @@ func TestRunConfig_WriteJSON_ReadJSON_EmbeddedAuthServer(t *testing.T) { }) } -func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { +func TestRunConfig_BackendReplicas(t *testing.T) { t.Parallel() const testServerName = "srv" int32ptr := func(v int32) *int32 { return &v } - t.Run("round-trip with both fields set", func(t *testing.T) { + t.Run("round-trip with backend_replicas set", func(t *testing.T) { t.Parallel() original := NewRunConfig() original.Name = "test-server" original.ScalingConfig = &ScalingConfig{ - BackendReplicas: int32ptr(3), - SessionCacheSize: int32ptr(500), + BackendReplicas: int32ptr(3), } var buf bytes.Buffer @@ -2265,8 +2264,6 @@ func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { require.NotNil(t, got.ScalingConfig) require.NotNil(t, got.ScalingConfig.BackendReplicas) assert.Equal(t, int32(3), *got.ScalingConfig.BackendReplicas) - require.NotNil(t, got.ScalingConfig.SessionCacheSize) - assert.Equal(t, int32(500), *got.ScalingConfig.SessionCacheSize) }) t.Run("round-trip without scaling config preserves nil", func(t *testing.T) { @@ -2289,7 +2286,6 @@ func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { require.NoError(t, cfg.WriteJSON(&buf)) assert.NotContains(t, buf.String(), "scaling_config") assert.NotContains(t, buf.String(), "backend_replicas") - assert.NotContains(t, buf.String(), "session_cache_size") }) t.Run("explicit backend_replicas 2 in JSON deserializes to pointer with value 2", func(t *testing.T) { @@ -2304,7 +2300,6 @@ func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { require.NotNil(t, got.ScalingConfig) require.NotNil(t, got.ScalingConfig.BackendReplicas, "BackendReplicas should be non-nil when present in JSON") assert.Equal(t, int32(2), *got.ScalingConfig.BackendReplicas) - assert.Nil(t, got.ScalingConfig.SessionCacheSize, "SessionCacheSize should be nil when omitted from JSON") }) t.Run("backend_replicas 0 in JSON deserializes to pointer-to-zero, not nil", func(t *testing.T) { @@ -2323,30 +2318,12 @@ func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { assert.Equal(t, int32(0), *got.ScalingConfig.BackendReplicas) }) - t.Run("session_cache_size 0 in JSON deserializes to pointer-to-zero, not nil", func(t *testing.T) { - t.Parallel() - // omitempty only omits when the pointer is nil; pointer-to-zero is a meaningful - // "set to 0" and must survive a round-trip. - cfg := NewRunConfig() - cfg.Name = testServerName - cfg.ScalingConfig = &ScalingConfig{SessionCacheSize: int32ptr(0)} - var buf bytes.Buffer - require.NoError(t, cfg.WriteJSON(&buf)) - got, err := ReadJSON(&buf) - require.NoError(t, err) - require.NotNil(t, got.ScalingConfig) - require.NotNil(t, got.ScalingConfig.SessionCacheSize, "SessionCacheSize should be non-nil when explicitly set to 0 in JSON") - assert.Equal(t, int32(0), *got.ScalingConfig.SessionCacheSize) - assert.Nil(t, got.ScalingConfig.BackendReplicas, "BackendReplicas should be nil when omitted from JSON") - }) - - t.Run("YAML round-trip with both fields set", func(t *testing.T) { + t.Run("YAML round-trip with backend_replicas set", func(t *testing.T) { t.Parallel() original := NewRunConfig() original.Name = "yaml-server" original.ScalingConfig = &ScalingConfig{ - BackendReplicas: int32ptr(5), - SessionCacheSize: int32ptr(250), + BackendReplicas: int32ptr(5), } data, err := yaml.Marshal(original) @@ -2357,7 +2334,5 @@ func TestRunConfig_BackendReplicasAndSessionCacheSize(t *testing.T) { require.NotNil(t, got.ScalingConfig) require.NotNil(t, got.ScalingConfig.BackendReplicas) assert.Equal(t, int32(5), *got.ScalingConfig.BackendReplicas) - require.NotNil(t, got.ScalingConfig.SessionCacheSize) - assert.Equal(t, int32(250), *got.ScalingConfig.SessionCacheSize) }) }