Skip to content

Commit c8e531c

Browse files
Merge pull request #2 from dumb0002/disable-scaletozero
Add Flag to Enable/Disable Scale to Zero
2 parents 941dcbc + 14a4339 commit c8e531c

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

cmd/activator/runner/runner.go

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ import (
4747
)
4848

4949
var (
50-
grpcPort = flag.Int("grpc-port", runserver.DefaultGrpcPort, "The gRPC port used for communicating with Envoy proxy")
51-
grpcHealthPort = flag.Int("grpc-health-port", runserver.DefaultGrpcHealthPort, "The port used for gRPC liveness and readiness probes")
52-
metricsPort = flag.Int("metrics-port", runserver.DefaultMetricsPort, "The metrics port")
53-
poolName = flag.String("pool-name", runserver.DefaultPoolName, "Name of the InferencePool this Endpoint Picker is associated with.")
54-
poolGroup = flag.String("pool-group", runserver.DefaultPoolGroup, "group of the InferencePool this Endpoint Picker is associated with.")
55-
poolNamespace = flag.String("pool-namespace", "", "Namespace of the InferencePool this Endpoint Picker is associated with.")
56-
logVerbosity = flag.Int("v", logging.DEFAULT, "number for the log level verbosity")
57-
secureServing = flag.Bool("secure-serving", runserver.DefaultSecureServing, "Enables secure serving. Defaults to true.")
58-
healthChecking = flag.Bool("health-checking", runserver.DefaultHealthChecking, "Enables health checking")
59-
certPath = flag.String("cert-path", runserver.DefaultCertPath, "The path to the certificate for secure serving. The certificate and private key files "+
50+
grpcPort = flag.Int("grpc-port", runserver.DefaultGrpcPort, "The gRPC port used for communicating with Envoy proxy")
51+
grpcHealthPort = flag.Int("grpc-health-port", runserver.DefaultGrpcHealthPort, "The port used for gRPC liveness and readiness probes")
52+
metricsPort = flag.Int("metrics-port", runserver.DefaultMetricsPort, "The metrics port")
53+
poolName = flag.String("pool-name", runserver.DefaultPoolName, "Name of the InferencePool this Endpoint Picker is associated with.")
54+
poolGroup = flag.String("pool-group", runserver.DefaultPoolGroup, "group of the InferencePool this Endpoint Picker is associated with.")
55+
poolNamespace = flag.String("pool-namespace", "", "Namespace of the InferencePool this Endpoint Picker is associated with.")
56+
enableScaleToZero = flag.Bool("enable-scale-to-zero", false, "Enable scaling down InferencePool to zero replicas after a period of idleness")
57+
logVerbosity = flag.Int("v", logging.DEFAULT, "number for the log level verbosity")
58+
secureServing = flag.Bool("secure-serving", runserver.DefaultSecureServing, "Enables secure serving. Defaults to true.")
59+
healthChecking = flag.Bool("health-checking", runserver.DefaultHealthChecking, "Enables health checking")
60+
certPath = flag.String("cert-path", runserver.DefaultCertPath, "The path to the certificate for secure serving. The certificate and private key files "+
6061
"are assumed to be named tls.crt and tls.key, respectively. If not set, and secureServing is enabled, "+
6162
"then a self-signed certificate is used.")
6263
haEnableLeaderElection = flag.Bool("ha-enable-leader-election", false, "Enables leader election for high availability. When enabled, readiness probes will only pass on the leader.")
@@ -107,14 +108,16 @@ func Run(ctx context.Context) error {
107108
}
108109

109110
// --- Setup Deactivator ---
110-
deactivator, err := requestcontrol.DeactivatorWithConfig(cfg, &datastore)
111-
if err != nil {
112-
setupLog.Error(err, "Failed to setup Deactivator")
113-
return err
114-
}
111+
if *enableScaleToZero {
112+
deactivator, err := requestcontrol.DeactivatorWithConfig(cfg, &datastore)
113+
if err != nil {
114+
setupLog.Error(err, "Failed to setup Deactivator")
115+
return err
116+
}
115117

116-
// Start Deactivator
117-
go deactivator.MonitorInferencePoolIdleness(ctx)
118+
// Start Deactivator
119+
go deactivator.MonitorInferencePoolIdleness(ctx)
120+
}
118121

119122
// --- Setup Metrics Server ---
120123
metricsServerOptions := metricsserver.Options{

0 commit comments

Comments
 (0)