Skip to content
Open
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
16 changes: 8 additions & 8 deletions cmd/epp/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import (
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/requestcontrol"
testresponsereceived "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/requestcontrol/plugins/test/responsereceived"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/multi/prefix"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/multi/slo_aware_router"
Expand Down Expand Up @@ -330,7 +330,7 @@ func (r *Runner) Run(ctx context.Context) error {

scheduler := scheduling.NewSchedulerWithConfig(r.schedulerConfig)

saturationDetector := saturationdetector.NewDetector(eppConfig.SaturationDetectorConfig, setupLog)
saturationDetector := staticthresholdcontroller.NewDetector(eppConfig.SaturationDetectorConfig, setupLog)

// --- Admission Control Initialization ---
var admissionController requestcontrol.AdmissionController
Expand Down Expand Up @@ -556,23 +556,23 @@ func (r *Runner) deprecatedConfigurationHelper(cfg *config.Config, logger logr.L
if _, ok := os.LookupEnv(EnvSdQueueDepthThreshold); ok {
logger.Info("Configuring Saturation Detector using environment variables is deprecated and will be removed in next version")
cfg.SaturationDetectorConfig.QueueDepthThreshold =
env.GetEnvInt(EnvSdQueueDepthThreshold, saturationdetector.DefaultQueueDepthThreshold, logger)
env.GetEnvInt(EnvSdQueueDepthThreshold, staticthresholdcontroller.DefaultQueueDepthThreshold, logger)
if cfg.SaturationDetectorConfig.QueueDepthThreshold <= 0 {
cfg.SaturationDetectorConfig.QueueDepthThreshold = saturationdetector.DefaultQueueDepthThreshold
cfg.SaturationDetectorConfig.QueueDepthThreshold = staticthresholdcontroller.DefaultQueueDepthThreshold
}
}
if _, ok := os.LookupEnv(EnvSdKVCacheUtilThreshold); ok {
logger.Info("Configuring Saturation Detector using environment variables is deprecated and will be removed in next version")
cfg.SaturationDetectorConfig.KVCacheUtilThreshold = env.GetEnvFloat(EnvSdKVCacheUtilThreshold, saturationdetector.DefaultKVCacheUtilThreshold, logger)
cfg.SaturationDetectorConfig.KVCacheUtilThreshold = env.GetEnvFloat(EnvSdKVCacheUtilThreshold, staticthresholdcontroller.DefaultKVCacheUtilThreshold, logger)
if cfg.SaturationDetectorConfig.KVCacheUtilThreshold <= 0 || cfg.SaturationDetectorConfig.KVCacheUtilThreshold >= 1 {
cfg.SaturationDetectorConfig.KVCacheUtilThreshold = saturationdetector.DefaultKVCacheUtilThreshold
cfg.SaturationDetectorConfig.KVCacheUtilThreshold = staticthresholdcontroller.DefaultKVCacheUtilThreshold
}
}
if _, ok := os.LookupEnv(EnvSdMetricsStalenessThreshold); ok {
logger.Info("Configuring Saturation Detector using environment variables is deprecated and will be removed in next version")
cfg.SaturationDetectorConfig.MetricsStalenessThreshold = env.GetEnvDuration(EnvSdMetricsStalenessThreshold, saturationdetector.DefaultMetricsStalenessThreshold, logger)
cfg.SaturationDetectorConfig.MetricsStalenessThreshold = env.GetEnvDuration(EnvSdMetricsStalenessThreshold, staticthresholdcontroller.DefaultMetricsStalenessThreshold, logger)
if cfg.SaturationDetectorConfig.MetricsStalenessThreshold <= 0 {
cfg.SaturationDetectorConfig.MetricsStalenessThreshold = saturationdetector.DefaultMetricsStalenessThreshold
cfg.SaturationDetectorConfig.MetricsStalenessThreshold = staticthresholdcontroller.DefaultMetricsStalenessThreshold
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/epp/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ limitations under the License.
package config

import (
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
)

// Config is the configuration loaded from the text based configuration
type Config struct {
SchedulerConfig *scheduling.SchedulerConfig
SaturationDetectorConfig *saturationdetector.Config
SaturationDetectorConfig *staticthresholdcontroller.Config
}
12 changes: 6 additions & 6 deletions pkg/epp/config/loader/configloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
configapi "sigs.k8s.io/gateway-api-inference-extension/apix/config/v1alpha1"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/config"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/profile"
Expand Down Expand Up @@ -203,11 +203,11 @@ func loadFeatureConfig(gates configapi.FeatureGates) map[string]bool {
return config
}

func buildSaturationConfig(apiConfig *configapi.SaturationDetector) *saturationdetector.Config {
cfg := &saturationdetector.Config{
QueueDepthThreshold: saturationdetector.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: saturationdetector.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: saturationdetector.DefaultMetricsStalenessThreshold,
func buildSaturationConfig(apiConfig *configapi.SaturationDetector) *staticthresholdcontroller.Config {
cfg := &staticthresholdcontroller.Config{
QueueDepthThreshold: staticthresholdcontroller.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: staticthresholdcontroller.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: staticthresholdcontroller.DefaultMetricsStalenessThreshold,
}

if apiConfig != nil {
Expand Down
22 changes: 11 additions & 11 deletions pkg/epp/config/loader/configloader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
configapi "sigs.k8s.io/gateway-api-inference-extension/apix/config/v1alpha1"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/picker"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/profile"
Expand Down Expand Up @@ -321,7 +321,7 @@ func TestBuildSaturationConfig(t *testing.T) {
tests := []struct {
name string
input *configapi.SaturationDetector
expected *saturationdetector.Config
expected *staticthresholdcontroller.Config
}{
{
name: "Valid Configuration",
Expand All @@ -330,7 +330,7 @@ func TestBuildSaturationConfig(t *testing.T) {
KVCacheUtilThreshold: 0.9,
MetricsStalenessThreshold: metav1.Duration{Duration: 500 * time.Millisecond},
},
expected: &saturationdetector.Config{
expected: &staticthresholdcontroller.Config{
QueueDepthThreshold: 20,
KVCacheUtilThreshold: 0.9,
MetricsStalenessThreshold: 500 * time.Millisecond,
Expand All @@ -339,10 +339,10 @@ func TestBuildSaturationConfig(t *testing.T) {
{
name: "Nil Input (Defaults)",
input: nil,
expected: &saturationdetector.Config{
QueueDepthThreshold: saturationdetector.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: saturationdetector.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: saturationdetector.DefaultMetricsStalenessThreshold,
expected: &staticthresholdcontroller.Config{
QueueDepthThreshold: staticthresholdcontroller.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: staticthresholdcontroller.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: staticthresholdcontroller.DefaultMetricsStalenessThreshold,
},
},
{
Expand All @@ -352,10 +352,10 @@ func TestBuildSaturationConfig(t *testing.T) {
KVCacheUtilThreshold: 1.5,
MetricsStalenessThreshold: metav1.Duration{Duration: -10 * time.Second},
},
expected: &saturationdetector.Config{
QueueDepthThreshold: saturationdetector.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: saturationdetector.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: saturationdetector.DefaultMetricsStalenessThreshold,
expected: &staticthresholdcontroller.Config{
QueueDepthThreshold: staticthresholdcontroller.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: staticthresholdcontroller.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: staticthresholdcontroller.DefaultMetricsStalenessThreshold,
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package saturationdetector

package staticthresholdcontroller

import (
"time"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.
// - Predictive saturation based on trends.
// - Hysteresis bands or other smoothing techniques to prevent rapid
// oscillations of the saturation signal.
package saturationdetector
package staticthresholdcontroller

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package saturationdetector
package staticthresholdcontroller

import (
"context"
Expand Down
4 changes: 2 additions & 2 deletions pkg/epp/server/runserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datastore"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/handlers"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/requestcontrol"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
)

// ExtProcServerRunner provides methods to manage an external process server.
Expand All @@ -58,7 +58,7 @@ type ExtProcServerRunner struct {
RefreshPrometheusMetricsInterval time.Duration
MetricsStalenessThreshold time.Duration
Director *requestcontrol.Director
SaturationDetector *saturationdetector.Detector
SaturationDetector *staticthresholdcontroller.Detector
UseExperimentalDatalayerV2 bool // Pluggable data layer feature flag

// This should only be used in tests. We won't need this once we do not inject metrics in the tests.
Expand Down
12 changes: 6 additions & 6 deletions test/integration/epp/hermetic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import (
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metadata"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metrics"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/requestcontrol"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationdetector"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/saturationcontrol/framework/plugins/staticthresholdcontroller"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/framework/plugins/multi/prefix"
Expand Down Expand Up @@ -1233,12 +1233,12 @@ func BeforeSuite() func() {
schedulerConfig := scheduling.NewSchedulerConfig(profileHandler, map[string]*framework.SchedulerProfile{"default": defaultProfile})
scheduler := scheduling.NewSchedulerWithConfig(schedulerConfig)

sdConfig := &saturationdetector.Config{
QueueDepthThreshold: saturationdetector.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: saturationdetector.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: saturationdetector.DefaultMetricsStalenessThreshold,
sdConfig := &staticthresholdcontroller.Config{
QueueDepthThreshold: staticthresholdcontroller.DefaultQueueDepthThreshold,
KVCacheUtilThreshold: staticthresholdcontroller.DefaultKVCacheUtilThreshold,
MetricsStalenessThreshold: staticthresholdcontroller.DefaultMetricsStalenessThreshold,
}
detector := saturationdetector.NewDetector(sdConfig, logger.WithName("saturation-detector"))
detector := staticthresholdcontroller.NewDetector(sdConfig, logger.WithName("saturation-detector"))
serverRunner.SaturationDetector = detector
locator := requestcontrol.NewDatastorePodLocator(serverRunner.Datastore)
admissionController := requestcontrol.NewLegacyAdmissionController(detector, locator)
Expand Down