@@ -199,6 +199,8 @@ func main() {
199199 var dockerHostNamespace string
200200 var dockerHostReuseType string
201201
202+ var clusterAutoscalerEvict bool
203+
202204 flag .StringVar (& metricsAddr , "metrics-bind-address" , "0" , "The address the metrics endpoint binds to. " +
203205 "Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service." )
204206 flag .BoolVar (& secureMetrics , "metrics-secure" , true ,
@@ -430,6 +432,10 @@ func main() {
430432 `The resource type (namespace, project, organization) to use when assigning a docker-host to a build to preference an already used dockerhost
431433 eg. If project is defined, all builds from a project will prefer to build on the same docker-host where possible` )
432434
435+ // Flag to control the setting for the label cluster-autoscaler.kubernetes.io/safe-to-evict on build pods, defaults to false to avoid evicting pods
436+ flag .BoolVar (& clusterAutoscalerEvict , "enable-cluster-autoscaler-eviction" , false ,
437+ "Flag to enable cluster autoscaler eviction on build pods, defaults to false to avoid evicting running builds" )
438+
433439 flag .Parse ()
434440
435441 // get overrides from environment variables
@@ -990,6 +996,7 @@ func main() {
990996 DockerHost : dockerhosts ,
991997 QueueCache : buildsQueueCache ,
992998 BuildCache : buildsCache ,
999+ ClusterAutoscalerEvict : clusterAutoscalerEvict ,
9931000 }).SetupWithManager (mgr ); err != nil {
9941001 setupLog .Error (err , "unable to create controller" , "controller" , "LagoonBuild" )
9951002 os .Exit (1 )
@@ -1018,11 +1025,12 @@ func main() {
10181025 HTTPSProxy : httpsProxy ,
10191026 NoProxy : noProxy ,
10201027 },
1021- LFFTaskQoSEnabled : lffTaskQoSEnabled ,
1022- TaskQoS : taskQoSConfigv1beta2 ,
1023- ImagePullPolicy : tipp ,
1024- QueueCache : tasksQueueCache ,
1025- TasksCache : tasksCache ,
1028+ LFFTaskQoSEnabled : lffTaskQoSEnabled ,
1029+ TaskQoS : taskQoSConfigv1beta2 ,
1030+ ImagePullPolicy : tipp ,
1031+ QueueCache : tasksQueueCache ,
1032+ TasksCache : tasksCache ,
1033+ ClusterAutoscalerEvict : clusterAutoscalerEvict ,
10261034 }).SetupWithManager (mgr ); err != nil {
10271035 setupLog .Error (err , "unable to create controller" , "controller" , "LagoonTask" )
10281036 os .Exit (1 )
0 commit comments